123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?php
- namespace JinDouYun\Controller\Merchant;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Merchant\MMerchant;
- use JinDouYun\Model\Merchant\MMerchantWithdraw;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\ResultWrapper;
- /**
- * @copyright Copyright (c) https://www.qianniaovip.com All rights reserved
- * Description:
- * Class MerchantWithdraw
- * @package JinDouYun\Controller\Merchant
- */
- class MerchantWithdraw extends BaseController
- {
- /**
- * @var MMerchantWithdraw
- */
- private $objMMerchantWithdraw;
- /**
- * MerchantWithdraw constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- * @param bool $checkToken
- * @param false $getAreaCode
- * @param bool $checkShopToken
- * @throws \Exception
- */
- public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false, $checkShopToken = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken);
- $this->objMMerchantWithdraw = new MMerchantWithdraw($this->onlineEnterpriseId,$this->onlineUserId);
- }
- /**
- * Doc: (des="商户结算页面数据")
- * User: XMing
- * Date: 2020/12/8
- * Time: 11:44 上午
- */
- public function get()
- {
- $objMMerchant = new MMerchant($this->onlineEnterpriseId,$this->onlineUserId);
- $modelResult = $objMMerchant->getWithdraw($this->shopId);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- /**
- * 添加提现记录
- * @throws \Exception
- */
- public function add()
- {
- $paramsData = $this->request->getRawJson();
- $params = [
- 'merchantId' => getArrayItem($paramsData,'merchantId',''),
- 'type' => isset($paramsData['type']) ? $paramsData['type'] : '',
- 'accountContent' => isset($paramsData['accountContent']) ? $paramsData['accountContent'] : '',
- 'money' => isset($paramsData['money']) ? $paramsData['money'] : '',
- 'orderNum' => isset($paramsData['orderNum']) ? $paramsData['orderNum'] : null,
- //'nowMoney' => isset($paramsData['nowMoney']) ? $paramsData['nowMoney'] : '',
- 'createTime' => time(),
- 'updateTime' => time(),
- ];
- foreach ($params as $k => $v) {
- if (empty($v) && $v !== 0) {
- parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
- }
- }
- $merchantId = $params['merchantId'];
- unset($params['merchantId']);
- $result = $this->objMMerchantWithdraw->add($params,$merchantId);
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- }
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- /**
- * Doc: (des="更新提现记录状态")
- * User: XMing
- * Date: 2020/12/8
- * Time: 3:55 下午
- * @throws \Exception
- */
- public function updateAuditStatus()
- {
- $id = $this->request->param('request_id');
- if (!$id) {
- parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
- }
- $status = $this->request->param('status');
- if(!$status){
- parent::sendOutput('请指定要修改的状态', ErrorCode::$paramError);
- }
- $result = $this->objMMerchantWithdraw->updateAuditStatus($id,$status);
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- }
- parent::sendOutput($result->getData(), ErrorCode::$dberror);
- }
- /**
- * Doc: (des="提现记录")
- * User: XMing
- * Date: 2020/12/8
- * Time: 3:54 下午
- */
- public function getAll()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
- $params['limit'] = $pageParams['limit'];
- $params['offset'] = $pageParams['offset'];
- $params['merchantId'] = getArrayItem($params,'merchantId',"");
- $params['type'] = getArrayItem($params,'type',"");
- $params['auditStatus'] = getArrayItem($params,'auditStatus',"");
- $params['startTime'] = getArrayItem($params,'startTime',"");
- $params['end'] = getArrayItem($params,'end',"");
- $params['no'] = getArrayItem($params,'no',"");
- $result = $this->objMMerchantWithdraw->getAll($params);
- if ($result->isSuccess()) {
- $returnData = $result->getData();
- $pageData = [
- 'pageIndex' => getArrayItem($params,'page',1),
- 'pageSize' => getArrayItem($params,'pageSize',10),
- 'pageTotal' => $returnData['total'],
- ];
- parent::sendOutput($returnData['data'], 0, $pageData);
- }
- parent::sendOutput($result->getData(), ErrorCode::$dberror);
- }
- }
|