EnterpriseVerifyMgr.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\EnterpriseVerifyMgrApi;
  5. /**
  6. * Description of EnterpriseVerifyMgr
  7. *
  8. * @author sgq
  9. */
  10. class EnterpriseVerifyMgr extends AdminController {
  11. /**
  12. * @auth {{/enterprisetypeProperties}}
  13. * @return type
  14. */
  15. public function index() {
  16. return view();
  17. }
  18. public function list() {
  19. return json(EnterpriseVerifyMgrApi::getList($this->request->param()));
  20. }
  21. /**
  22. * @auth {{/enterprisetypeProperties/add}}
  23. * @return type
  24. */
  25. public function add() {
  26. if ($this->request->isPost()) {
  27. $params = $this->request->param();
  28. if (!$params["enterpriseTag"]) {
  29. return json(["msg" => "请选择单位标签"]);
  30. }
  31. if (!$params["companyId"]) {
  32. return json(["msg" => "请选择审核单位"]);
  33. }
  34. if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"]))
  35. return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
  36. if (EnterpriseVerifyMgrApi::edit($params))
  37. return json(["code" => 200, "msg" => "添加单位标签审核配置成功"]);
  38. return json(["msg" => "添加单位标签审核配置失败"]);
  39. }
  40. return view();
  41. }
  42. /**
  43. * @auth {{/enterprisetypeProperties/update}}
  44. * @return type
  45. */
  46. public function edit() {
  47. $params = $this->request->param();
  48. if ($this->request->isPost()) {
  49. if (!$params["id"])
  50. return json(["msg" => "没有正文,无法编辑"]);
  51. if (!$params["enterpriseTag"]) {
  52. return json(["msg" => "请选择单位标签"]);
  53. }
  54. if (!$params["companyId"]) {
  55. return json(["msg" => "请选择审核单位"]);
  56. }
  57. if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"], $params["id"]))
  58. return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
  59. if (EnterpriseVerifyMgrApi::edit($params))
  60. return json(["code" => 200, "msg" => "编辑单位标签审核配置成功"]);
  61. return json(["msg" => "编辑单位标签审核配置失败"]);
  62. }
  63. return view("", ["info" => EnterpriseVerifyMgrApi::getOne($params["id"])]);
  64. }
  65. /**
  66. * @auth {{/enterprisetypeProperties/delete}}
  67. * @return type
  68. */
  69. public function delete() {
  70. if ($this->request->isPost()) {
  71. $id = $this->request->param("id");
  72. if (EnterpriseVerifyMgrApi::delete($id))
  73. return json(["code" => 200, "msg" => "删除单位标签审核配置成功"]);
  74. return json(["msg" => "删除单位标签审核配置失败"]);
  75. }
  76. }
  77. }