123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- /**
- * 分销体现记录Model
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2020/07/22
- * Time: 15:00
- */
- namespace JinDouYun\Controller\Commission;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Commission\MCommissionWithdrawals;
- class ApiCommissionWithdrawals extends BaseController
- {
- private $objMCommissionWithdrawals;
- public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
- $this->objMCommissionWithdrawals = new MCommissionWithdrawals($this->onlineUserId, $this->onlineEnterpriseId);
- }
- /**
- * 添加提现记录
- */
- public function add()
- {
- $paramsData = $this->request->getRawJson();
- $params = [
- 'userCenterId' => $this->onlineUserId,
- 'businessmanId' => isset($paramsData['businessmanId']) ? $paramsData['businessmanId'] : '',
- 'type' => isset($paramsData['type']) ? $paramsData['type'] : '',
- 'accountContent' => isset($paramsData['accountContent']) ? $paramsData['accountContent'] : '',
- 'money' => isset($paramsData['money']) ? $paramsData['money'] : '',
- 'nowMoney' => isset($paramsData['nowMoney']) ? $paramsData['nowMoney'] : '',
- 'createTime' => time(),
- 'updateTime' => time(),
- ];
- foreach ($params as $k => $v) {
- if (empty($v) && $v !== 0) {
- $this->sendOutput($k . '参数错误', ErrorCode::$paramError);
- }
- }
- $result = $this->objMCommissionWithdrawals->add($params);
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- /**
- * 获取所有的体现记录
- */
- public function getAll()
- {
- $paramsData = $this->request->getRawJson();
- $selectParams = [
- 'page' => isset($paramsData['page']) ? $paramsData['page'] : 1,
- 'pageSize' => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
- 'auditStatus' => isset($paramsData['auditStatus']) ? $paramsData['auditStatus'] : '',
- ];
- foreach ($selectParams as $k => $v) {
- if (empty($v) && $v !== 0) {
- $this->sendOutput($k . '参数错误', ErrorCode::$paramError);
- }
- }
- $pageParams = pageToOffset($selectParams['page'], $selectParams['pageSize']);
- $selectParams['limit'] = $pageParams['limit'];
- $selectParams['offset'] = $pageParams['offset'];
- $result = $this->objMCommissionWithdrawals->getAll($selectParams);
- if ($result->isSuccess()) {
- $returnData = $result->getData();
- $pageData = [
- 'pageIndex' => $paramsData['page'],
- 'pageSize' => $paramsData['pageSize'],
- 'pageTotal' => $returnData['total'],
- ];
- parent::sendOutput($returnData['data'], 0, $pageData);
- } else {
- parent::sendOutput($result->getData(), ErrorCode::$dberror);
- }
- }
- /**
- * 详情接口
- */
- public function detail()
- {
- $id = $this->request->param('request_id');
- if (!$id) {
- parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
- }
- $result = $this->objMCommissionWithdrawals->detail($id);
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- }
|