1], [['limit'], 'default', 'value' => 20], ]; } /** * 型号列表 */ public function search() { if (!$this->validate()) { return $this->getModelError(); } $query = BallMark::find() ->select('id,name,desc') ->where([ 'is_delete' => 0 ]) ->andFilterWhere([ 'OR', ['like', 'name', $this->keywords], ])->andFilterWhere([ 'status' => $this->status ]); $count = $query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit]); $list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['created_at' => SORT_DESC])->asArray()->all(); $data = []; $data['code'] = 0; $data['msg'] = 'ok'; $data['data'] = $list; $data['count'] = $count; return $data; } }