CommissionWithdrawals.Class.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * 分销体现记录Model
  4. * Created by PhpStorm.
  5. * User: phperstar
  6. * Date: 2020/07/22
  7. * Time: 15:00
  8. */
  9. namespace JinDouYun\Controller\Commission;
  10. use Mall\Framework\Core\ErrorCode;
  11. use Mall\Framework\Core\StatusCode;
  12. use JinDouYun\Controller\BaseController;
  13. use JinDouYun\Model\Commission\MCommissionWithdrawals;
  14. class CommissionWithdrawals extends BaseController
  15. {
  16. private $objMCommissionWithdrawals;
  17. public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
  18. {
  19. parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
  20. $this->objMCommissionWithdrawals = new MCommissionWithdrawals($this->onlineUserId, $this->onlineEnterpriseId);
  21. }
  22. /**
  23. * 获取所有的提现记录
  24. */
  25. public function getAll()
  26. {
  27. $paramsData = $this->request->getRawJson();
  28. $selectParams = [
  29. 'page' => isset($paramsData['page']) ? $paramsData['page'] : 1,
  30. 'pageSize' => isset($paramsData['pageSize']) ? $paramsData['pageSize'] : 10,
  31. 'keyword' => isset($paramsData['keyword']) ? $paramsData['keyword'] : 0,
  32. 'grade' => isset($paramsData['grade']) ? $paramsData['grade'] : 0,
  33. 'type' => isset($paramsData['type']) ? $paramsData['type'] : 0,
  34. 'startTime' => isset($paramsData['startTime']) ? $paramsData['startTime'] : 0,
  35. 'endTime' => isset($paramsData['endTime']) ? $paramsData['endTime'] : 0,
  36. 'auditStatus' => isset($paramsData['auditStatus']) ? $paramsData['auditStatus'] : '',
  37. ];
  38. $pageParams = pageToOffset($selectParams['page'], $selectParams['pageSize']);
  39. $selectParams['limit'] = $pageParams['limit'];
  40. $selectParams['offset'] = $pageParams['offset'];
  41. $result = $this->objMCommissionWithdrawals->getAll($selectParams);
  42. if ($result->isSuccess()) {
  43. $returnData = $result->getData();
  44. $pageData = [
  45. 'pageIndex' => $paramsData['page'],
  46. 'pageSize' => $paramsData['pageSize'],
  47. 'pageTotal' => $returnData['total'],
  48. ];
  49. parent::sendOutput($returnData['data'], 0, $pageData);
  50. } else {
  51. parent::sendOutput($result->getData(), ErrorCode::$dberror);
  52. }
  53. }
  54. /**
  55. * 修改提现记录状态
  56. */
  57. public function updateAuditStatus()
  58. {
  59. $id = $this->request->param('request_id');
  60. if (!$id) {
  61. parent::sendOutput('请指定要审核的数据id', ErrorCode::$paramError);
  62. }
  63. $status = $this->request->param('status');
  64. if(!$status){
  65. parent::sendOutput('请指定要修改的状态', ErrorCode::$paramError);
  66. }
  67. $result = $this->objMCommissionWithdrawals->updateAuditStatus($id,$status);
  68. if ($result->isSuccess()) {
  69. parent::sendOutput($result->getData());
  70. } else {
  71. parent::sendOutput($result->getData(), ErrorCode::$dberror);
  72. }
  73. }
  74. }