|
|
@ -43,12 +43,13 @@ class Posts extends BaseController |
|
|
} |
|
|
} |
|
|
$where .= ')'; |
|
|
$where .= ')'; |
|
|
|
|
|
|
|
|
$field = 'p.id,p.content,p.location,p.address as location_address,p.type,p.user_id,p.create_time'; |
|
|
$field = 'p.id,p.content,p.location,p.address as location_address,p.type,p.user_id,p.create_time,p.privacy'; |
|
|
$order = 'p.create_time desc'; |
|
|
$order = 'p.create_time desc'; |
|
|
$model = new PostsModel(); |
|
|
$model = new PostsModel(); |
|
|
$list = $this->paginate($model->alias('p')->where($where)->field($field)->order($order)); |
|
|
$list = $this->paginate($model->alias('p')->where($where)->field($field)->order($order)); |
|
|
|
|
|
|
|
|
$data = []; |
|
|
$data = []; |
|
|
|
|
|
$privacyDescribe = ['', '公开', '部分可见', '私密', '不给谁看']; |
|
|
if ($list) { |
|
|
if ($list) { |
|
|
$data = $list->toArray()['data']; |
|
|
$data = $list->toArray()['data']; |
|
|
foreach ($data as &$item) { |
|
|
foreach ($data as &$item) { |
|
|
@ -65,6 +66,7 @@ class Posts extends BaseController |
|
|
$item['is_like'] = $likesData['is_like']; |
|
|
$item['is_like'] = $likesData['is_like']; |
|
|
|
|
|
|
|
|
$item['comment'] = Comment::getPostsComment($item['id'], $this->uid, $userIdArr); |
|
|
$item['comment'] = Comment::getPostsComment($item['id'], $this->uid, $userIdArr); |
|
|
|
|
|
$item['privacy_describe'] = $privacyDescribe[$item['privacy']]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return success('', $data,$list->total(),$list->currentPage()); |
|
|
return success('', $data,$list->total(),$list->currentPage()); |
|
|
|