ShopCashOut.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace app\adminapi\controller\shop\admin;
  3. use app\dict\shop\ShopCashOutDict;
  4. use app\dict\shop\ShopTransferDict;
  5. use app\service\admin\shop\admin\ShopCashOutService;
  6. use app\service\admin\shop\admin\ShopConfigService;
  7. use core\base\BaseAdminController;
  8. class ShopCashOut extends BaseAdminController
  9. {
  10. /**
  11. * 店铺提现列表
  12. * @return \think\Response
  13. */
  14. public function lists()
  15. {
  16. $data = $this->request->params([
  17. [ 'cash_out_no', '' ],
  18. [ 'status', '' ],
  19. [ 'keyword', '' ],
  20. [ 'transfer_type', '' ],
  21. [ 'create_time', [] ],
  22. [ 'audit_time', [] ],
  23. [ 'transfer_time', [] ]
  24. ]);
  25. return success(( new ShopCashOutService() )->getPage($data));
  26. }
  27. /**
  28. * 店铺提现详情
  29. * @param int $id
  30. * @return \think\Response
  31. */
  32. public function info(int $id)
  33. {
  34. return success(( new ShopCashOutService() )->getInfo($id));
  35. }
  36. /**
  37. * 店铺提现审核
  38. * @return \think\Response
  39. */
  40. public function audit($id)
  41. {
  42. $data = $this->request->params([
  43. ['status', ''],
  44. ['refuse_reason', '']
  45. ]);
  46. $this->validate($data, 'app\validate\shop\ShopCashOut.audit');
  47. ( new ShopCashOutService() )->audit($id, $data);
  48. return success('AUDIT_SUCCESS');
  49. }
  50. /**
  51. * 店铺提现转账
  52. * @return \think\Response
  53. */
  54. public function transfer($id)
  55. {
  56. $data = $this->request->params([
  57. ['transfer_no', ''],
  58. ['transfer_voucher', '']
  59. ]);
  60. $this->validate($data, 'app\validate\shop\ShopCashOut.transfer');
  61. ( new ShopCashOutService() )->transfer($id, $data);
  62. return success('TRANSFER_SUCCESS');
  63. }
  64. /**
  65. * 获取店铺提现设置
  66. * @return \think\Response
  67. */
  68. public function getCashOutConfig()
  69. {
  70. return success((new ShopConfigService())->getCashOutConfig());
  71. }
  72. /**
  73. * 店铺提现设置
  74. * @return \think\Response
  75. */
  76. public function setCashOutConfig()
  77. {
  78. $data = $this->request->params([
  79. ['is_open', 1], //是否开启
  80. ['min', 0.01], //最低提现金额
  81. ['rate', 0], //提现手续费比率
  82. ['is_auto_verify', 0], //是否自动审核
  83. ['is_auto_transfer', 0], //是否自动转账
  84. ['transfer_type', []] //转账方式
  85. ]);
  86. $this->validate($data, 'app\validate\shop\CashOutConfig.set');
  87. (new ShopConfigService())->setCashOutConfig($data);
  88. return success('SET_SUCCESS');
  89. }
  90. /**
  91. * 转账方式
  92. * @return \think\Response
  93. */
  94. public function getTransferType()
  95. {
  96. return success(ShopTransferDict::getType());
  97. }
  98. /**
  99. * 提现状态
  100. * @return \think\Response
  101. */
  102. public function getStatus()
  103. {
  104. return success(ShopCashOutDict::getStatus());
  105. }
  106. /**
  107. * 查询提现统计数据
  108. * @return \think\Response
  109. */
  110. public function getWithdrawData()
  111. {
  112. return success(( new ShopCashOutService() )->getWithdrawData());
  113. }
  114. }