PoolTalent.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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\model\DataPoolTalent;
  17. use app\data\model\DataUser;
  18. use app\data\model\DataZhicheng;
  19. use Carbon\Carbon;
  20. use think\admin\Controller;
  21. use app\data\model\SystemUser;
  22. use think\db\Query;
  23. /**
  24. * 人才库管理
  25. * Class PoolTalent
  26. * @package app\admin\controller
  27. */
  28. class PoolTalent extends Controller
  29. {
  30. /**
  31. * 职称管理
  32. * @auth true
  33. * @menu true
  34. */
  35. public function zc(){
  36. $this->title='职称管理';
  37. DataZhicheng::mQuery()
  38. ->show()
  39. ->like('name')
  40. ->order('id','desc')
  41. ->layTable();
  42. }
  43. /**
  44. * 职称编辑
  45. * @auth true
  46. * @menu true
  47. */
  48. public function zc_edit(){
  49. DataZhicheng::mForm('zc_form');
  50. }
  51. /**
  52. * 职称添加
  53. * @auth true
  54. * @menu true
  55. */
  56. public function zc_add(){
  57. DataZhicheng::mForm('zc_form');
  58. }
  59. /**
  60. * 职称删除
  61. * @auth true
  62. * @menu true
  63. */
  64. public function zc_del($id){
  65. DataZhicheng::whereIn('id',$id)->save([
  66. 'is_del'=>0,
  67. ]);
  68. $this->success('删除成功');
  69. }
  70. /**
  71. * 人才申请管理
  72. * @auth true
  73. * @menu true
  74. */
  75. public function index(){
  76. $this->assign('audit',DataPoolTalent::$audit);
  77. $this->title='人才申请管理';
  78. $name=input('name');
  79. DataPoolTalent::mQuery()
  80. ->equal('audit')
  81. ->when($name,function (Query $query) use ($name) {
  82. $query->hasWhere('user',function (Query $query) use ($name) {
  83. $query->whereLike('nickname',"%{$name}%");
  84. });
  85. })
  86. ->with(['user'])
  87. ->order('id','desc')
  88. ->layTable();
  89. }
  90. /**
  91. * 人才申请审核
  92. * @auth true
  93. * @menu true
  94. */
  95. public function audit($id){
  96. $this->title='人才申请审核';
  97. $row=DataPoolTalent::mk()
  98. ->with(['gzll','zc','user'])
  99. ->findOrFail($id);
  100. if($this->request->isGet()){
  101. //dump($row);
  102. $this->assign('row',$row);
  103. $this->fetch();
  104. }else{
  105. if($row['audit']>1){
  106. $this->error('该记录已审核');
  107. }
  108. $data=$this->_vali([
  109. 'audit.require'=>'结果必须',
  110. 'audit.in:2,3'=>'结果有误',
  111. 'why.requireIf:audit,3'=>'原因必须',
  112. 'why.max:200'=>'原因有误',
  113. ]);
  114. $row['audit']=$data['audit'];
  115. $row['why']=$data['why']??'';
  116. $row['audit_at']=Carbon::now();
  117. $row->save();
  118. if ($data['audit']==2){
  119. DataUser::mk()->where('id',$row['uuid'])->update(['is_pooltalent'=>1]);
  120. //极光推送
  121. $content = '您申请加入人才库信息已通过申请,请及时查看';
  122. }elseif ($data['audit']==3){
  123. //极光推送
  124. $content = '您申请加入人才库信息未通过申请,请及时查看';
  125. }
  126. $alias = DataUser::mk()->where('id',$row['uuid'])->value('jgalias');
  127. $alias ? jgpush($content,$alias) : '';
  128. setusermessage($row['uuid'],'审核通知',$content);
  129. $this->success('审核成功');
  130. }
  131. }
  132. /**
  133. * 人才库配置
  134. * @auth true
  135. * @menu true
  136. */
  137. public function config(){
  138. if($this->request->isGet()){
  139. $this->fetch();
  140. }else{
  141. $data=$this->_vali([
  142. 'tel.require'=>'联系方式必须',
  143. ]);
  144. sysconf('config_pool_talent',$data);
  145. $this->success('保存成功');
  146. }
  147. }
  148. }