gq пре 7 година
родитељ
комит
b5098118b8
1 измењених фајлова са 16 додато и 12 уклоњено
  1. 16 12
      server/app/Http/Controllers/Api/V1/MyController.php

+ 16 - 12
server/app/Http/Controllers/Api/V1/MyController.php

xqd
@@ -329,23 +329,27 @@ class MyController extends Controller
         $data8  =  SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->where('attr_id',8)->orderBy('id','desc')->get()->toArray();
 //        计算interaction_id出现的次数
         $count = array_count_values(array_column($data8,"interaction_id"));
+        $new_data8 = [] ;
         if (!empty($count)) {
             foreach ($count as $interaction_id => $value) {
-                if ($value>=5) {
                     $interaction = InteractionInfo::find($interaction_id);
-                }
-            }
-        }
-        dd($count);
-        $new_data8 = [] ;
-        if (count($data8) > 0) {
-            if (count($data8) >= 5) {
-                $data8[0]['message'] = "梦想互动上已经提起了你".count($data8)."次!你还不去瞧一瞧?你也太大牌啦!";
-                $new_data8[] = $data8[0];
-            }else{
-                $new_data8 = $data8;
+                    $dream_id = empty($interaction) ? '0':$interaction->dream_id;
+                    $message =empty($interaction) ? '': $interaction->title."互动上已经提起了你".($value)."次!你还不去瞧一瞧?你也太大牌啦!";
+                    $new_data8[] = [
+                        'dream_id'=>$dream_id,
+                        'interaction_id'=>$interaction_id,
+                        'message'=>$message,
+                        "attr_id" => 8,
+                        "is_reply" => 0,
+                        "is_max" => 0,
+                        "is_ok" => 0,
+                        "is_end" => 0,
+                        "is_url" => 0,
+                        "type_id" => 2,
+                    ];
             }
         }
+//      dd($new_data8);
         $data9  =  SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->where('attr_id','!=',8)->orderBy('id','desc')->get()->toArray();
         $data = array_merge($new_data8,$data9);
         SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->update(['is_read' => 1]);