MemberCashOut.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\member;
  12. use app\dict\member\MemberAccountTypeDict;
  13. use app\dict\pay\TransferDict;
  14. use app\service\api\member\MemberCashOutService;
  15. use core\base\BaseApiController;
  16. use think\Response;
  17. class MemberCashOut extends BaseApiController
  18. {
  19. /**
  20. * 会员提现列表
  21. * @return Response
  22. */
  23. public function lists()
  24. {
  25. $data = array_filter($this->request->params([
  26. [ 'status', '' ],
  27. [ 'account_type', '' ]
  28. ]), function($value){
  29. return $value !== '';
  30. });
  31. return success(( new MemberCashOutService() )->getPage($data));
  32. }
  33. /**
  34. * 提现详情
  35. * @return Response
  36. */
  37. public function info($id)
  38. {
  39. return success(( new MemberCashOutService() )->getInfo($id));
  40. }
  41. /**
  42. * 提现配置
  43. * @return Response
  44. */
  45. public function config()
  46. {
  47. return success(( new MemberCashOutService() )->getCashOutConfig());
  48. }
  49. /**
  50. * 转账方式
  51. * @return Response
  52. */
  53. public function getTransferType()
  54. {
  55. return success(TransferDict::getTransferType([], false));
  56. }
  57. /**
  58. * 申请提现
  59. * @return Response
  60. */
  61. public function apply()
  62. {
  63. $data = $this->request->params([
  64. [ 'apply_money', 0 ],
  65. [ 'account_type', MemberAccountTypeDict::MONEY ],
  66. [ 'transfer_type', '' ],
  67. [ 'account_id', 0 ],
  68. [ 'transfer_payee', []] ,//收款方信息
  69. ]);
  70. $this->validate($data, 'app\validate\member\CashOut.apply');
  71. return success(data:( new MemberCashOutService() )->apply($data));
  72. }
  73. /**
  74. * 撤销提现申请
  75. * @param $id
  76. * @return Response
  77. */
  78. public function cancel($id)
  79. {
  80. return success(data:( new MemberCashOutService() )->cancel($id));
  81. }
  82. /**
  83. * 开始转账
  84. * @param $id
  85. * @return Response
  86. */
  87. public function transfer($id)
  88. {
  89. $data = $this->request->params([
  90. ['open_id', 0],
  91. ]);
  92. return success(data: (new MemberCashOutService())->transfer($id, $data));
  93. }
  94. }