xiaogang 4 years ago
parent
commit
443233a535
2 changed files with 13 additions and 0 deletions
  1. 12 0
      app/Http/Controllers/Api/ChatController.php
  2. 1 0
      routes/api.php

+ 12 - 0
app/Http/Controllers/Api/ChatController.php

xqd
@@ -40,4 +40,16 @@ class ChatController extends Controller
         }
         return response()->json($res);
     }
+
+    public function get_friend(Request $request){
+        try {
+            $user = auth('api')->user();
+            $tencent_friend =new TencentImFriendService();
+            $res = $tencent_friend->friendGet($user->tencent_im_user_id,$request->page);
+
+        }catch (\Exception $exception){
+            return $this->response->errorForbidden($exception->getMessage());
+        }
+        return response()->json($res);
+    }
 }

+ 1 - 0
routes/api.php

xqd
@@ -116,6 +116,7 @@ $api->version('v1', [
         */
         $api->group(['prefix' => 'chat'], function ($api) {
             $api->post('/add_friend', 'ChatController@add_friend')->name('chat.add_friend');
+            $api->post('/get_friend', 'ChatController@get_friend')->name('chat.get_friend');
         });