TeachingKnowledgeAuth.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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\DataTeachingKnowledge;
  18. use app\data\model\DataZhicheng;
  19. use Carbon\Carbon;
  20. use think\admin\Controller;
  21. use think\admin\model\SystemUser;
  22. use think\db\Query;
  23. /**
  24. * 知识教学管理
  25. * Class PoolTalent
  26. * @package app\admin\controller
  27. */
  28. class TeachingKnowledgeAuth extends Controller
  29. {
  30. /**
  31. * 知识教学申请管理
  32. * @auth true
  33. * @menu true
  34. */
  35. public function index(){
  36. $this->title='知识教学申请列表';
  37. $name=input('name');
  38. DataTeachingKnowledge::mQuery()
  39. ->when($name,function (Query $query) use ($name) {
  40. $query->hasWhere('user',function (Query $query) use ($name) {
  41. $query->whereLike('nickname',"%{$name}%");
  42. });
  43. })
  44. ->with(['user'])
  45. ->where('type',2)
  46. ->where('is_del',1)
  47. ->order('id','desc')
  48. ->layTable();
  49. }
  50. protected function _index_page_filter(&$data)
  51. {
  52. }
  53. /**
  54. * 知识教学审核
  55. * @auth true
  56. * @menu true
  57. */
  58. public function audit($id){
  59. $this->title='知识教学审核';
  60. $row=DataTeachingKnowledge::mk()->findOrFail($id);
  61. if($this->request->isGet()){
  62. $this->assign('row',$row);
  63. $this->fetch();
  64. }else{
  65. if($row['audit']>1){
  66. $this->error('该记录已审核');
  67. }
  68. $data=$this->_vali([
  69. 'audit.require'=>'结果必须',
  70. 'audit.in:2,3'=>'结果有误',
  71. 'why.requireIf:audit,3'=>'原因必须',
  72. 'why.max:200'=>'原因有误',
  73. ]);
  74. $row['audit']=$data['audit'];
  75. $row['why']=$data['why']??'';
  76. $row['audit_at']=Carbon::now();
  77. $row->save();
  78. $this->success('审核成功');
  79. }
  80. }
  81. /**
  82. * 删除
  83. * @auth true
  84. * @menu true
  85. */
  86. public function del($id){
  87. DataTeachingKnowledge::whereIn('id',$id)->save([
  88. 'is_del'=>0,
  89. ]);
  90. $this->success('删除成功');
  91. }
  92. }