|
|
@@ -31,14 +31,16 @@ class ForumComment extends BaseModel
|
|
|
// 默认只查询已审核的评论
|
|
|
$where[] = ['c.status', '=', 1];
|
|
|
|
|
|
- $total = $this->where($where)->count();
|
|
|
+ $query = $this->alias('c')
|
|
|
+ ->field('c.*, u.nickname as author_name, u.avatar as author_avatar')
|
|
|
+ ->leftJoin('user u', 'u.uid = c.uid')
|
|
|
+ ->where($where);
|
|
|
+
|
|
|
+ $total = $query->count();
|
|
|
$list = [];
|
|
|
|
|
|
if ($total > 0) {
|
|
|
- $list = $this->alias('c')
|
|
|
- ->field('c.*, u.nickname as author_name, u.avatar as author_avatar')
|
|
|
- ->leftJoin('user u', 'u.uid = c.uid')
|
|
|
- ->where($where)
|
|
|
+ $list = $query
|
|
|
->order('c.create_time', 'asc')
|
|
|
->page($page, $pageSize)
|
|
|
->select();
|