JobsController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\dept;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\dept\JobsLists;
  17. use app\adminapi\logic\dept\JobsLogic;
  18. use app\adminapi\validate\dept\JobsValidate;
  19. /**
  20. * 岗位管理控制器
  21. * Class JobsController
  22. * @package app\adminapi\controller\dept
  23. */
  24. class JobsController extends BaseAdminController
  25. {
  26. /**
  27. * @notes 岗位列表
  28. * @return \think\response\Json
  29. * @author 段誉
  30. * @date 2022/5/26 10:00
  31. */
  32. public function lists()
  33. {
  34. return $this->dataLists(new JobsLists());
  35. }
  36. /**
  37. * @notes 添加岗位
  38. * @return \think\response\Json
  39. * @author 段誉
  40. * @date 2022/5/25 18:40
  41. */
  42. public function add()
  43. {
  44. $params = (new JobsValidate())->post()->goCheck('add');
  45. JobsLogic::add($params);
  46. return $this->success('添加成功', [], 1, 1);
  47. }
  48. /**
  49. * @notes 编辑岗位
  50. * @return \think\response\Json
  51. * @author 段誉
  52. * @date 2022/5/25 18:41
  53. */
  54. public function edit()
  55. {
  56. $params = (new JobsValidate())->post()->goCheck('edit');
  57. $result = JobsLogic::edit($params);
  58. if (true === $result) {
  59. return $this->success('编辑成功', [], 1, 1);
  60. }
  61. return $this->fail(JobsLogic::getError());
  62. }
  63. /**
  64. * @notes 删除岗位
  65. * @return \think\response\Json
  66. * @author 段誉
  67. * @date 2022/5/25 18:41
  68. */
  69. public function delete()
  70. {
  71. $params = (new JobsValidate())->post()->goCheck('delete');
  72. JobsLogic::delete($params);
  73. return $this->success('删除成功', [], 1, 1);
  74. }
  75. /**
  76. * @notes 获取岗位详情
  77. * @return \think\response\Json
  78. * @author 段誉
  79. * @date 2022/5/25 18:41
  80. */
  81. public function detail()
  82. {
  83. $params = (new JobsValidate())->goCheck('detail');
  84. $result = JobsLogic::detail($params);
  85. return $this->data($result);
  86. }
  87. /**
  88. * @notes 获取岗位数据
  89. * @return \think\response\Json
  90. * @throws \think\db\exception\DataNotFoundException
  91. * @throws \think\db\exception\DbException
  92. * @throws \think\db\exception\ModelNotFoundException
  93. * @author 段誉
  94. * @date 2022/10/13 10:31
  95. */
  96. public function all()
  97. {
  98. $result = JobsLogic::getAllData();
  99. return $this->data($result);
  100. }
  101. }