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; } //单发单聊消息 public function send_msg($data){ $this->restApiName = "v4/openim/sendmsg"; $baseApiHost = $this->getTencentImRestApiBaseHost(); $content = array(); $msg['MsgType'] = 'TIMTextElem'; $msg['MsgContent']['Text'] = $data['msg']; $content[]=$msg; $params = [ 'From_Account' => $data['from_user'], 'To_Account' => $data['to_user'], 'MsgRandom' => rand(100000,999999), "MsgBody"=> $content, ]; $apiResult = $this->requestApi($baseApiHost, $params); self::verifyApiResult($apiResult); return $apiResult; } }