|
@@ -108,6 +108,7 @@ class SocialService extends BaseService
|
|
|
$where = ['a.mark' => 1];
|
|
$where = ['a.mark' => 1];
|
|
|
$status = isset($params['status'])? $params['status'] : 0;
|
|
$status = isset($params['status'])? $params['status'] : 0;
|
|
|
$type = isset($params['type'])? $params['type'] : 0;
|
|
$type = isset($params['type'])? $params['type'] : 0;
|
|
|
|
|
+ $userId = isset($params['user_id'])? $params['user_id'] : 0;
|
|
|
|
|
|
|
|
if($status>0){
|
|
if($status>0){
|
|
|
$where['a.status'] = $status;
|
|
$where['a.status'] = $status;
|
|
@@ -118,8 +119,9 @@ class SocialService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- return $this->model->with(['user'])->from('posts as a')
|
|
|
|
|
|
|
+ return $this->model->with(['user','isLike'=>function($query) use($userId){
|
|
|
|
|
+ $query->where('user_id', $userId);
|
|
|
|
|
+ }])->from('posts as a')
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->where(function ($query) use($params){
|
|
->where(function ($query) use($params){
|
|
|
$keyword = isset($params['keyword'])? $params['keyword'] : '';
|
|
$keyword = isset($params['keyword'])? $params['keyword'] : '';
|
|
@@ -132,7 +134,6 @@ class SocialService extends BaseService
|
|
|
if($tag){
|
|
if($tag){
|
|
|
$query->where('a.tags','like',"%{$tag},%");
|
|
$query->where('a.tags','like',"%{$tag},%");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|