Browse Source

添加朋友圈 数据处理验证5

author
wanghongjun 8 months ago
parent
commit
6f177b8037
  1. 10
      app/enterprise/controller/Posts.php

10
app/enterprise/controller/Posts.php

@ -28,7 +28,7 @@ class Posts extends BaseController
public function index()
{
$where = '(p.delete_time = 0 and p.privacy > 0) and ';
$whereOr = $where . ' ( p.user_id = ' . $this->uid;
$whereOr = $where . ' ( (p.user_id = ' . $this->uid;
$friendIds = Friend::getFriendIds($this->uid);
@ -42,13 +42,15 @@ class Posts extends BaseController
// 可见
$whereOr .= " or ( p.privacy = 2 and exists (
select 1 from {$prefix}posts_privacy_users pvu
where pvu.posts_id = p.id and pvu.user_id = p.user_id and pvu.type = 1
where pvu.posts_id = p.id and pvu.user_id = p.user_id
and pvu.type = 1 and pvu.user_id = {$this->uid}
))";
// 不可见
$whereOr .= " or ( p.privacy = 4 and exists (
$whereOr .= " or ( p.privacy = 4 and not exists (
select 1 from {$prefix}posts_privacy_users peu
where peu.posts_id = p.id and peu.user_id = p.user_id and peu.type = 2
where peu.posts_id = p.id and peu.user_id = p.user_id
and peu.type = 2 and peu.user_id = {$this->uid}
)))";
$field = 'p.id,p.content,p.location,p.address as location_address,p.type,p.user_id,p.create_time';

Loading…
Cancel
Save