xiaogang пре 4 година
родитељ
комит
3ee59bd4a1
2 измењених фајлова са 11 додато и 2 уклоњено
  1. 3 1
      app/Http/Controllers/Api/HomeController.php
  2. 8 1
      app/Services/HomeService.php

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

xqd
@@ -91,7 +91,9 @@ class HomeController extends Controller
      */
     public function user_detail(Request $request){
         try {
-            $res = $this->homeService->user_detail($request->user_id);
+            $param['user_id'] = $request->user_id;
+            $param['tencent_im_user_id'] = $request->tencent_im_user_id;
+            $res = $this->homeService->user_detail($param);
         }catch (AuthException $exception){
             return $this->response->errorUnauthorized($exception->getMessage());
         }catch (\Exception $exception){

+ 8 - 1
app/Services/HomeService.php

xqd
@@ -85,9 +85,16 @@ class HomeService
     }
 
     //用户详情
-    public function user_detail($user_id){
+    public function user_detail($param){
         $user = auth('api')->user();
+        if(!empty($param['user_id'])&& $param['user_id']>0){
+            $touser = User::query()->where('user_id',$param['user_id'])->first();
+        }
 
+        if(!empty($param['tencent_im_user_id'])){
+            $touser = User::query()->where('tencent_im_user_id',$param['tencent_im_user_id'])->first();
+        }
+        $user_id = $touser->id;
 
         //判断逛一逛用户和非会员用户
         if(!$user){