Browse Source

返回朋友圈数据状态

master
wanghongjun 3 months ago
parent
commit
562378fe83
  1. 4
      app/enterprise/controller/Posts.php

4
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());

Loading…
Cancel
Save