alias("m") ->select([ "m.*" ]); if (!empty($where)) { $modelFind->where($where); } if ($offset) { $modelFind->offset($offset); } if ($limit) { $modelFind->limit($limit); } $modelFind->orderBy("m.id desc"); $modelFind->asArray(); $dataList = $modelFind->all(); return $dataList; } /** * 列表页面分页器数量 * @param string $map */ static function getPageCount($map = '') { $modelFind = ModelModel::find()->alias("m"); if (!empty($map)) { $modelFind->where($map); } $pageCount = $modelFind->count(); return $pageCount; } /** * @param $id * @param bool|false $asArr * @return null|static */ static function selectOne($id, $asArr = false) { $model = ModelModel::findOne($id); if ($asArr && $model) { $model = $model->toArray(); } return $model; } /** * @param $id * @param bool|false $asArr * @return null|static */ static function findOne($condition) { $model = ModelModel::findOne($condition); return $model; } }