xiaogang 4 år sedan
förälder
incheckning
91bd796acd
3 ändrade filer med 12 tillägg och 3 borttagningar
  1. 0 1
      app/Http/Controllers/Api/HomeController.php
  2. 11 2
      app/Services/HomeService.php
  3. 1 0
      routes/api.php

+ 0 - 1
app/Http/Controllers/Api/HomeController.php

xqd
@@ -24,7 +24,6 @@ class HomeController extends Controller
      * 获取位置信息,经纬度
      */
     public function get_location(Request $request){
-        dd(RedisService::redis()->get('user_location_'.$request->uniqueID));
         try {
             if(!isset($request->latitude) || $request->latitude==""){
                 throw new Exception("参数错误");

+ 11 - 2
app/Services/HomeService.php

xqd
@@ -52,9 +52,18 @@ class HomeService
         if($user){
             //登录状态  增加 谁看了我记录
             look_log($user->id,$user_id);
-        }
-
 
+        }
+        $userinfo = User::query()
+            ->leftJoin('users_info','users.id','=','users_info.user_id')
+            ->where('users.id',$user_id)
+            ->select(['users.id','users.sex','users.is_auth','users.is_vip','users.tencent_im_user_id','users.online','users_info.*'])
+            ->first();
+        $userinfo->hobby = explode(',',$userinfo->hobby);
+        $userinfo->photo = json_decode($userinfo->photo,true);
+        $userinfo->video = json_decode($userinfo->video,true);
 
+        $userinfo->is_like = 1;
+        return $userinfo;
     }
 }

+ 1 - 0
routes/api.php

xqd
@@ -30,6 +30,7 @@ $api->version('v1', [
         $api->group(['prefix' => 'home'], function ($api) {
             $api->post('/home', 'HomeController@home')->name('home.home');
             $api->post('/get_location', 'HomeController@get_location')->name('home.get_location');
+            $api->post('/user_detail', 'HomeController@user_detail')->name('home.user_detail');
         });
 
         /*