MerchantWithdraw.Class.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. namespace JinDouYun\Controller\Merchant;
  3. use JinDouYun\Controller\BaseController;
  4. use JinDouYun\Model\Merchant\MMerchant;
  5. use JinDouYun\Model\Merchant\MMerchantWithdraw;
  6. use Mall\Framework\Core\ErrorCode;
  7. use Mall\Framework\Core\ResultWrapper;
  8. /**
  9. * @copyright Copyright (c) https://www.qianniaovip.com All rights reserved
  10. * Description:
  11. * Class MerchantWithdraw
  12. * @package JinDouYun\Controller\Merchant
  13. */
  14. class MerchantWithdraw extends BaseController
  15. {
  16. /**
  17. * @var MMerchantWithdraw
  18. */
  19. private $objMMerchantWithdraw;
  20. /**
  21. * MerchantWithdraw constructor.
  22. * @param bool $isCheckAcl
  23. * @param bool $isMustLogin
  24. * @param bool $checkToken
  25. * @param false $getAreaCode
  26. * @param bool $checkShopToken
  27. * @throws \Exception
  28. */
  29. public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false, $checkShopToken = true)
  30. {
  31. parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken);
  32. $this->objMMerchantWithdraw = new MMerchantWithdraw($this->onlineEnterpriseId,$this->onlineUserId);
  33. }
  34. /**
  35. * Doc: (des="商户结算页面数据")
  36. * User: XMing
  37. * Date: 2020/12/8
  38. * Time: 11:44 上午
  39. */
  40. public function get()
  41. {
  42. $objMMerchant = new MMerchant($this->onlineEnterpriseId,$this->onlineUserId);
  43. $modelResult = $objMMerchant->getWithdraw($this->shopId);
  44. if(!$modelResult->isSuccess()){
  45. parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
  46. }
  47. parent::sendOutput($modelResult->getData());
  48. }
  49. /**
  50. * 添加提现记录
  51. * @throws \Exception
  52. */
  53. public function add()
  54. {
  55. $paramsData = $this->request->getRawJson();
  56. $params = [
  57. 'merchantId' => getArrayItem($paramsData,'merchantId',''),
  58. 'type' => isset($paramsData['type']) ? $paramsData['type'] : '',
  59. 'accountContent' => isset($paramsData['accountContent']) ? $paramsData['accountContent'] : '',
  60. 'money' => isset($paramsData['money']) ? $paramsData['money'] : '',
  61. 'orderNum' => isset($paramsData['orderNum']) ? $paramsData['orderNum'] : null,
  62. //'nowMoney' => isset($paramsData['nowMoney']) ? $paramsData['nowMoney'] : '',
  63. 'createTime' => time(),
  64. 'updateTime' => time(),
  65. ];
  66. foreach ($params as $k => $v) {
  67. if (empty($v) && $v !== 0) {
  68. parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
  69. }
  70. }
  71. $merchantId = $params['merchantId'];
  72. unset($params['merchantId']);
  73. $result = $this->objMMerchantWithdraw->add($params,$merchantId);
  74. if ($result->isSuccess()) {
  75. parent::sendOutput($result->getData());
  76. }
  77. parent::sendOutput($result->getData(), $result->getErrorCode());
  78. }
  79. /**
  80. * Doc: (des="更新提现记录状态")
  81. * User: XMing
  82. * Date: 2020/12/8
  83. * Time: 3:55 下午
  84. * @throws \Exception
  85. */
  86. public function updateAuditStatus()
  87. {
  88. $id = $this->request->param('request_id');
  89. if (!$id) {
  90. parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
  91. }
  92. $status = $this->request->param('status');
  93. if(!$status){
  94. parent::sendOutput('请指定要修改的状态', ErrorCode::$paramError);
  95. }
  96. $result = $this->objMMerchantWithdraw->updateAuditStatus($id,$status);
  97. if ($result->isSuccess()) {
  98. parent::sendOutput($result->getData());
  99. }
  100. parent::sendOutput($result->getData(), ErrorCode::$dberror);
  101. }
  102. /**
  103. * Doc: (des="提现记录")
  104. * User: XMing
  105. * Date: 2020/12/8
  106. * Time: 3:54 下午
  107. */
  108. public function getAll()
  109. {
  110. $params = $this->request->getRawJson();
  111. if (empty($params)) {
  112. $this->sendOutput('参数为空', ErrorCode::$paramError);
  113. }
  114. $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
  115. $params['limit'] = $pageParams['limit'];
  116. $params['offset'] = $pageParams['offset'];
  117. $params['merchantId'] = getArrayItem($params,'merchantId',"");
  118. $params['type'] = getArrayItem($params,'type',"");
  119. $params['auditStatus'] = getArrayItem($params,'auditStatus',"");
  120. $params['startTime'] = getArrayItem($params,'startTime',"");
  121. $params['end'] = getArrayItem($params,'end',"");
  122. $params['no'] = getArrayItem($params,'no',"");
  123. $result = $this->objMMerchantWithdraw->getAll($params);
  124. if ($result->isSuccess()) {
  125. $returnData = $result->getData();
  126. $pageData = [
  127. 'pageIndex' => getArrayItem($params,'page',1),
  128. 'pageSize' => getArrayItem($params,'pageSize',10),
  129. 'pageTotal' => $returnData['total'],
  130. ];
  131. parent::sendOutput($returnData['data'], 0, $pageData);
  132. }
  133. parent::sendOutput($result->getData(), ErrorCode::$dberror);
  134. }
  135. }