Security.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\supplier\controller\shop;
  3. use app\supplier\controller\Controller;
  4. use app\supplier\model\supplier\ServiceSecurity as ServiceSecurityModel;
  5. use app\supplier\model\supplier\ServiceApply as ServiceApplyModel;
  6. /**
  7. * 供应商服务保障
  8. */
  9. class Security extends Controller
  10. {
  11. /**
  12. * 基础信息
  13. */
  14. public function index(){
  15. $ServiceSecurityModel = new ServiceSecurityModel();
  16. $list = $ServiceSecurityModel->getList($this->getSupplierId());
  17. return $this->renderSuccess('', compact('list'));
  18. }
  19. //申请
  20. public function apply(){
  21. $data = $this->postData();
  22. $data['shop_supplier_id'] = $this->getSupplierId();
  23. $model = new ServiceApplyModel;
  24. if ($model->apply($data)) {
  25. return $this->renderSuccess('申请成功');
  26. }
  27. return $this->renderError($model->getError() ?: '提交失败');
  28. }
  29. //退出
  30. public function quit(){
  31. $data = $this->postData();
  32. $model = ServiceApplyModel::detail($data['service_security_id'],$this->getSupplierId());
  33. if ($model->quit()) {
  34. return $this->renderSuccess('退出成功');
  35. }
  36. return $this->renderError($model->getError() ?: '提交失败');
  37. }
  38. }