9
This commit is contained in:
@@ -44,7 +44,7 @@ class Auth
|
||||
* @param string $platformID 平台ID,默认为android
|
||||
* @return array
|
||||
*/
|
||||
public function forceLogout(string $userID, string $platformID = 'android'): array
|
||||
public function forceLogout(string $userID, string $platformID = 'android'): array|bool
|
||||
{
|
||||
// 获取管理员token
|
||||
$adminToken = Utils::getAdminToken();
|
||||
|
||||
@@ -33,11 +33,18 @@ class Conversation
|
||||
* @param string $userID 用户ID
|
||||
* @return array
|
||||
*/
|
||||
public function getSortedConversationList(string $userID): array
|
||||
public function getSortedConversationList(string $userID,$conversationIDs='',int $page=1,int $pagesize=10): array
|
||||
{
|
||||
// 获取管理员token
|
||||
$adminToken = Utils::getAdminToken();
|
||||
return Utils::send(Url::$getSortedConversationList, ['userID' => $userID], '获取排序的会话列表失败', $adminToken);
|
||||
return Utils::send(Url::$getSortedConversationList, [
|
||||
'userID' => $userID,
|
||||
'conversationIDs' => $conversationIDs,
|
||||
'pagination' => [
|
||||
'pageNumber' => $page,
|
||||
'showNumber' => $pagesize
|
||||
]
|
||||
], '获取排序的会话列表失败', $adminToken);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,9 @@ use support\OpenImSdk\Core\Utils;
|
||||
|
||||
class Group
|
||||
{
|
||||
function setGroupInfo($data=[]){
|
||||
return Utils::send('/group/set_group_info_ex', $data);
|
||||
}
|
||||
/**
|
||||
* 创建群组
|
||||
* @param string $ownerUserID 群主ID
|
||||
@@ -94,22 +97,23 @@ class Group
|
||||
/**
|
||||
* 获取群成员列表
|
||||
* @param string $groupID 群组ID
|
||||
* @param int $filter 过滤类型,0所有,1群主,2管理员,3普通成员,4禁言,5进入黑名单
|
||||
* @param string $filter 过滤类型,0所有,1群主,2管理员,3普通成员,4禁言,5进入黑名单
|
||||
* @param int $offset 偏移量
|
||||
* @param int $count 数量
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupMemberList(string $groupID, int $filter = 0, int $offset = 0, int $count = 100): array
|
||||
public function getGroupMemberList(string $groupID='', string $keyword = '', int $page = 1, int $pagesize = 100): array
|
||||
{
|
||||
// 获取管理员token
|
||||
$adminToken = Utils::getAdminToken();
|
||||
$data = [
|
||||
'groupID' => $groupID,
|
||||
'filter' => $filter,
|
||||
'offset' => $offset,
|
||||
'count' => $count
|
||||
'keyword' => $keyword,
|
||||
'pagination' => [
|
||||
'pageNumber' => $page,
|
||||
'showNumber' => $pagesize
|
||||
]
|
||||
];
|
||||
return Utils::send(Url::$getGroupMemberList, $data, '获取群成员列表失败', $adminToken);
|
||||
return Utils::send(Url::$getGroupMemberList, $data, '获取群成员列表失败');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,48 @@ use support\OpenImSdk\Core\Url;
|
||||
use support\OpenImSdk\Core\Utils;
|
||||
|
||||
class Message
|
||||
{
|
||||
{
|
||||
public function sendSingleMessage(string $sendID, string $recvID = '', array $data=[]): array
|
||||
{
|
||||
$data['recvID'] = $recvID;
|
||||
$data['groupID'] = '';
|
||||
$data['sessionType'] = 2;
|
||||
return $this->sendMessage($sendID,$data);
|
||||
}
|
||||
public function sendGroupMessage(string $sendID, string $groupID = '', array $data=[]): array
|
||||
{
|
||||
$data['recvID'] = '';
|
||||
$data['groupID'] = $groupID;
|
||||
$data['sessionType'] = 3;
|
||||
return $this->sendMessage($sendID,$data);
|
||||
}
|
||||
public function sendMessage(string $sendID, array $data=[]): array
|
||||
{
|
||||
$user = \think\facade\Db::name('user')->where('id',$sendID)->field('avatar,nickname')->find();
|
||||
$data = array_merge([
|
||||
"sendID" => $sendID,
|
||||
"senderNickname" => $user['nickname'],
|
||||
"senderFaceURL" => $user['avatar'],
|
||||
"senderPlatformID" => 5,
|
||||
"content"=> [
|
||||
"content" => "hello!!"
|
||||
],
|
||||
"contentType" => 1,
|
||||
"sessionType" => 4,
|
||||
"isOnlineOnly" => false,
|
||||
"notOfflinePush"=> true,
|
||||
"sendTime" => time()*1000,
|
||||
"offlinePushInfo"=> [
|
||||
"title" => "您收到一条新的消息",
|
||||
"desc" => "",
|
||||
"ex" => "",
|
||||
"iOSPushSound"=> "default",
|
||||
"iOSBadgeCount"=> true
|
||||
],
|
||||
"ex"=> ""
|
||||
],$data);
|
||||
return Utils::send(Url::$sendMsg, $data);
|
||||
}
|
||||
/**
|
||||
* 发送消息
|
||||
* @param string $sendID 发送者ID
|
||||
@@ -156,16 +197,21 @@ class Message
|
||||
*/
|
||||
public function sendBusinessNotification(string $sendID, string $recvID, array $data,string $type='user'): array
|
||||
{
|
||||
$key = isset($data['key']) ? $data['key'] : md5(time());
|
||||
$sendMsg = isset($data['sendMsg']) ? $data['sendMsg'] : true;
|
||||
unset($data['key']);
|
||||
unset($data['sendMsg']);
|
||||
// 获取管理员token
|
||||
$data = [
|
||||
'sendUserID' => $sendID,
|
||||
'recvUserID' => $type=='user' ? $recvID : '',
|
||||
'recvGroupID' => $type=='user' ? '': $recvID,
|
||||
'key' => md5(time()),
|
||||
'data' => json_encode($data),
|
||||
'sendMsg' => true,
|
||||
'sendUserID' => $sendID,
|
||||
'recvUserID' => $type=='user' ? $recvID : '',
|
||||
'recvGroupID' => $type=='user' ? '': $recvID,
|
||||
'key' => $key,
|
||||
'data' => json_encode($data),
|
||||
'sendMsg' => $sendMsg,
|
||||
'reliabilityLevel' => 1,
|
||||
];
|
||||
//log_alert($data);
|
||||
return Utils::send(Url::$sendBusinessNotification, $data, '发送业务通知失败');
|
||||
}
|
||||
|
||||
|
||||
@@ -134,13 +134,13 @@ class User
|
||||
* @param string $ex 扩展字段
|
||||
* @return array
|
||||
*/
|
||||
public function addNotificationAccount(string $userID, string $nickname = '', string $faceURL = '', int $appMangerLevel = 3): array
|
||||
public function addNotificationAccount(string $userID, string $nickname = '', string $faceURL = '', \support\OpenImSdk\Enum\appMangerLevel $appMangerLevel = \support\OpenImSdk\Enum\appMangerLevel::Notify): array
|
||||
{
|
||||
$data = [
|
||||
'userID' => $userID,
|
||||
'nickname' => $nickname,
|
||||
'faceURL' => $faceURL,
|
||||
'appMangerLevel' => $appMangerLevel,
|
||||
'appMangerLevel' => $appMangerLevel->value,
|
||||
];
|
||||
return Utils::send(Url::$addNotificationAccount, $data, '添加通知账号错误');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user