| xqd
@@ -233,7 +233,7 @@ class MyController extends Controller
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @api {get} /api/my/dreamInfo 梦想消息
|
|
|
+ * @api {get} /api/my/dream_info 梦想消息
|
|
|
* @apiDescription 梦想消息
|
|
|
* @apiGroup My
|
|
|
* @apiPermission Passport
|
| xqd
@@ -254,16 +254,52 @@ class MyController extends Controller
|
|
|
*/
|
|
|
public function dreamInfo()
|
|
|
{
|
|
|
-// 梦想消息分为 支持 收藏 互动 提现 梦想暂停 结束
|
|
|
+// 梦想消息分为 1支持 2收藏 3互动 4提现 5梦想暂停 6结束
|
|
|
$user = $this->getUser();
|
|
|
- $data = SystemInfoModel::where('user_id',$user->id)->where('type_id',1)->orderBy('id','desc')->get();
|
|
|
- foreach ($data as $item){ //访问接口 标记已读
|
|
|
- $item->update(['is_read'=>0]);
|
|
|
- $info = InteractionInfo::find($item->interaction_id);
|
|
|
- $dream_id =empty($info) ? 0 : $info->dream_id;
|
|
|
- $item->dreamid = $dream_id;
|
|
|
+ $data1 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',1)->orderBy('id','desc')->get()->toArray();
|
|
|
+ $new_data1 = [] ;
|
|
|
+ if (count($data1) > 0) {
|
|
|
+ if (count($data1) >= 5) {
|
|
|
+ $data1[0]['message'] = "已经有".count($data1)."个人支持了你的梦想!";
|
|
|
+ $new_data1[] = $data1[0];
|
|
|
+ }else{
|
|
|
+ $new_data1 = $data1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data2 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',2)->orderBy('id','desc')->get()->toArray();
|
|
|
+ $new_data2 = [] ;
|
|
|
+ if (count($data2) > 0) {
|
|
|
+ if (count($data2) >= 5) {
|
|
|
+ $data2[0]['message'] = "已经有".count($data2)."个人收藏了你的梦想!";
|
|
|
+ $new_data2[] = $data2[0];
|
|
|
+ }else{
|
|
|
+ $new_data2 = $data2;
|
|
|
+ }
|
|
|
}
|
|
|
+ $data3 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',3)->orderBy('id','desc')->get()->toArray();
|
|
|
+ $new_data3 = [] ;
|
|
|
+ if (count($data3) > 0) {
|
|
|
+ if (count($data3) >= 5) {
|
|
|
+ $data3[0]['message'] = "你的互动已经有".count($data3)."个留言啦!快点击看看!";
|
|
|
+ $new_data3[] = $data3[0];
|
|
|
+ }else{
|
|
|
+ $new_data3 = $data3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data456 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->where('attr_id',4)->orWhere('attr_id',5)->orWhere('attr_id',6);
|
|
|
+ })->orderBy('id','desc')->get()->toArray();
|
|
|
+
|
|
|
+ $data = array_merge($new_data1,$new_data2,$new_data3,$data456);
|
|
|
+ SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->update(['is_read' => 1]);
|
|
|
return $this->api($data);
|
|
|
+// foreach ($data as $item){ //访问接口 标记已读
|
|
|
+// $item->update(['is_read'=>0]);
|
|
|
+// $info = InteractionInfo::find($item->interaction_id);
|
|
|
+// $dream_id =empty($info) ? 0 : $info->dream_id;
|
|
|
+// $item->dreamid = $dream_id;
|
|
|
+// }
|
|
|
}
|
|
|
/**
|
|
|
* @api {get} /api/my/sup_info 支持消息
|
| xqd
@@ -1208,6 +1244,7 @@ class MyController extends Controller
|
|
|
'dream_id'=>$dream_id,
|
|
|
'type_id'=>2,
|
|
|
'is_url'=>1,
|
|
|
+ 'attr_id'=>9,
|
|
|
];
|
|
|
|
|
|
$ok =SystemInfoModel::create($arr);
|