songxingwei 2 years ago
parent
commit
a7913c122c
1 changed files with 86 additions and 0 deletions
  1. 86 0
      app/admin/controller/TeachingKnowledge.php

+ 86 - 0
app/admin/controller/TeachingKnowledge.php

@@ -0,0 +1,86 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: https://thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// | 免费声明 ( https://thinkadmin.top/disclaimer )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\admin\controller;
+
+use app\data\model\DataPoolTalent;
+use app\data\model\DataTeachingKnowledge;
+use app\data\model\DataZhicheng;
+use Carbon\Carbon;
+use think\admin\Controller;
+use think\admin\model\SystemUser;
+use think\db\Query;
+
+/**
+ * 知识教学管理
+ * Class PoolTalent
+ * @package app\admin\controller
+ */
+class TeachingKnowledge extends Controller
+{
+    /**
+     * 知识教学申请管理
+     * @auth true
+     * @menu true
+     */
+    public function index(){
+        $this->title='知识教学列表';
+        $name=input('name');
+        DataTeachingKnowledge::mQuery()
+            ->when($name,function (Query $query) use ($name) {
+                $query->hasWhere('user',function (Query $query) use ($name) {
+                    $query->whereLike('nickname',"%{$name}%");
+                });
+            })
+            ->with(['user'])
+            ->where('type',2)
+            ->where('is_del',1)
+            ->order('id','desc')
+            ->layTable();
+    }
+    protected function _index_page_filter(&$data)
+    {
+    }
+    /**
+     * 知识教学审核
+     * @auth true
+     * @menu true
+     */
+    public function audit($id){
+        $this->title='知识教学审核';
+        $row=DataTeachingKnowledge::mk()->findOrFail($id);
+        if($this->request->isGet()){
+            $this->assign('row',$row);
+            $this->fetch();
+        }else{
+            if($row['audit']>1){
+                $this->error('该记录已审核');
+            }
+            $data=$this->_vali([
+                'audit.require'=>'结果必须',
+                'audit.in:2,3'=>'结果有误',
+                'why.requireIf:audit,3'=>'原因必须',
+                'why.max:200'=>'原因有误',
+            ]);
+            $row['audit']=$data['audit'];
+            $row['why']=$data['why']??'';
+            $row['audit_at']=Carbon::now();
+            $row->save();
+            $this->success('审核成功');
+        }
+    }
+
+}