12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?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;
- }
- }
|