xiaogang hace 4 años
padre
commit
aada50a6b1
Se han modificado 2 ficheros con 44 adiciones y 0 borrados
  1. 4 0
      app/Admin/Actions/Chat/ChatLog.php
  2. 40 0
      app/Services/TencentImMessage.php

+ 4 - 0
app/Admin/Actions/Chat/ChatLog.php

xqd xqd
@@ -1,5 +1,6 @@
 <?php
 namespace App\Admin\Actions\Chat;
+use App\Services\TencentImMessage;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\LazyRenderable;
 
@@ -8,6 +9,9 @@ class ChatLog extends LazyRenderable
 
     public function grid(): Grid
     {
+        $data =new TencentImMessage();
+        $res = $data->getroammsg(1,1045);
+        dd($res);
         return Grid::make(new \App\Models\UserInfoModel(), function (Grid $grid) {
             $grid->column('user_id', 'ID')->sortable();
             $grid->column('nickname');

+ 40 - 0
app/Services/TencentImMessage.php

xqd
@@ -0,0 +1,40 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Models\User;
+use App\Traits\TencentIm;
+use PHPUnit\Util\Exception;
+
+class TencentImMessage
+{
+    use TencentIm;
+
+    //查询单聊消息
+    public function getroammsg($from,$to){
+        if(empty($from)){
+            throw new Exception("参数错误");
+        }
+
+        if(empty($to)){
+            throw new Exception("参数错误");
+        }
+        $from = User::query()->find($from,['tencent_im_user_id']);
+        $to = User::query()->find($to,['tencent_im_user_id']);
+
+        $this->restApiName = "v4/openim/admin_getroammsg";
+        $baseApiHost = $this->getTencentImRestApiBaseHost();
+        $params = [
+            'From_Account' => $from->tencent_im_user_id,
+            'To_Account' => $to->tencent_im_user_id,
+            'MaxCnt' => 999,
+            'MinTime' => 1625068800,
+            'MaxTime' => 1751299200,
+        ];
+        $apiResult = $this->requestApi($baseApiHost, $params);
+        self::verifyApiResult($apiResult);
+        return $apiResult;
+    }
+}