Browse Source

bug修复

121708259@qq.com 3 years ago
parent
commit
6f17ef670b
2 changed files with 14 additions and 1 deletions
  1. 1 0
      app/Enums/ApiEnum.php
  2. 13 1
      app/Services/HomeService.php

+ 1 - 0
app/Enums/ApiEnum.php

xqd
@@ -15,5 +15,6 @@ final class ApiEnum extends Enum
     const PHOTO_DESTROY_URL =  "photo_destroy_url_";  //阅后即焚_销毁记录
     const DYNAMIC_RELEASE =  "dynamic_release_";  //发布动态
     const DYNAMIC_ZAN =  "dynamic_zan_";  //动态点赞
+    const GET_WEIXIN =  "get_weixin_";  //解锁微信
 
 }

+ 13 - 1
app/Services/HomeService.php

xqd xqd xqd xqd xqd
@@ -154,6 +154,14 @@ class HomeService
                 $photo = array();
             }
             $distance =  GetDistance($user->latitude,$user->longitude,$userinfo->latitude,$userinfo->longitude);
+
+
+            if(Redis::get(ApiEnum::GET_WEIXIN.$user_id.'_'.$user->id)){
+               $get_weixin = 1;
+            }else{
+                $get_weixin = 0;
+            }
+
         }else{
             //查询是否阅后即焚
             if(count($photo)>0){
@@ -166,6 +174,7 @@ class HomeService
                 $photo = array();
             }
             $distance = 0;
+            $get_weixin = 0;
         }
 
 
@@ -196,6 +205,7 @@ class HomeService
         $userinfo->distance = $distance;
 
         $userinfo->see_user_num = UserVipLimit::query()->where('user_id',$user->id)->value("user_detail");
+        $userinfo->get_weixin = $get_weixin;
         return $userinfo;
     }
 
@@ -268,7 +278,6 @@ class HomeService
             }
         }
 
-
         if(empty($user_id)){
             throw new Exception('参数错误');
         }
@@ -278,6 +287,9 @@ class HomeService
         }
 
         $weixin = UserInfoModel::query()->where('user_id',$user_id)->value('weixin');
+        if(!Redis::get(ApiEnum::GET_WEIXIN.$user_id.'_'.$user->id)){
+            Redis::setex(ApiEnum::GET_WEIXIN.$user_id.'_'.$user->id,86400*180,$weixin);
+        }
         return $weixin;
     }