MerchantApplyments.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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\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. /**
  17. * 商户分账账户申请
  18. */
  19. class MerchantApplyments extends BaseController
  20. {
  21. protected $repository;
  22. /**
  23. * MerchantApplyments constructor.
  24. * @param App $app
  25. * @param MerchantApplymentsRepository $repository
  26. */
  27. public function __construct(App $app, MerchantApplymentsRepository $repository)
  28. {
  29. parent::__construct($app);
  30. $this->repository = $repository;
  31. }
  32. /**
  33. * 列表
  34. * @return \think\response\Json
  35. * @author Qinii
  36. */
  37. public function lst()
  38. {
  39. [$page, $limit] = $this->getPage();
  40. $where = $this->request->params(['mer_name', 'status', 'date', 'mer_applyments_id', 'out_request_no', 'applyment_id', 'mer_id']);
  41. return app('json')->success($this->repository->getList($where, $page, $limit));
  42. }
  43. /**
  44. * 详情
  45. * @param $id
  46. * @return \think\response\Json
  47. * @author Qinii
  48. */
  49. public function detail($id)
  50. {
  51. $data = $this->repository->detail($id);
  52. if (empty($data)) return app('json')->fail('数据不存在');
  53. return app('json')->success($data);
  54. }
  55. /**
  56. * 审核
  57. * @param $id
  58. * @return \think\response\Json
  59. * @author Qinii
  60. */
  61. public function switchWithStatus($id)
  62. {
  63. $data = $this->request->params(['status', 'message']);
  64. if (!in_array($data['status'], [0, -1, 10])) return app('json')->fail('参数错误');
  65. if ($data['status'] == -1 && !$data['message']) return app('json')->fail('驳回理由为空');
  66. $this->repository->switchWithStatus($id, $data);
  67. return app('json')->success('审核成功');
  68. }
  69. /**
  70. * 商户信息
  71. * @param $id
  72. * @return \think\response\Json
  73. * @author Qinii
  74. */
  75. public function getMerchant($id)
  76. {
  77. $data = $this->repository->getMerchant($id);
  78. return app('json')->success($data);
  79. }
  80. /**
  81. * 备注表单
  82. * @param $id
  83. * @return \think\response\Json
  84. * @author Qinii
  85. */
  86. public function markForm($id)
  87. {
  88. return app('json')->success(formToData($this->repository->markForm($id)));
  89. }
  90. /**
  91. * 备注
  92. * @param $id
  93. * @return \think\response\Json
  94. * @author Qinii
  95. */
  96. public function mark($id)
  97. {
  98. if (!$this->repository->get($id))
  99. return app('json')->fail('数据不存在');
  100. $this->repository->update($id, ['mark' => $this->request->param('mark', '')]);
  101. return app('json')->success('备注成功');
  102. }
  103. }