request->param('name', ''); $_op = $this->where('site_id', SITE_ID); //没有默认where查询 这个一定要 否则获取不到下面的getOptions查询条件值 if ($name) { $_op->whereLike('name', "%{$name}%"); } $_op->order('sort DESC,create_time DESC'); return parent::parentLists($_op); } /** * 读取后 * @param Model $model * @return bool|void */ public static function onAfterRead(Model $model) { } /** * 新增前 * @param Model $model * @return mixed|void */ public static function onBeforeInsert(Model $model) { //code } /** * 新增或修改前 * @param Model $model * @return mixed|void */ public static function onBeforeWrite(Model $model) { } }