UserExtract.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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 crmeb\basic\BaseController;
  13. use think\App;
  14. use app\validate\api\UserExtractValidate as validate;
  15. use app\common\repositories\user\UserExtractRepository as repository;
  16. class UserExtract extends BaseController
  17. {
  18. /**
  19. * @var repository
  20. */
  21. public $repository;
  22. /**
  23. * UserExtract constructor.
  24. * @param App $app
  25. * @param repository $repository
  26. */
  27. public function __construct(App $app,repository $repository)
  28. {
  29. parent::__construct($app);
  30. $this->repository = $repository;
  31. }
  32. /**
  33. * TODO
  34. * @return mixed
  35. * @author Qinii
  36. * @day 2020-06-16
  37. */
  38. public function lst()
  39. {
  40. [$page,$limit] = $this->getPage();
  41. $where = $this->request->params(['status','keyword','date','extract_type']);
  42. return app('json')->success($this->repository->search($where,$page,$limit));
  43. }
  44. /**
  45. * TODO
  46. * @param $id
  47. * @return mixed
  48. * @author Qinii
  49. * @day 2020-06-16
  50. */
  51. public function switchStatus($id)
  52. {
  53. $data = $this->request->params(['status','fail_msg','mark']);
  54. if($data['status'] == '-1' && empty($data['fail_msg']))
  55. return app('json')->fail('请填写拒绝原因');
  56. if(!$this->repository->getWhereCount($id))
  57. return app('json')->fail('数据不存在或状态错误');
  58. $data['admin_id'] = $this->request->adminId();
  59. $data['status_time'] = date('Y-m-d H:i:s',time());
  60. $this->repository->switchStatus($id,$data);
  61. return app('json')->success('审核成功');
  62. }
  63. }