forked from starrtc/starrtc-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuas
committed
Aug 7, 2019
1 parent
7180661
commit 9bf3b53
Showing
13 changed files
with
457 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
//后台主动 添加群成员 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
require_once($dir . '/include/group_join.php'); | ||
|
||
|
||
|
||
|
||
$addUsers = '524048'; //要添加进的群的所有用户id,用逗号隔开 | ||
$groupId = 100457; | ||
|
||
|
||
$addUsersArr = explode(",", $addUsers); | ||
foreach($addUsersArr as $userId){ | ||
$ret = joinGroup($groupId, $userId); | ||
if($ret != 0){ | ||
echoErr('join group failed:'.$ret); | ||
} | ||
} | ||
|
||
$ret = addUsersToGroup($groupId, $addUsers); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
if($ret['data'] == 'GROUPPUSH_ERRID_GROUPID_NOT_SYNC'){ | ||
|
||
$ret = getGroupList($groupId); | ||
if($ret['ret'] != 0){ | ||
echoErr('get GroupList err'.$ret['ret']); | ||
} | ||
|
||
$groupList = $ignoreList = ''; | ||
if(!empty($ret['data']['groupList'])){// groupList表示这个群的所有群成员,用逗号分开。 | ||
$groupList = $ret['data']['groupList']; | ||
} | ||
if(!empty($ret['data']['ignoreList'])){//ignoreList为可选参数,表示对该群开启了消息免打扰的所有群成员,用逗号分开。 | ||
$ignoreList = $ret['data']['ignoreList']; | ||
} | ||
|
||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('失败'); | ||
} | ||
}else{ | ||
echoErr('addUsersToGroup_failed'); | ||
} | ||
} | ||
|
||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
//后台主动创建群 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
require_once($dir . '/include/group_create.php'); | ||
|
||
|
||
$userId = 'system'; //也可以是系统里面注册的其它用户 | ||
$groupName = '测试群'; | ||
|
||
|
||
|
||
|
||
$addUsers = $userId; //addUsers :用逗号分开的群成员列表,里面已经包含了创建者 | ||
$ret = createGroup($userId, $groupName, $addUsers); | ||
if($ret['ret'] != 0){ | ||
echoErr('createGroup failed:'.$ret['ret']); | ||
} | ||
$groupId = $ret['data']['groupId']; | ||
|
||
$groupList = $userId; | ||
$ignoreList = ''; | ||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
|
||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('群创建失败'); | ||
} | ||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
//后台主动 删除群成员 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
require_once($dir . '/include/group_quit.php'); | ||
|
||
|
||
//希望从群内删除的成员列表,用逗号分隔,如果删除单个用户,则没有逗号。 | ||
|
||
//TODO 可检查 是不是群主,如果不是可以不让其踢人,同时可以不让群主踢自已 | ||
|
||
$groupId = 100457; | ||
$removeUsers = '524048'; | ||
$removeUsersArr = explode(",", $removeUsers); | ||
foreach($removeUsersArr as $userId){ | ||
$ret = quitGroup($userId, $groupId); | ||
if($ret != 0){ | ||
echoErr('quitGroup_failed:'.$ret); | ||
} | ||
} | ||
|
||
|
||
|
||
$ret = delUsersFromGroup($groupId, $removeUsers); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
if($ret['data'] == 'GROUPPUSH_ERRID_GROUPID_NOT_SYNC'){ | ||
$ret = getGroupList($groupId); | ||
if($ret['ret'] != 0){ | ||
echoErr('get GroupList err'.$ret['ret']); | ||
} | ||
|
||
$groupList = $ignoreList = ''; | ||
if(!empty($ret['data']['groupList'])){// groupList表示这个群的所有群成员,用逗号分开。 | ||
$groupList = $ret['data']['groupList']; | ||
} | ||
if(!empty($ret['data']['ignoreList'])){//ignoreList为可选参数,表示对该群开启了消息免打扰的所有群成员,用逗号分开。 | ||
$ignoreList = $ret['data']['ignoreList']; | ||
} | ||
|
||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('失败'); | ||
} | ||
}else{ | ||
echoErr('delUsersFromGroup_failed'); | ||
} | ||
} | ||
|
||
|
||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
//后台主动删除群 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
require_once($dir . '/include/group_del.php'); | ||
|
||
|
||
$userId = 'system'; //也可以是系统里面注册的其它用户 | ||
$groupId = 100457; | ||
|
||
|
||
$ret = deleteGroup($userId, $groupId); | ||
if($ret != 0){ | ||
echoErr('deleteGroup_failed:'.$ret); | ||
} | ||
|
||
|
||
$groupList = ''; //不传groupList表示清空这个群的成员 | ||
$ignoreList = ''; | ||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
|
||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('群创建失败'); | ||
} | ||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
//后台主动 设置 免打扰:设置某人不接收群消息 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
|
||
|
||
|
||
$groupId = 100457; | ||
$ignoreList = '524048'; | ||
$usersArr = explode(",", $ignoreList); | ||
foreach($usersArr as $userId){ | ||
$ret = pushIgnore($groupId, $userId, GROUP_DND); | ||
if($ret != 0){ | ||
echoErr('pushIgnore failed:'.$ret); | ||
} | ||
} | ||
|
||
$ret = setPushIgnore($groupId, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
if($ret['data'] == 'GROUPPUSH_ERRID_GROUPID_NOT_SYNC'){ | ||
|
||
$ret = getGroupList($groupId); | ||
if($ret['ret'] != 0){ | ||
echoErr('get GroupList err'.$ret['ret']); | ||
} | ||
|
||
$groupList = $ignoreList = ''; | ||
if(!empty($ret['data']['groupList'])){// groupList表示这个群的所有群成员,用逗号分开。 | ||
$groupList = $ret['data']['groupList']; | ||
} | ||
if(!empty($ret['data']['ignoreList'])){//ignoreList为可选参数,表示对该群开启了消息免打扰的所有群成员,用逗号分开。 | ||
$ignoreList = $ret['data']['ignoreList']; | ||
} | ||
|
||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('失败'); | ||
} | ||
}else{ | ||
echoErr('addUsersToGroup_failed'); | ||
} | ||
} | ||
|
||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
//后台主动 设置 取消免打扰:设置某人接收群消息 | ||
|
||
$dir = dirname(dirname(__FILE__)); | ||
require_once($dir . '/config.php'); | ||
require_once($dir . '/include/group.php'); | ||
|
||
|
||
|
||
$groupId = 100457; | ||
$ignoreList = '524048'; | ||
$usersArr = explode(",", $ignoreList); | ||
foreach($usersArr as $userId){ | ||
$ret = pushIgnore($groupId, $userId, GROUP_PUSH); | ||
if($ret != 0){ | ||
echoErr('pushIgnore failed:'.$ret); | ||
} | ||
} | ||
|
||
$ret = unsetPushIgnore($groupId, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
if($ret['data'] == 'GROUPPUSH_ERRID_GROUPID_NOT_SYNC'){ | ||
|
||
$ret = getGroupList($groupId); | ||
if($ret['ret'] != 0){ | ||
echoErr('get GroupList err'.$ret['ret']); | ||
} | ||
|
||
$groupList = $ignoreList = ''; | ||
if(!empty($ret['data']['groupList'])){// groupList表示这个群的所有群成员,用逗号分开。 | ||
$groupList = $ret['data']['groupList']; | ||
} | ||
if(!empty($ret['data']['ignoreList'])){//ignoreList为可选参数,表示对该群开启了消息免打扰的所有群成员,用逗号分开。 | ||
$ignoreList = $ret['data']['ignoreList']; | ||
} | ||
|
||
$ret = syncGroupList($groupId, $groupList, $ignoreList); | ||
$data = json_decode($ret, TRUE); | ||
if($data['status'] != 1){ | ||
echoErr('失败'); | ||
} | ||
}else{ | ||
echoErr('addUsersToGroup_failed'); | ||
} | ||
} | ||
echoK('success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.