CashOutAccount.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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\service\api\member\MemberCashOutAccountService;
  13. use core\base\BaseApiController;
  14. use think\Response;
  15. class CashOutAccount extends BaseApiController
  16. {
  17. /**
  18. * 提现账户列表
  19. * @return Response
  20. */
  21. public function lists(){
  22. $data = $this->request->params([
  23. ['account_type', '']
  24. ]);
  25. return success((new MemberCashOutAccountService())->getPage($data));
  26. }
  27. /**
  28. * 提现账户信息
  29. * @param int $account_id
  30. * @return Response
  31. */
  32. public function info(int $account_id){
  33. return success((new MemberCashOutAccountService())->getInfo($account_id));
  34. }
  35. /**
  36. * 查询首条提现账户按账户类型
  37. * @return Response
  38. */
  39. public function firstInfo(){
  40. $data = $this->request->params([
  41. ['account_type', '']
  42. ]);
  43. return success((new MemberCashOutAccountService())->getFirstInfo($data));
  44. }
  45. /**
  46. * 添加提现账号
  47. * @return Response
  48. */
  49. public function add(){
  50. $data = $this->request->params([
  51. ['account_type', ''],
  52. ['bank_name', ''],
  53. ['realname', ''],
  54. ['account_no', '']
  55. ]);
  56. $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
  57. $id = (new MemberCashOutAccountService())->add($data);
  58. return success('ADD_SUCCESS', [ 'id' => $id ]);
  59. }
  60. /**
  61. * 编辑提现账号
  62. * @param int $account_id
  63. * @return Response
  64. */
  65. public function edit(int $account_id){
  66. $data = $this->request->params([
  67. ['account_type', ''],
  68. ['bank_name', ''],
  69. ['realname', ''],
  70. ['account_no', '']
  71. ]);
  72. $this->validate($data, 'app\validate\member\CashOutAccount.addOrEdit');
  73. (new MemberCashOutAccountService())->edit($account_id, $data);
  74. return success('EDIT_SUCCESS');
  75. }
  76. /**
  77. * 删除提现账号
  78. * @param int $account_id
  79. * @return Response
  80. */
  81. public function del(int $account_id){
  82. (new MemberCashOutAccountService())->del($account_id);
  83. return success('DELETE_SUCCESS');
  84. }
  85. }