Apply.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\store\controller\apps\dealer;
  10. use app\store\controller\Controller;
  11. use app\store\model\dealer\Apply as ApplyModel;
  12. /**
  13. * 分销商申请
  14. * Class Setting
  15. * @package app\store\controller\apps\dealer
  16. */
  17. class Apply extends Controller
  18. {
  19. /**
  20. * 分销商申请列表
  21. * @param string $search
  22. * @return mixed
  23. * @throws \think\exception\DbException
  24. */
  25. public function index($search = '')
  26. {
  27. $model = new ApplyModel;
  28. return $this->fetch('index', [
  29. 'list' => $model->getList($search),
  30. ]);
  31. }
  32. /**
  33. * 分销商审核
  34. * @param $apply_id
  35. * @return array
  36. * @throws \app\common\exception\BaseException
  37. * @throws \think\exception\DbException
  38. * @throws \think\exception\PDOException
  39. */
  40. public function submit($apply_id)
  41. {
  42. $model = ApplyModel::detail($apply_id);
  43. if ($model->submit($this->postData('apply'))) {
  44. return $this->renderSuccess('操作成功');
  45. }
  46. return $this->renderError($model->getError() ?: '操作失败');
  47. }
  48. }