Withdraw.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\basics\Api;
  4. use app\api\validate\WithdrawValidate;
  5. use app\common\server\JsonServer;
  6. use app\api\logic\WithdrawLogic;
  7. /**
  8. * Class Withdraw
  9. * @package app\api\controller
  10. */
  11. class Withdraw extends Api
  12. {
  13. /**
  14. * @notes 提现申请
  15. * @return \think\response\Json
  16. * @throws \think\Exception
  17. * @author suny
  18. * @date 2021/7/13 6:16 下午
  19. */
  20. public function apply()
  21. {
  22. $post = $this->request->post();
  23. $post['user_id'] = $this->user_id;
  24. (new WithdrawValidate())->goCheck('apply', $post);
  25. $id = WithdrawLogic::apply($this->user_id, $post);
  26. return JsonServer::success('申请成功', ['id' => $id]);
  27. }
  28. /**
  29. * @notes 提现配置
  30. * @return \think\response\Json
  31. * @author suny
  32. * @date 2021/7/13 6:16 下午
  33. */
  34. public function config()
  35. {
  36. $data = WithdrawLogic::config($this->user_id);
  37. return JsonServer::success('', $data);
  38. }
  39. /**
  40. * @notes 提现记录
  41. * @return \think\response\Json
  42. * @author suny
  43. * @date 2021/7/13 6:16 下午
  44. */
  45. public function records()
  46. {
  47. $get = $this->request->get();
  48. $page = $this->request->get('page_no', $this->page_no);
  49. $size = $this->request->get('page_size', $this->page_size);
  50. $res = WithdrawLogic::records($this->user_id, $get, $page, $size);
  51. return JsonServer::success('', $res);
  52. }
  53. /**
  54. * @notes 提现详情
  55. * @return \think\response\Json
  56. * @author suny
  57. * @date 2021/7/13 6:16 下午
  58. */
  59. public function info()
  60. {
  61. $get = $this->request->get('');
  62. (new WithdrawValidate())->goCheck('info', $get);
  63. $res = WithdrawLogic::info($get['id'], $this->user_id);
  64. return JsonServer::success('', $res);
  65. }
  66. // 收款
  67. public function receive()
  68. {
  69. $get = $this->request->post();
  70. (new WithdrawValidate())->goCheck('info', $get);
  71. $result = WithdrawLogic::receive($get['id'], $this->user_id);
  72. if($result === true) {
  73. return JsonServer::success('成功');
  74. } else {
  75. return JsonServer::success((string) $result);
  76. }
  77. }
  78. }