猿问

文章列表查不出数据返回null

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; 

}


仲天琪
浏览 1055回答 2
2回答

仲天琪

已经解决了,谢谢。yii2

ALEX3403648

什么框架?
随时随地看视频慕课网APP
我要回答