Company.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\CompanyApi;
  5. /**
  6. * Description of Company
  7. *
  8. * @author sgq
  9. */
  10. class Company extends AdminController {
  11. /**
  12. * @auth {{/company}}
  13. * @return type
  14. */
  15. function index() {
  16. return view();
  17. }
  18. /**
  19. * @auth {{/company/list}}
  20. * @return type
  21. */
  22. function list() {
  23. $result = CompanyApi::getList($this->request->param());
  24. return json($result);
  25. }
  26. /**
  27. * @auth {{/company/add}}
  28. * @return type
  29. */
  30. function add() {
  31. if ($this->request->isPost()) {
  32. CompanyApi::edit($this->request->param());
  33. return json(["code" => 200, "msg" => "添加单位成功"]);
  34. }
  35. return view();
  36. }
  37. /**
  38. * @auth {{/company/update}}
  39. * @return type
  40. */
  41. function edit() {
  42. if ($this->request->isPost()) {
  43. CompanyApi::edit($this->request->param());
  44. return json(["code" => 200, "msg" => "编辑单位成功"]);
  45. }
  46. $id = $this->request->param("id");
  47. $info = CompanyApi::getOne($id);
  48. return view("", ["info" => $info]);
  49. }
  50. /**
  51. * @auth {{/company/delete}}
  52. * @return type
  53. */
  54. function delete() {
  55. $id = $this->request->param("id");
  56. CompanyApi::delete($id);
  57. return json(["code" => 200, "msg" => "删除成功"]);
  58. }
  59. /**
  60. * @auth {{/company/select}}
  61. * @return type
  62. */
  63. function view() {
  64. $id = $this->request->param("id");
  65. $info = CompanyApi::getOne($id);
  66. return view("", ["info" => $info]);
  67. }
  68. }