Job.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace app\admin\controller\enterprise;
  3. use app\admin\controller\AuthController;
  4. use app\logic\JobLogic;
  5. use crmeb\traits\CurdControllerTrait;
  6. use app\admin\model\enterprise\EnterPriseUser as UserModel;
  7. use crmeb\services\{JsonService as Json, UtilService, JsonService, UtilService as Util};
  8. use think\facade\App;
  9. use think\facade\Db;
  10. /**
  11. * 会员设置
  12. * Class UserLevel
  13. * @package app\admin\controller\user
  14. */
  15. class Job extends AuthController
  16. {
  17. use CurdControllerTrait;
  18. /*
  19. * 职务列表
  20. * */
  21. public function index()
  22. {
  23. return $this->fetch();
  24. }
  25. /*
  26. * 获取列表
  27. * @param int page
  28. * @param int limit
  29. * */
  30. public function get_job_list()
  31. {
  32. $where = UtilService::getMore([
  33. ['page', 1],
  34. ['limit', 20],
  35. ['is_show', -1]
  36. ]);
  37. return app('JobLogic')->getPageList($where);
  38. }
  39. public static function isShow($id)
  40. {
  41. return app('JobLogic')->toggleIsShow($id);
  42. }
  43. public function create()
  44. {
  45. return $this->fetch();
  46. }
  47. public function add_job()
  48. {
  49. $data = Util::postMore([
  50. 'job_name',
  51. 'is_show',
  52. 'rank'
  53. ]);
  54. return app('JobLogic')->add($data);
  55. }
  56. public function isDel($id)
  57. {
  58. return app('JobLogic')->delById($id);
  59. }
  60. public function edit($id)
  61. {
  62. $this->assign('model', app('JobLogic')::get($id));
  63. return $this->fetch();
  64. }
  65. public function edit_job()
  66. {
  67. $data = Util::postMore([
  68. 'id',
  69. 'job_name',
  70. 'is_show',
  71. 'rank',
  72. ]);
  73. if (empty($data['id'])) {
  74. return JsonService::fail('id不能为空');
  75. }
  76. return app('JobLogic')->edit($data);
  77. }
  78. }