Dict.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\DictApi;
  5. /**
  6. * Description of Dict
  7. *
  8. * @author sgq
  9. */
  10. class Dict extends AdminController {
  11. /**
  12. * @auth {{/dict}}
  13. * @return type
  14. */
  15. public function index() {
  16. return view();
  17. }
  18. /**
  19. * @auth {{/dict/list}}
  20. * @return type
  21. */
  22. public function list() {
  23. $res = DictApi::getList($this->request);
  24. return json($res);
  25. }
  26. /**
  27. * @auth {{/dict/add}}
  28. * @return type
  29. */
  30. public function add() {
  31. if ($this->request->isPost()) {
  32. return json(DictApi::create($this->request->param()));
  33. }
  34. return view();
  35. }
  36. /**
  37. * @auth {{/dict/update}}
  38. * @return type
  39. */
  40. public function edit() {
  41. if ($this->request->isPost()) {
  42. return json(DictApi::update($this->request->param()));
  43. }
  44. $dict = DictApi::getOne($this->request->param("id"));
  45. return view("", ["dict" => $dict]);
  46. }
  47. /**
  48. * @auth {{/dict/delete}}
  49. * @return type
  50. */
  51. public function delete() {
  52. if ($this->request->isPost()) {
  53. return json(DictApi::delete($this->request->param("dictId")));
  54. }
  55. }
  56. public function findChildDictByCode(){
  57. return json(DictApi::findChildDictByCode($this->request->param("code")));
  58. }
  59. }