public static function getList($cond, $curPage = 1, $pageSize = 5, $orderBy = ['id'=>SORT_DESC]){
$model = new PostModel();
// 查询语句
$select = ['id','title','summary','label_img','cat_id','user_id','user_name','is_valid','created_at','updated_at'];
$query = $model->find()
->select($select)
->where($cond)
->with('relate.tag','extend')
->orderBy($orderBy);
// 获取分页数据
$res = $model->getPages($query, $curPage, $pageSize);
var_dump($res);die;
// 格式化数据
$res['data'] = self::_formatList($res['data']);
return $res;
}
仲天琪
ALEX3403648