diff --git a/app/enterprise/controller/Posts.php b/app/enterprise/controller/Posts.php index 0041787..1764336 100644 --- a/app/enterprise/controller/Posts.php +++ b/app/enterprise/controller/Posts.php @@ -43,12 +43,13 @@ class Posts extends BaseController } $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'; $model = new PostsModel(); $list = $this->paginate($model->alias('p')->where($where)->field($field)->order($order)); $data = []; + $privacyDescribe = ['', '公开', '部分可见', '私密', '不给谁看']; if ($list) { $data = $list->toArray()['data']; foreach ($data as &$item) { @@ -65,6 +66,7 @@ class Posts extends BaseController $item['is_like'] = $likesData['is_like']; $item['comment'] = Comment::getPostsComment($item['id'], $this->uid, $userIdArr); + $item['privacy_describe'] = $privacyDescribe[$item['privacy']]; } } return success('', $data,$list->total(),$list->currentPage());