252 lines
7.7 KiB
PHP
252 lines
7.7 KiB
PHP
<?php
|
|
|
|
namespace app\index\library\qiwe;
|
|
|
|
use Exception;
|
|
|
|
class Apis
|
|
{
|
|
//
|
|
public static function batchGetRoomDetail($args){
|
|
[$guid,$list] = $args;
|
|
return [
|
|
"method"=>"/room/batchGetRoomDetail",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"roomIdList"=>$list
|
|
]
|
|
];
|
|
}
|
|
public static function getRoomList($args){
|
|
[$guid,$nextStartIndex] = $args;
|
|
return [
|
|
"method"=>"/room/getRoomList",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"nextStartIndex"=>$nextStartIndex
|
|
]
|
|
];
|
|
}
|
|
public static function wxWorkDownload($args){
|
|
[$guid,$fileAeskey,$fileId,$fileSize,$fileType] = $args;
|
|
return [
|
|
"method"=>"/cloud/wxWorkDownload",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"fileAeskey"=>$fileAeskey,
|
|
"fileId"=>$fileId,
|
|
"fileSize"=> $fileSize,
|
|
"fileType"=> $fileType
|
|
]
|
|
];
|
|
}
|
|
public static function wxDownload($args){
|
|
[$guid,$fileAeskey,$fileAuthkey,$fileSize,$fileType,$fileUrl] = $args;
|
|
return [
|
|
"method"=>"/cloud/wxDownload",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"fileAeskey"=>$fileAeskey,
|
|
"fileAuthkey"=>$fileAuthkey,
|
|
"fileSize"=> $fileSize,
|
|
"fileType"=> $fileType,
|
|
"fileUrl"=>$fileUrl
|
|
]
|
|
];
|
|
}
|
|
public static function batchGetUserinfo($args){
|
|
[$guid,$list] = $args;
|
|
return [
|
|
"method"=>"/contact/batchGetUserinfo",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"userIdList"=>$list
|
|
]
|
|
];
|
|
}
|
|
//发送纯文本消息
|
|
public static function sendText($args){
|
|
$guid = $args[0] ?? '';
|
|
$toId = $args[1] ?? '';
|
|
$content = $args[2] ?? '';
|
|
$isNoNeedRead = $args[3] ?? false;
|
|
return [
|
|
"method"=>"/msg/sendText",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"content"=>$content,
|
|
"toId"=>strval($toId),
|
|
"isNoNeedRead"=>$isNoNeedRead
|
|
]
|
|
];
|
|
}
|
|
//发送混合文本消息
|
|
public static function sendHyperText($args){
|
|
[$guid,$toId,$content] = $args;
|
|
return [
|
|
"method"=>"/msg/sendHyperText",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"content"=>$content,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//发送图片消息
|
|
public static function sendImage($args){
|
|
[$guid,$toId,$fileAesKey,$fileId,$fileKey,$fileMd5,$fileSize,$filename] = $args;
|
|
return [
|
|
"method"=>"/msg/sendImage",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"toId"=>strval($toId),
|
|
"fileAesKey"=>$fileAesKey,
|
|
"fileId"=>$fileId,
|
|
"fileKey"=>$fileKey,
|
|
"fileMd5"=>$fileMd5,
|
|
"fileSize"=>$fileSize,
|
|
"filename"=>$filename
|
|
]
|
|
];
|
|
}
|
|
//视频消息
|
|
public static function sendVideo($args){
|
|
[$guid,$toId,$fileAesKey,$fileId,$fileKey,$fileMd5,$fileSize,$filename,$coverImageSize,$duration] = $args;
|
|
return [
|
|
"method"=>"/msg/sendVideo",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"fileAesKey"=>$fileAesKey,
|
|
"fileId"=>$fileId,
|
|
"fileMd5"=>$fileMd5,
|
|
"fileSize"=>$fileSize,
|
|
"filename"=>$filename,
|
|
"coverImageSize"=>$coverImageSize,
|
|
"duration"=>$duration,
|
|
"toId"=>strval($toId),
|
|
]
|
|
];
|
|
}
|
|
//发送文件消息
|
|
public static function sendFile($args){
|
|
[$guid,$toId,$fileAesKey,$fileId,$fileSize,$filename] = $args;
|
|
return [
|
|
"method"=>"/msg/sendFile",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"fileAesKey"=>$fileAesKey,
|
|
"fileId"=>$fileId,
|
|
"fileSize"=>$fileSize,
|
|
"filename"=>$filename,
|
|
"toId"=>strval($toId),
|
|
]
|
|
];
|
|
}
|
|
//发送链接消息
|
|
public static function sendLink($args){
|
|
[$guid,$toId,$title,$coverUrl,$linkUrl,$content] = $args;
|
|
return [
|
|
"method"=>"/msg/sendLink",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"title"=>$title,
|
|
"iconUrl"=>$coverUrl,
|
|
"linkUrl"=>$linkUrl,
|
|
"desc"=>$content,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//发送小程序消息
|
|
public static function sendWeapp($args){
|
|
[$guid,$toId,$appId,$coverFileAesKey,$coverFileId,$coverFileSize,$desc,$pagePath,$thumbUrl,$title,$username] = $args;
|
|
return [
|
|
"method"=>"/msg/sendWeapp",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"appId"=>$appId,
|
|
"coverFileAesKey"=>$coverFileAesKey,
|
|
"coverFileId"=>$coverFileId,
|
|
"coverFileSize"=>$coverFileSize,
|
|
"desc"=>$desc,
|
|
"pagePath"=>$pagePath,
|
|
"thumbUrl"=>$thumbUrl,
|
|
"title"=>$title,
|
|
"username"=>$username,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//发送名片消息
|
|
public static function sendPersonalCard($args){
|
|
[$guid,$toId,$sharedId] = $args;
|
|
return [
|
|
"method"=>"/msg/sendPersonalCard",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"sharedId"=>$sharedId,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//发送视频号消息
|
|
public static function sendFeedVideo($args){
|
|
[$guid,$toId,$channelName,$channelUrl,$coverUrl,$encodeData,$headImgUrl,$feedId,$feedNo,$username] = $args;
|
|
return [
|
|
"method"=>"/msg/sendFeedVideo",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"channelName"=>$channelName,
|
|
"channelUrl"=>$channelUrl,
|
|
"coverUrl"=>$coverUrl,
|
|
"encodeData"=>$encodeData,
|
|
"headImgUrl"=>$headImgUrl,
|
|
"feedId"=>$feedId,
|
|
"feedNo"=>$feedNo,
|
|
"username"=>$username,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//发送定位消息
|
|
public static function sendLocation($args){
|
|
[$guid,$toId,$title,$address,$latitude,$longitude] = $args;
|
|
return [
|
|
"method"=>"/msg/sendLocation",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"title"=>$title,
|
|
"address"=>$address,
|
|
"latitude"=>$latitude,
|
|
"longitude"=>$longitude,
|
|
"toId"=>strval($toId)
|
|
]
|
|
];
|
|
}
|
|
//撤回消息
|
|
public static function revokeMsg($args){
|
|
[$guid,$chatId,$msgServerId] = $args;
|
|
return [
|
|
"method"=>"/msg/revokeMsg",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"chatId"=>$chatId,
|
|
"msgServerId"=>$msgServerId
|
|
]
|
|
];
|
|
}
|
|
//文件上传-URL上传方式
|
|
//1: jpg图片, 4: mp4视频, 5: 文件(也包括语音amr文件)
|
|
public static function cdnBigUploadByUrl($args){
|
|
[$guid,$filename,$fileUrl,$fileType] = $args;
|
|
return [
|
|
"method"=>"/cloud/cdnBigUploadByUrl",
|
|
"params"=>[
|
|
"guid"=>$guid,
|
|
"filename"=>$filename,
|
|
"fileUrl"=>$fileUrl,
|
|
"fileType"=>$fileType
|
|
]
|
|
];
|
|
}
|
|
} |