Company.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. function selectAll() {
  27. $result = CompanyApi::getAll();
  28. return json($result);
  29. }
  30. /**
  31. * @auth {{/company/add}}
  32. * @return type
  33. */
  34. function add() {
  35. if ($this->request->isPost()) {
  36. CompanyApi::edit($this->request->param());
  37. return json(["code" => 200, "msg" => "添加单位成功"]);
  38. }
  39. return view();
  40. }
  41. /**
  42. * @auth {{/company/update}}
  43. * @return type
  44. */
  45. function edit() {
  46. if ($this->request->isPost()) {
  47. CompanyApi::edit($this->request->param());
  48. return json(["code" => 200, "msg" => "编辑单位成功"]);
  49. }
  50. $id = $this->request->param("id");
  51. $info = CompanyApi::getOne($id);
  52. return view("", ["info" => $info]);
  53. }
  54. /**
  55. * @auth {{/company/delete}}
  56. * @return type
  57. */
  58. function delete() {
  59. $id = $this->request->param("id");
  60. CompanyApi::delete($id);
  61. return json(["code" => 200, "msg" => "删除成功"]);
  62. }
  63. /**
  64. * @auth {{/company/select}}
  65. * @return type
  66. */
  67. function view() {
  68. $id = $this->request->param("id");
  69. $info = CompanyApi::getOne($id);
  70. return view("", ["info" => $info]);
  71. }
  72. function detail() {
  73. $id = $this->request->param("id");
  74. $info = CompanyApi::getOne($id);
  75. return json($info);
  76. }
  77. }