MerchantApplyments.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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\system\merchant;
  12. use app\common\repositories\system\CacheRepository;
  13. use think\App;
  14. use crmeb\basic\BaseController;
  15. use app\common\repositories\system\merchant\MerchantApplymentsRepository;
  16. class MerchantApplyments extends BaseController
  17. {
  18. protected $repository;
  19. /**
  20. * MerchantApplyments constructor.
  21. * @param App $app
  22. * @param MerchantApplymentsRepository $repository
  23. */
  24. public function __construct(App $app, MerchantApplymentsRepository $repository)
  25. {
  26. parent::__construct($app);
  27. $this->repository = $repository;
  28. }
  29. public function lst()
  30. {
  31. [$page, $limit] = $this->getPage();
  32. $where = $this->request->params(['mer_name','status','date','mer_applyments_id','out_request_no','applyment_id','mer_id']);
  33. return app('json')->success($this->repository->getList($where, $page, $limit));
  34. }
  35. public function detail($id)
  36. {
  37. $data = $this->repository->detail($id);
  38. if(empty($data)) return app('json')->fail('数据不存在');
  39. return app('json')->success($data);
  40. }
  41. public function switchWithStatus($id)
  42. {
  43. $data = $this->request->params(['status','message']);
  44. if(!in_array($data['status'],[0,-1,10])) return app('json')->fail('参数错误');
  45. if($data['status'] == -1 && !$data['message'] ) return app('json')->fail('驳回理由为空');
  46. $this->repository->switchWithStatus($id,$data);
  47. return app('json')->success('审核成功');
  48. }
  49. public function getMerchant($id)
  50. {
  51. $data = $this->repository->getMerchant($id);
  52. return app('json')->success($data);
  53. }
  54. public function markForm($id)
  55. {
  56. return app('json')->success(formToData($this->repository->markForm($id)));
  57. }
  58. public function mark($id)
  59. {
  60. if(!$this->repository->get($id))
  61. return app('json')->fail('数据不存在');
  62. $this->repository->update($id,['mark' => $this->request->param('mark','')]);
  63. return app('json')->success('备注成功');
  64. }
  65. }