Recruitment.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免费声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  13. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  14. // +----------------------------------------------------------------------
  15. namespace app\admin\controller;
  16. use app\data\controller\user\Admin;
  17. use app\data\model\DataRecruitment;
  18. use app\data\model\DataPoolTalent;
  19. use app\data\model\DataTeachingKnowledge;
  20. use app\data\model\DataUser;
  21. use app\data\model\DataZhicheng;
  22. use Carbon\Carbon;
  23. use think\admin\Controller;
  24. use app\data\model\SystemUser;
  25. use think\admin\service\AdminService;
  26. use think\Db;
  27. use think\db\Query;
  28. /**
  29. * 招聘信息列表
  30. * Class Recruitment
  31. * @package app\admin\controller
  32. */
  33. class Recruitment extends Controller
  34. {
  35. /**
  36. * 招聘信息管理
  37. * @auth true
  38. * @menu true
  39. */
  40. public function index(){
  41. if(AdminService::getUserId()==10000){
  42. $admin_id = [];
  43. }
  44. else{
  45. $admin_id['uid']=AdminService::getUserId();
  46. }
  47. $this->title='招聘信息列表';
  48. $name=input('title');
  49. DataRecruitment::mQuery()
  50. ->when($name,function (Query $query) use ($name) {
  51. $query->hasWhere('shipyard',function (Query $query) use ($name) {
  52. $query->whereLike('name',"%{$name}%");
  53. });
  54. })
  55. ->where($admin_id)
  56. ->where('is_del',1)
  57. ->with(['datauser','shipyard'])
  58. ->order('id','desc')
  59. ->layTable();
  60. }
  61. protected function _index_page_filter(&$data)
  62. {
  63. // dump($data);die;
  64. }
  65. /**
  66. * 招聘信息添加
  67. * @auth true
  68. * @menu true
  69. */
  70. public function add(){
  71. DataRecruitment::mForm('form');
  72. }
  73. /**
  74. * 招聘信息编辑
  75. * @auth true
  76. * @menu true
  77. */
  78. public function edit(){
  79. DataRecruitment::mForm('form');
  80. }
  81. /**
  82. * 表单结果处理
  83. * @param boolean $result
  84. * @throws \think\db\exception\DataNotFoundException
  85. * @throws \think\db\exception\DbException
  86. * @throws \think\db\exception\ModelNotFoundException
  87. */
  88. protected function _form_result(bool $result)
  89. {
  90. if ($result && $this->request->isPost()) {
  91. // GoodsService::stock(input('code'));
  92. $this->success('恭喜,数据保存成功!', 'javascript:history.back()');
  93. }
  94. }
  95. public function _form_filter($vo){
  96. if ($this->request->isGet()) {
  97. }elseif ($this->request->isPost()){
  98. }
  99. }
  100. /**
  101. * 招聘信息查看
  102. * @auth true
  103. * @menu true
  104. */
  105. public function audit($id){
  106. $this->title='招聘信息查看';
  107. $row=DataRecruitment::mk()
  108. ->with(['datauser','shipyard'])
  109. ->findOrFail($id);
  110. if($this->request->isGet()){
  111. $this->assign('row',$row);
  112. $this->fetch();
  113. }else{
  114. if($row['audit']>1){
  115. $this->error('该记录已审核');
  116. }
  117. $data=$this->_vali([
  118. 'audit.require'=>'结果必须',
  119. 'audit.in:2,3'=>'结果有误',
  120. 'why.requireIf:audit,3'=>'原因必须',
  121. 'why.max:200'=>'原因有误',
  122. ]);
  123. $row['audit']=$data['audit'];
  124. $row['why']=$data['why']??'';
  125. $row['audit_at']=Carbon::now();
  126. $row->save();
  127. if ($data['audit']==2){
  128. DataUser::mk()->where('id',$row['uuid'])->update(['is_maintenance'=>1]);
  129. }
  130. $this->success('审核成功');
  131. }
  132. }
  133. }