request->param('dict_name', ''); $_op = $this->whereLike('dict_name', "{$dict_name}%"); $dict_value = $this->request->param('dict_value', ''); $_op = $this->whereLike('dict_value', "{dict_value}%"); //自定义处理逻辑 $dict_type_id = $this->request->param('dict_type_id', ''); $_op = $this->where('dict_type_id', $dict_type_id); //通用逻辑 return parent::parentLists($_op); } public function chekName($name) { //自定义处理逻辑 $dict_type_id = $this->request->param('dict_type_id', ''); $id = $this->request->param('id', ''); $codition = [ 'dict_value' => $name, 'dict_type_id' => $dict_type_id, ]; if($id >0){ $count = $this->where($codition)->where('id','<>',$id)->count(); }else{ $count = $this->where($codition)->count(); } return $count; } /** * 读取后 * @param Model $model * @return bool|void */ public static function onAfterRead(Model $model) { //读取数据前格式化数据 if (in_array(request()->action(), ['edit', 'delete', 'status'])) { return true; } //业务逻辑 } /** * 新增或修改前 * @param Model $model * @return mixed|void */ public static function onBeforeWrite(Model $model) { parent::onBeforeWrite($model); //写入数据前格式化数据 if (!in_array(request()->action(), ['add', 'edit'])) { return true; } //业务逻辑 // code... } public static function onAfterDelete(Model $model) { parent::onAfterDelete($model); // TODO: Change the autogenerated stub $dic = new DictionaryType(); $dic->exportDictToConfig(); } public static function onAfterWrite(Model $model) { parent::onAfterWrite($model); // TODO: Change the autogenerated stub $dic = new DictionaryType(); $dic->exportDictToConfig(); } }