| xqd
@@ -42,23 +42,14 @@ class IndexController extends Controller
|
|
|
* "deleted_at": null
|
|
|
* }
|
|
|
* ],
|
|
|
- * "users": [ 动态用户
|
|
|
+ * "users": [ 关注梦想有新的动态显示用户
|
|
|
* {
|
|
|
- * "id": 3,
|
|
|
- * "user_id": 1,
|
|
|
- * "other_user_id": 2, 被关注者
|
|
|
- * "dream_id": 2, 最近动态梦想id 0表示没有动态
|
|
|
- * "dream_number": 1, >0 表示有最新动态
|
|
|
- * "created_at": null,
|
|
|
- * "updated_at": null,
|
|
|
- * "other_user": {
|
|
|
- * "id": 2,
|
|
|
- * "phone": "13880642881",
|
|
|
- * "nickname": "name2",
|
|
|
- * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
|
|
|
- * }
|
|
|
+ * "id": 2,
|
|
|
+ * "phone": "13880642881",
|
|
|
+ * "nickname": "name2",
|
|
|
+ * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
|
|
|
* },
|
|
|
- * ],
|
|
|
+ * ],
|
|
|
* "dreams": {
|
|
|
* "current_page": 1,
|
|
|
* "data": [
|
| xqd
@@ -119,18 +110,15 @@ class IndexController extends Controller
|
|
|
$id_arr1 = array_column($arr1,'id');
|
|
|
$arr2 =DreamInfoModel::orderBy('score','desc')->offset(15)->limit(120)->select('id')->get()->toArray();
|
|
|
$id_arr2 = array_column($arr2,'id');
|
|
|
- $users =UserCareUser::where('user_id',$id)->with('other_user')->orderBy('dream_number','desc')->get()->toArray();
|
|
|
- /* $hdusers = CommentInfoModel::where(function ($query) use ($id) {
|
|
|
-// $query->where('user_id',$id)->orWhere('to_user_id',$id);
|
|
|
- $query->where('user_id',$id);
|
|
|
- })->where('is_read',0)->with('to_user')->orderBy('created_at')->get()->toArray();*/
|
|
|
- /*$users = [] ;
|
|
|
- foreach ($dtusers as $k => $v){
|
|
|
- $users[] = $v['other_user'];
|
|
|
- }*/
|
|
|
- /* foreach ($hdusers as $k => $v){
|
|
|
- $users[] = $v['to_user'];
|
|
|
- }*/
|
|
|
+ $users_care_dream = UserCareDream::where('user_id',$id)->where('interaction_number','>',0)->get()->toArray();
|
|
|
+ $user_ids = array_unique(array_column($users_care_dream,'dream_user_id'));
|
|
|
+ $users = [] ;
|
|
|
+ if (!empty($user_ids)) {
|
|
|
+ foreach ($user_ids as $user_id) {
|
|
|
+ $user = UserInfoModel::find($user_id);
|
|
|
+ $users[] = $user;
|
|
|
+ }
|
|
|
+ }
|
|
|
$type = $request->type;
|
|
|
if ($type == 'trend') {
|
|
|
$banners = $this->getBanner();
|