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}%"); }); }) ->like('title') ->with(['user']) ->where('type',1) ->where('is_del',1) ->order('id','desc') ->layTable(); } protected function _index_page_filter(&$data) { } /** * 知识教学添加 * @auth true * @menu true */ public function add(){ DataTeachingKnowledge::mForm('form'); } /** * 知识教学编辑 * @auth true * @menu true */ public function edit(){ DataTeachingKnowledge::mForm('form'); } public function _form_filter($vo){ if ($this->request->isGet()) { if (isset($vo['id'])){ if (isset($vo['imgs'])){ $vo['imgs']= implode('|',explode(',',implode(',',$vo['imgs']))); } $this->assign('vo',$vo); $this->fetch('form'); } }elseif ($this->request->isPost()){ $vo['imgs'] = implode(',',explode('|',$vo['imgs'])); $vo['audit'] =2; } } /** * 删除 * @auth true * @menu true */ public function del($id){ DataTeachingKnowledge::whereIn('id',$id)->save([ 'is_del'=>0, ]); $this->success('删除成功'); } }