UserExtract.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\user;
  12. use app\common\repositories\store\ExcelRepository;
  13. use crmeb\basic\BaseController;
  14. use crmeb\services\ExcelService;
  15. use think\App;
  16. use app\validate\api\UserExtractValidate as validate;
  17. use app\common\repositories\user\UserExtractRepository as repository;
  18. /**
  19. * Class UserExtract
  20. * app\controller\admin\user
  21. * 用户申请提现
  22. */
  23. class UserExtract extends BaseController
  24. {
  25. /**
  26. * @var repository
  27. */
  28. public $repository;
  29. /**
  30. * UserExtract constructor.
  31. * @param App $app
  32. * @param repository $repository
  33. */
  34. public function __construct(App $app, repository $repository)
  35. {
  36. parent::__construct($app);
  37. $this->repository = $repository;
  38. }
  39. /**
  40. * 申请提现列表
  41. * @return mixed
  42. * @author Qinii
  43. * @day 2020-06-16
  44. */
  45. public function lst()
  46. {
  47. [$page, $limit] = $this->getPage();
  48. $where = $this->request->params(['status', 'keyword', 'date', 'extract_type','uid','phone','real_name','nickname']);
  49. return app('json')->success($this->repository->getList($where, $page, $limit));
  50. }
  51. /**
  52. * 审核表单
  53. * @param $id
  54. * @return mixed
  55. * @author Qinii
  56. * @day 2020-06-16
  57. */
  58. public function switchStatusForm($id)
  59. {
  60. return app('json')->success(formToData($this->repository->switchStatusForm($id)));
  61. }
  62. /**
  63. * 审核
  64. * @param $id
  65. * @return mixed
  66. * @author Qinii
  67. * @day 2020-06-16
  68. */
  69. public function switchStatus($id)
  70. {
  71. $data = $this->request->params(['fail_msg', 'mark']);
  72. $data['status'] = $this->request->param('status') == 1 ? 1 : -1;
  73. if ($data['status'] == '-1' && empty($data['fail_msg']))
  74. return app('json')->fail('请填写拒绝原因');
  75. if (!$this->repository->getWhereCount($id))
  76. return app('json')->fail('数据不存在或状态错误');
  77. $data['admin_id'] = $this->request->adminId();
  78. $data['status_time'] = date('Y-m-d H:i:s', time());
  79. $this->repository->switchStatus($id, $data);
  80. return app('json')->success('审核成功');
  81. }
  82. /**
  83. * 导出
  84. * @return \think\response\Json
  85. * @author Qinii
  86. */
  87. public function export()
  88. {
  89. $where = $this->request->params(['status', 'keyword', 'date', 'extract_type']);
  90. [$page, $limit] = $this->getPage();
  91. $data = app()->make(ExcelService::class)->extract($where, $page, $limit);
  92. return app('json')->success($data);
  93. }
  94. /**
  95. * 详情
  96. * @param $id
  97. * @return mixed
  98. * @author Qinii
  99. * @day 2020-06-16
  100. */
  101. public function detail($id)
  102. {
  103. return app('json')->success($this->repository->detail((int)$id));
  104. }
  105. }