├── .gitignore ├── LICENSE ├── README.md ├── RongCloud ├── Autoloader.php ├── Lib │ ├── Chatroom │ │ ├── Ban │ │ │ ├── Ban.php │ │ │ └── api.json │ │ ├── Block │ │ │ ├── Block.php │ │ │ └── api.json │ │ ├── Chatroom.php │ │ ├── Demotion │ │ │ ├── Demotion.php │ │ │ └── api.json │ │ ├── Distribute │ │ │ ├── Distribute.php │ │ │ └── api.json │ │ ├── Entry │ │ │ ├── Entry.php │ │ │ └── api.json │ │ ├── Gag │ │ │ ├── Gag.php │ │ │ └── api.json │ │ ├── Keepalive │ │ │ ├── Keepalive.php │ │ │ └── api.json │ │ ├── MuteAllMembers │ │ │ ├── MuteAllMembers.php │ │ │ └── api.json │ │ ├── MuteWhiteList │ │ │ ├── MuteWhiteList.php │ │ │ └── api.json │ │ ├── Whitelist │ │ │ ├── Message.php │ │ │ ├── User.php │ │ │ ├── Whitelist.php │ │ │ ├── message-api.json │ │ │ └── user-api.json │ │ ├── api.json │ │ └── verify.json │ ├── Conversation │ │ ├── Conversation.php │ │ ├── api.json │ │ └── verify.json │ ├── ConversationType.php │ ├── Entrust │ │ ├── Entrust.php │ │ ├── Group │ │ │ ├── Group.php │ │ │ ├── Manager │ │ │ │ └── Manager.php │ │ │ ├── Member │ │ │ │ └── Member.php │ │ │ └── RemarkName │ │ │ │ └── RemarkName.php │ │ ├── api.json │ │ └── verify.json │ ├── Group │ │ ├── Gag │ │ │ ├── Gag.php │ │ │ └── api.json │ │ ├── Group.php │ │ ├── MuteAllMembers │ │ │ ├── MuteAllMembers.php │ │ │ └── api.json │ │ ├── MuteWhiteList │ │ │ ├── MuteWhiteList.php │ │ │ └── api.json │ │ ├── Remark │ │ │ ├── Remark.php │ │ │ └── api.json │ │ ├── api.json │ │ └── verify.json │ ├── Message │ │ ├── Broadcast │ │ │ ├── Broadcast.php │ │ │ └── api.json │ │ ├── Chatroom │ │ │ ├── Chatroom.php │ │ │ └── api.json │ │ ├── Discussion │ │ │ ├── Discussion.php │ │ │ └── api.json │ │ ├── Expansion │ │ │ ├── Expansion.php │ │ │ └── api.json │ │ ├── Group │ │ │ ├── Group.php │ │ │ └── api.json │ │ ├── History │ │ │ ├── History.php │ │ │ ├── api.json │ │ │ └── verify.json │ │ ├── Message.php │ │ ├── Person │ │ │ ├── Person.php │ │ │ └── api.json │ │ ├── System │ │ │ ├── System.php │ │ │ └── api.json │ │ ├── Ultragroup │ │ │ ├── Ultragroup.php │ │ │ └── api.json │ │ └── verify.json │ ├── Push │ │ ├── Push.php │ │ ├── api.json │ │ └── verify.json │ ├── Request.php │ ├── Sensitive │ │ ├── Sensitive.php │ │ ├── api.json │ │ └── verify.json │ ├── Ultragroup │ │ ├── BusChannel │ │ │ ├── BusChannel.php │ │ │ └── api.json │ │ ├── Expansion │ │ │ ├── Expansion.php │ │ │ └── api.json │ │ ├── Gag │ │ │ ├── Gag.php │ │ │ └── api.json │ │ ├── MuteAllMembers │ │ │ ├── MuteAllMembers.php │ │ │ └── api.json │ │ ├── MuteWhiteList │ │ │ ├── MuteWhiteList.php │ │ │ └── api.json │ │ ├── Notdisturb │ │ │ ├── Notdisturb.php │ │ │ └── api.json │ │ ├── Ultragroup.php │ │ ├── api.json │ │ └── verify.json │ ├── User │ │ ├── Blacklist │ │ │ ├── Blacklist.php │ │ │ └── api.json │ │ ├── Block │ │ │ ├── Block.php │ │ │ └── api.json │ │ ├── BlockPushPeriod │ │ │ ├── BlockPushPeriod.php │ │ │ └── api.json │ │ ├── Chat │ │ │ ├── Ban.php │ │ │ ├── api.json │ │ │ └── verify.json │ │ ├── MuteChatrooms │ │ │ ├── MuteChatrooms.php │ │ │ ├── api.json │ │ │ └── verify.json │ │ ├── MuteGroups │ │ │ ├── MuteGroups.php │ │ │ ├── api.json │ │ │ └── verify.json │ │ ├── Onlinestatus │ │ │ ├── Onlinestatus.php │ │ │ └── api.json │ │ ├── Profile │ │ │ ├── Profile.php │ │ │ ├── api.json │ │ │ └── verify.json │ │ ├── Remark │ │ │ ├── Remark.php │ │ │ └── api.json │ │ ├── Tag │ │ │ ├── Tag.php │ │ │ └── api.json │ │ ├── User.php │ │ ├── Whitelist │ │ │ ├── Whitelist.php │ │ │ └── api.json │ │ ├── api.json │ │ └── verify.json │ └── Utils.php ├── RongCloud.php ├── example │ ├── Chatroom │ │ ├── Ban.php │ │ ├── Block.php │ │ ├── Chatroom.php │ │ ├── Demotion.php │ │ ├── Distribute.php │ │ ├── Entry.php │ │ ├── Gag.php │ │ ├── Keepalive.php │ │ ├── MuteAllMembers.php │ │ ├── MuteWhiteList.php │ │ └── Whitelist │ │ │ ├── Message.php │ │ │ └── User.php │ ├── Conversation │ │ └── Conversation.php │ ├── Entrust │ │ ├── Group.php │ │ ├── GroupManager.php │ │ ├── GroupMember.php │ │ └── GroupRemarkName.php │ ├── Group │ │ ├── Gag.php │ │ ├── Group.php │ │ ├── MuteAllMembers.php │ │ ├── MuteWhiteList.php │ │ └── Remark.php │ ├── Message │ │ ├── Broadcast.php │ │ ├── Chatroom.php │ │ ├── Expansion.php │ │ ├── Group.php │ │ ├── History.php │ │ ├── Person.php │ │ ├── System.php │ │ └── Ultragroup.php │ ├── Push │ │ └── Push.php │ ├── Sensitive │ │ └── Sensitive.php │ ├── Ultragroup │ │ ├── BusChannel.php │ │ ├── Expansion.php │ │ ├── Gag.php │ │ ├── MuteAllMembers.php │ │ ├── MuteWhiteList.php │ │ ├── Notdisturb.php │ │ └── Ultragroup.php │ └── User │ │ ├── Ban.php │ │ ├── Blacklist.php │ │ ├── Block.php │ │ ├── BlockPushPeriod.php │ │ ├── MuteChatrooms.php │ │ ├── MuteGroups.php │ │ ├── Onlinestatus.php │ │ ├── Profile.php │ │ ├── Remark.php │ │ ├── Tag.php │ │ ├── User.php │ │ └── Whitelist.php └── tests │ ├── TestChatroom.php │ ├── TestConversation.php │ ├── TestEntrust.php │ ├── TestGroup.php │ ├── TestMessage.php │ ├── TestPush.php │ ├── TestSensitive.php │ ├── TestUltragroup.php │ └── TestUser.php ├── ServerSDKFeatureSupportedVersionList.md └── composer.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Rong Cloud 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Server SDK PHP 3 | 4 | Rong Cloud Server SDK in PHP 5 | 6 | ## Version description 7 | Server SDK 3.0 simplifies integration and improves maintenance with standardized naming and a clearer structure. Older versions remain usable but won’t receive updates. 8 | New users should start with Server SDK 3.0. Existing users must test thoroughly before upgrading. 9 | 10 | ## API documentation 11 | - Official documentation (https://docs.rongcloud.io/platform-chat-api) 12 | 13 | ## Usage tutorial 14 | - Include `RongCloud/RongCloud.php` 15 | - Check API call examples in the `example` folder 16 | - Review API test cases in the `tests` folder 17 | 18 | ## Composer 19 | - Official package URL (https://packagist.org/packages/rongcloud/php-sdk) 20 | - Install with: `composer require rongcloud/php-sdk dev-master` 21 | -------------------------------------------------------------------------------- /RongCloud/Autoloader.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 41 | } 42 | 43 | /** 44 | * Add application in-chat room downgrade message 45 | * 46 | * @param array $Chatroom 47 | * $Chatroom = [ 48 | * 'msgs'=> ['RC:TxtMsg03','RC:TxtMsg02']// Message type list 49 | * ]; 50 | * @return mixed|null 51 | */ 52 | public function add(array $Chatroom=[]){ 53 | $conf = $this->conf['add']; 54 | $verify = $this->verify['demotion'] ; 55 | $error = (new Utils())->check([ 56 | 'api'=> $conf, 57 | 'model'=> 'demotion', 58 | 'data'=> $Chatroom, 59 | 'verify'=> $verify 60 | ]); 61 | if($error) return $error; 62 | $Chatroom = (new Utils())->rename($Chatroom, [ 63 | 'msgs'=>'objectName', 64 | ]); 65 | $result = (new Request())->Request($conf['url'],$Chatroom); 66 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 67 | return $result; 68 | } 69 | 70 | /** 71 | * Remove in-app chatroom downgrade messages 72 | * 73 | * @param array $Chatroom 74 | * $Chatroom = [ 75 | * 'msgs'=> ['RC:TxtMsg03','RC:TxtMsg02']// Message type list 76 | * ]; 77 | * @return mixed|null 78 | */ 79 | public function remove(array $Chatroom=[]){ 80 | $conf = $this->conf['remove']; 81 | $verify = $this->verify['demotion'] ; 82 | $error = (new Utils())->check([ 83 | 'api'=> $conf, 84 | 'model'=> 'demotion', 85 | 'data'=> $Chatroom, 86 | 'verify'=> $verify 87 | ]); 88 | if($error) return $error; 89 | $Chatroom = (new Utils())->rename($Chatroom, [ 90 | 'msgs'=>'objectName', 91 | ]); 92 | $result = (new Request())->Request($conf['url'],$Chatroom); 93 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 94 | return $result; 95 | } 96 | 97 | /** 98 | * Get the downgrade message of the in-app chatroom 99 | * 100 | * @param array $Chatroom 101 | * $Chatroom = [ 102 | * 103 | * ]; 104 | * @return mixed|null 105 | */ 106 | public function getList(array $Chatroom=[]){ 107 | $conf = $this->conf['getList']; 108 | $result = (new Request())->Request($conf['url'],$Chatroom); 109 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 110 | return $result; 111 | } 112 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Demotion/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/discarded#priority", 4 | "url": "chatroom/message/priority/add", 5 | "params": { 6 | "demotion": { 7 | "msgs": ["RC:TxtMsg", "RC:ImgMsg"] 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": "200", 13 | "msg": "Successfully returned" 14 | }, 15 | "fail": { 16 | "1502": { 17 | "code": "1502", 18 | "msg": "{{name}} exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 19 | }, 20 | "1002": { 21 | "code": "1002", 22 | "msg": "{{name}} is a required parameter" 23 | }, 24 | "1501": { 25 | "code": "1501", 26 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}}, currently it is {{currentType}}" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "msg": "Signature error, please verify if Appkey and Secret are correct" 31 | }, 32 | "1008": { 33 | "code": "1008", 34 | "msg": "Call frequency exceeded" 35 | } 36 | } 37 | } 38 | }, 39 | "remove": { 40 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/discarded#priority_remove", 41 | "url": "chatroom/message/priority/remove", 42 | "params": { 43 | "demotion": { 44 | "msgs": ["RC:TxtMsg", "RC:ImgMsg"] 45 | } 46 | }, 47 | "response": { 48 | "success": { 49 | "code": "200", 50 | "msg": "Successfully returned" 51 | }, 52 | "fail": { 53 | "1502": { 54 | "code": "1502", 55 | "msg": "{{name}} exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 56 | }, 57 | "1002": { 58 | "code": "1002", 59 | "msg": "{{name}} is a required parameter" 60 | }, 61 | "1501": { 62 | "code": "1501", 63 | "msg": "{{name}} type is incorrect, please check the parameter type, it should be Object, currently it is {{currentType}}" 64 | }, 65 | "1004": { 66 | "code": "1004", 67 | "msg": "Signature error, please verify if Appkey and Secret are correct" 68 | }, 69 | "1008": { 70 | "code": "1008", 71 | "msg": "Call frequency exceeded" 72 | } 73 | } 74 | } 75 | }, 76 | "getList": { 77 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/discarded#priority_query", 78 | "url": "chatroom/message/priority/query", 79 | "params": {}, 80 | "response": { 81 | "success": { 82 | "code": 200, 83 | "objectNames": ["RC:ImgMsg", "RC:ImgTextMsg", "RC:VcMsg"] 84 | }, 85 | "fail": { 86 | "1004": { 87 | "code": "1004", 88 | "msg": "Signature error, please verify if Appkey and Secret are correct" 89 | }, 90 | "1008": { 91 | "code": "1008", 92 | "msg": "Call frequency exceeded" 93 | } 94 | } 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Distribute/Distribute.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 43 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 44 | } 45 | 46 | /** 47 | * Stop chatroom message distribution 48 | * 49 | * @param array $Chatroom 50 | * $Chatroom = [ 51 | * 'id'=> 'ujadk90ha',//chatroom id 52 | * ]; 53 | * @return mixed|null 54 | */ 55 | public function stop(array $Chatroom=[]){ 56 | $conf = $this->conf['stop']; 57 | $verify = $this->verify['chatroom'] ; 58 | $verify = ['id'=>$verify['id']]; 59 | $error = (new Utils())->check([ 60 | 'api'=> $conf, 61 | 'model'=> 'chatroom', 62 | 'data'=> $Chatroom, 63 | 'verify'=> $verify 64 | ]); 65 | if($error) return $error; 66 | $Chatroom = (new Utils())->rename($Chatroom, [ 67 | 'id'=>'chatroomId', 68 | ]); 69 | $result = (new Request())->Request($conf['url'],$Chatroom); 70 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 71 | return $result; 72 | } 73 | 74 | /** 75 | * Restore chatroom message distribution 76 | * 77 | * @param array $Chatroom 78 | * $Chatroom = [ 79 | * 'id'=> 'ujadk90ha',//chatroom id 80 | * ]; 81 | * @return mixed|null 82 | */ 83 | public function resume(array $Chatroom=[]){ 84 | $conf = $this->conf['resume']; 85 | $verify = $this->verify['chatroom'] ; 86 | $verify = ['id'=>$verify['id']]; 87 | $error = (new Utils())->check([ 88 | 'api'=> $conf, 89 | 'model'=> 'chatroom', 90 | 'data'=> $Chatroom, 91 | 'verify'=> $verify 92 | ]); 93 | if($error) return $error; 94 | $Chatroom = (new Utils())->rename($Chatroom, [ 95 | 'id'=>'chatroomId', 96 | ]); 97 | $result = (new Request())->Request($conf['url'],$Chatroom); 98 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 99 | return $result; 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Distribute/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "stop": { 3 | "docs": "http://rongcloud.cn/docs/server.html#chatroom_message_stop_distribution", 4 | "url": "chatroom/message/stopDistribution", 5 | "params": { 6 | "chatroom": { 7 | "id": "chatroom01" 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": "200", 13 | "msg": "Successfully returned" 14 | }, 15 | "fail": { 16 | "1005": { 17 | "code": "1005", 18 | "msg": "{{name}} exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 19 | }, 20 | "1002": { 21 | "code": "1002", 22 | "msg": "{{name}} is a required parameter" 23 | }, 24 | "1501": { 25 | "code": "1501", 26 | "msg": "{{name}} type is incorrect, please check the parameter type, it should be Object but {{currentType}} was passed" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "msg": "Signature error, please verify if Appkey and Secret are correct" 31 | }, 32 | "1008": { 33 | "code": "1008", 34 | "msg": "Call frequency exceeded" 35 | } 36 | } 37 | } 38 | }, 39 | "resume": { 40 | "docs": "http://rongcloud.cn/docs/server.html#chatroom_message_resume_distribution", 41 | "url": "chatroom/message/resumeDistribution", 42 | "params": { 43 | "chatroom": { 44 | "id": "chatroom01" 45 | } 46 | }, 47 | "response": { 48 | "success": { 49 | "code": "200", 50 | "msg": "Successfully returned" 51 | }, 52 | "fail": { 53 | "1005": { 54 | "code": "1005", 55 | "msg": "{{name}} exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 56 | }, 57 | "1002": { 58 | "code": "1002", 59 | "msg": "{{name}} is a required parameter" 60 | }, 61 | "1501": { 62 | "code": "1501", 63 | "msg": "Parameter type is incorrect, please check the parameter type, it should be {{type}} but {{currentType}} was passed" 64 | }, 65 | "1004": { 66 | "code": "1004", 67 | "msg": "Signature error, please verify if Appkey and Secret are correct" 68 | }, 69 | "1008": { 70 | "code": "1008", 71 | "msg": "Call frequency exceeded" 72 | } 73 | } 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Gag/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/gag#gag_add", 4 | "url": "chatroom/user/gag/add", 5 | "params": { 6 | "chatroom": { 7 | "members": [{ 8 | "id": "akfj0a1" 9 | }], 10 | "minute": 100 11 | } 12 | }, 13 | "response": { 14 | "success": { 15 | "code": 200, 16 | "msg": "Success" 17 | }, 18 | "fail": { 19 | "1502": { 20 | "code": "1502", 21 | "msg": "Invalid gag duration, current value is {{size}}, valid range is 1 - 1 * 30 * 24 * 60 minutes" 22 | }, 23 | "1002": { 24 | "code": "1002", 25 | "msg": "{{name}} is a required parameter" 26 | }, 27 | "1501": { 28 | "code": "1501", 29 | "msg": "Invalid parameter type, expected {{type}}, but got {{currentType}}" 30 | }, 31 | "1004": { 32 | "code": "1004", 33 | "msg": "Signature error, please check if Appkey and Secret are correct" 34 | }, 35 | "1008": { 36 | "code": "1008", 37 | "msg": "Request frequency exceeded" 38 | } 39 | } 40 | } 41 | }, 42 | "remove": { 43 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/gag#gag_rollback", 44 | "url": "chatroom/user/gag/rollback", 45 | "params": { 46 | "chatroom": { 47 | "members": [{ 48 | "id": "akfj0a1" 49 | }] 50 | } 51 | }, 52 | "response": { 53 | "success": { 54 | "code": 200, 55 | "msg": "Success" 56 | }, 57 | "fail": { 58 | "1002": { 59 | "code": "1002", 60 | "msg": "{{name}} is a required parameter" 61 | }, 62 | "1501": { 63 | "code": "1501", 64 | "msg": "Invalid parameter type for {{name}}, expected Object, but got {{currentType}}" 65 | }, 66 | "1004": { 67 | "code": "1004", 68 | "msg": "Signature error, please check if Appkey and Secret are correct" 69 | }, 70 | "1008": { 71 | "code": "1008", 72 | "msg": "Request frequency exceeded" 73 | } 74 | } 75 | } 76 | }, 77 | "getList": { 78 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/gag#gag_query", 79 | "url": "chatroom/user/gag/list", 80 | "params": { 81 | "chatroom": { 82 | "id": "chatroom-01" 83 | } 84 | }, 85 | "response": { 86 | "success": { 87 | "code": "200", 88 | "members": [{ 89 | "time": "2015-09-25 16:12:38", 90 | "id": "2582" 91 | }] 92 | }, 93 | "fail": { 94 | "1004": { 95 | "code": "1004", 96 | "msg": "Signature error, please check if Appkey and Secret are correct" 97 | }, 98 | "1002": { 99 | "code": "1002", 100 | "msg": "{{name}} is a required parameter" 101 | }, 102 | "1501": { 103 | "code": "1501", 104 | "msg": "Invalid parameter type for {{name}}, expected Object, but got {{currentType}}" 105 | }, 106 | "1008": { 107 | "code": "1008", 108 | "msg": "Request frequency exceeded" 109 | } 110 | } 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Keepalive/Keepalive.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 39 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 40 | } 41 | 42 | /** 43 | * Add a chatroom for live chat 44 | * 45 | * @param $Chatroom 46 | * $Chatroom = [ 47 | * 'id'=> 'ujadk90ha',// chatroom id 48 | * ]; 49 | * @return mixed|null 50 | */ 51 | public function add(array $Chatroom=[]){ 52 | $conf = $this->conf['add']; 53 | $verify = $this->verify['chatroom'] ; 54 | $verify = ['id'=>$verify['id']]; 55 | $error = (new Utils())->check([ 56 | 'api'=> $conf, 57 | 'model'=> 'chatroom', 58 | 'data'=> $Chatroom, 59 | 'verify'=> $verify 60 | ]); 61 | if($error) return $error; 62 | $Chatroom = (new Utils())->rename($Chatroom, [ 63 | 'id'=>'chatroomId', 64 | ]); 65 | $result = (new Request())->Request($conf['url'],$Chatroom); 66 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 67 | return $result; 68 | } 69 | 70 | /** 71 | * Delete chatroom 72 | * 73 | * @param $Chatroom 74 | * $Chatroom = [ 75 | * 'id'=> 'ujadk90ha',//chatroom id 76 | * ]; 77 | * @return mixed|null 78 | */ 79 | public function remove(array $Chatroom=[]){ 80 | $conf = $this->conf['remove']; 81 | $verify = $this->verify['chatroom'] ; 82 | $verify = ['id'=>$verify['id']]; 83 | $error = (new Utils())->check([ 84 | 'api'=> $conf, 85 | 'model'=> 'chatroom', 86 | 'data'=> $Chatroom, 87 | 'verify'=> $verify 88 | ]); 89 | if($error) return $error; 90 | $Chatroom = (new Utils())->rename($Chatroom, [ 91 | 'id'=>'chatroomId', 92 | ]); 93 | $result = (new Request())->Request($conf['url'],$Chatroom); 94 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 95 | return $result; 96 | } 97 | 98 | /** 99 | * Get the chatroom for preserving 100 | * 101 | * @param $Chatroom 102 | * $Chatroom = [ 103 | * 104 | * ]; 105 | * @return mixed|null 106 | */ 107 | public function getList(array $Chatroom=[]){ 108 | $conf = $this->conf['getList']; 109 | $result = (new Request())->Request($conf['url'],$Chatroom); 110 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 111 | if($result['code'] == 200 || $result['code'] == 0){ 112 | $result = (new Utils())->rename($result,['chatroomIds'=>'chatrooms']); 113 | $result['code'] = 200; 114 | } 115 | return $result; 116 | } 117 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Keepalive/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/live#add_api", 4 | "url": "chatroom/keepalive/add", 5 | "params": { 6 | "chatroom": { 7 | "id": "chatroomId01" 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": "200", 13 | "msg": "Successfully returned" 14 | }, 15 | "fail": { 16 | "1005": { 17 | "code": "1005", 18 | "msg": "chatroomId length exceeds limit, chatroomId >= 1 and chatroomId <= 64 unit: bytes" 19 | }, 20 | "1002": { 21 | "code": "1002", 22 | "msg": "{{name}} parameter is required" 23 | }, 24 | "1004": { 25 | "code": "1004", 26 | "msg": "Signature error, please check if Appkey and Secret are correct" 27 | }, 28 | "1008": { 29 | "code": "1008", 30 | "msg": "Call frequency limit exceeded" 31 | } 32 | } 33 | } 34 | }, 35 | "remove": { 36 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/live#keepalive_remove", 37 | "url": "chatroom/keepalive/remove", 38 | "params": { 39 | "chatroom": { 40 | "id": "chatroomId01" 41 | } 42 | }, 43 | "response": { 44 | "success": { 45 | "code": "200", 46 | "msg": "Successfully returned" 47 | }, 48 | "fail": { 49 | "1005": { 50 | "code": "1005", 51 | "msg": "chatroomId length exceeds limit, chatroomId >= 1 and chatroomId <= 64 unit: bytes" 52 | }, 53 | "1002": { 54 | "code": "1002", 55 | "msg": "{{name}} parameter is required" 56 | }, 57 | "1004": { 58 | "code": "1004", 59 | "msg": "Signature error, please check if Appkey and Secret are correct" 60 | }, 61 | "1008": { 62 | "code": "1008", 63 | "msg": "Call frequency limit exceeded" 64 | } 65 | } 66 | } 67 | }, 68 | "getList": { 69 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/live#keepalive_query", 70 | "url": "chatroom/keepalive/query", 71 | "params": {}, 72 | "response": { 73 | "success": { 74 | "code": "200", 75 | "chatrooms": ["chatroomId1", "chatroomId2"] 76 | }, 77 | "fail": { 78 | "1005": { 79 | "code": "1005", 80 | "msg": "chatroomId length exceeds limit, chatroomId >= 1 and chatroomId <= 64 unit: bytes" 81 | }, 82 | "1002": { 83 | "code": "1002", 84 | "msg": "{{name}} parameter is required" 85 | }, 86 | "1004": { 87 | "code": "1004", 88 | "msg": "Signature error, please check if Appkey and Secret are correct" 89 | }, 90 | "1008": { 91 | "code": "1008", 92 | "msg": "Call frequency limit exceeded" 93 | } 94 | } 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/MuteWhiteList/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_add", 4 | "url": "chatroom/user/ban/whitelist/add", 5 | "params": { 6 | "chatroom": { 7 | "id": "chatroom", 8 | "members": [{ 9 | "id": "akfj0a1" 10 | }] 11 | } 12 | }, 13 | "response": { 14 | "success": { 15 | "code": 200, 16 | "msg": "Success" 17 | }, 18 | "fail": { 19 | "1502": { 20 | "code": "1502", 21 | "msg": "Invalid ban duration, current input is {{size}}, valid range is 1 - 1 * 30 * 24 * 60 minutes" 22 | }, 23 | "1002": { 24 | "code": "1002", 25 | "msg": "{{name}} is a required parameter" 26 | }, 27 | "1501": { 28 | "code": "1501", 29 | "msg": "Invalid parameter type, expected {{type}}, but got {{currentType}}" 30 | }, 31 | "1004": { 32 | "code": "1004", 33 | "msg": "Signature error, please check if Appkey and Secret are correct" 34 | }, 35 | "1008": { 36 | "code": "1008", 37 | "msg": "Rate limit exceeded" 38 | } 39 | } 40 | } 41 | }, 42 | "remove": { 43 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_remove", 44 | "url": "chatroom/user/ban/whitelist/rollback", 45 | "params": { 46 | "chatroom": { 47 | "id": "chatroom", 48 | "members": [{ 49 | "id": "akfj0a1" 50 | }] 51 | } 52 | }, 53 | "response": { 54 | "success": { 55 | "code": 200, 56 | "msg": "Success" 57 | }, 58 | "fail": { 59 | "1002": { 60 | "code": "1002", 61 | "msg": "{{name}} is a required parameter" 62 | }, 63 | "1501": { 64 | "code": "1501", 65 | "msg": "Invalid parameter type for {{name}}, expected Object, but got {{currentType}}" 66 | }, 67 | "1004": { 68 | "code": "1004", 69 | "msg": "Signature error, please check if Appkey and Secret are correct" 70 | }, 71 | "1008": { 72 | "code": "1008", 73 | "msg": "Rate limit exceeded" 74 | } 75 | } 76 | } 77 | }, 78 | "getList": { 79 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_query", 80 | "url": "chatroom/user/ban/whitelist/query", 81 | "params": { 82 | "chatroom": { 83 | "id": "chatroom" 84 | } 85 | }, 86 | "response": { 87 | "success": { 88 | "code": "200", 89 | "members": [{ 90 | "time": "2015-09-25 16:12:38", 91 | "id": "2582" 92 | }] 93 | }, 94 | "fail": { 95 | "1004": { 96 | "code": "1004", 97 | "msg": "Signature error, please check if Appkey and Secret are correct" 98 | }, 99 | "1008": { 100 | "code": "1008", 101 | "msg": "Rate limit exceeded" 102 | } 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Whitelist/Message.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'message-api.json'); 39 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 40 | } 41 | 42 | /** 43 | * Add chatroom message whitelist 44 | * 45 | * @param $Chatroom 46 | * $Chatroom = [ 47 | * 'msgs'=> ["RC:TxtMsg"]//Message type list 48 | * ] 49 | * @return array 50 | */ 51 | public function add(array $Chatroom=[]){ 52 | $conf = $this->conf['add']; 53 | $verify = $this->verify['demotion'] ; 54 | $error = (new Utils())->check([ 55 | 'api'=> $conf, 56 | 'model'=> 'chatroom', 57 | 'data'=> $Chatroom, 58 | 'verify'=> $verify 59 | ]); 60 | if($error) return $error; 61 | $Chatroom = (new Utils())->rename($Chatroom, [ 62 | 'msgs'=>'objectnames', 63 | ]); 64 | $result = (new Request())->Request($conf['url'],$Chatroom); 65 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 66 | return $result; 67 | } 68 | 69 | /** 70 | * Delete chatroom message whitelist 71 | * 72 | * @param $Chatroom 73 | * $Chatroom = [ 74 | * 'msgs'=> ["RC:TxtMsg"]//Message type list 75 | * ] 76 | * @return array 77 | */ 78 | public function remove(array $Chatroom=[]){ 79 | $conf = $this->conf['remove']; 80 | $verify = $this->verify['demotion'] ; 81 | $error = (new Utils())->check([ 82 | 'api'=> $conf, 83 | 'model'=> 'chatroom', 84 | 'data'=> $Chatroom, 85 | 'verify'=> $verify 86 | ]); 87 | if($error) return $error; 88 | $Chatroom = (new Utils())->rename($Chatroom, [ 89 | 'msgs'=>'objectnames', 90 | ]); 91 | $result = (new Request())->Request($conf['url'],$Chatroom); 92 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 93 | return $result; 94 | } 95 | 96 | /** 97 | * Get the chatroom message whitelist 98 | * 99 | * @param $Chatroom 100 | * $Chatroom = [ 101 | * 102 | * ] 103 | * @return array 104 | */ 105 | public function getList(array $Chatroom=[]){ 106 | $conf = $this->conf['getList']; 107 | $result = (new Request())->Request($conf['url'],$Chatroom); 108 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 109 | if($result['code'] == 200){ 110 | $result = (new Utils())->rename($result,['whitlistmsgType'=>'objectNames']); 111 | 112 | } 113 | return $result; 114 | } 115 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Chatroom/Whitelist/Whitelist.php: -------------------------------------------------------------------------------- 1 | 1, 11 | 'DISCUSSION'=> 2, 12 | 'GROUP'=> 3, 13 | 'CHATROOM'=>4, 14 | 'CUSTOMER_SERVICE'=> 5, 15 | 'SYSTEM'=> 6, 16 | 'APP_PUBLIC'=> 7, 17 | 'PUBLIC'=> 8, 18 | 'ULTRAGROUP'=> 10 19 | ]; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /RongCloud/Lib/Entrust/Entrust.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath . 'api.json'); 46 | $this->verify = Utils::getJson($this->jsonPath . 'verify.json'); 47 | } 48 | 49 | 50 | /** 51 | * Group information module 52 | * 53 | * @return Group 54 | */ 55 | public function Group() 56 | { 57 | return new Group(); 58 | } 59 | 60 | /** 61 | * Group information management module 62 | * 63 | * @return Manager 64 | */ 65 | public function GroupManager() 66 | { 67 | return new Manager(); 68 | } 69 | 70 | /** 71 | * Group information management - remark name module 72 | * 73 | * @return RemarkName 74 | */ 75 | public function GroupRemarkName() 76 | { 77 | return new RemarkName(); 78 | } 79 | 80 | /** 81 | * Group information trustee - member module 82 | * 83 | * @return Member 84 | */ 85 | public function GroupMember() 86 | { 87 | return new Member(); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /RongCloud/Lib/Entrust/Group/Manager/Manager.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'verify.json'); 41 | } 42 | 43 | /** 44 | * Set group administrator (add group administrator) 45 | * 46 | * @param array $param = [ 47 | * 'groupId' => '111', 48 | * 'userIds' => ['123','456'] 49 | * ] 50 | * @return array 51 | */ 52 | public function add(array $param = []) 53 | { 54 | $modelName = 'groupId_userIds'; 55 | $error = (new Utils())->check([ 56 | 'api' => $this->conf['group'], 57 | 'fail' => $this->conf['response']['fail'], 58 | 'model' => $modelName, 59 | 'verify' => $this->verify[$modelName], 60 | 'data' => $param 61 | ]); 62 | if ($error) { 63 | return $error; 64 | } 65 | $result = (new Request())->Request('entrust/group/manager/add', $param); 66 | $result = (new Utils())->responseError($result, $this->conf['response']['fail']); 67 | return $result; 68 | } 69 | 70 | /** 71 | * Remove group administrator 72 | * 73 | * @param array $param = [ 74 | * 'groupId' => '111', 75 | * 'userIds' => ['123','456'] 76 | * ] 77 | * @return array 78 | */ 79 | public function remove(array $param = []) 80 | { 81 | $modelName = 'groupId_userIds'; 82 | $error = (new Utils())->check([ 83 | 'api' => $this->conf['group'], 84 | 'fail' => $this->conf['response']['fail'], 85 | 'model' => $modelName, 86 | 'verify' => $this->verify[$modelName], 87 | 'data' => $param 88 | ]); 89 | if ($error) { 90 | return $error; 91 | } 92 | $result = (new Request())->Request('entrust/group/manager/remove', $param); 93 | $result = (new Utils())->responseError($result, $this->conf['response']['fail']); 94 | return $result; 95 | } 96 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Entrust/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": { 3 | "params": { 4 | "create": { 5 | "groupId": "Group ID, maximum length of 64 characters. Supports combinations of uppercase and lowercase letters and numbers.", 6 | "name": "Group name, maximum length of 64 characters. Group names can be duplicated.", 7 | "owner": "Group Owner. Creator ID, defaults to the group owner ID. This user is automatically added to the group." 8 | }, 9 | "update": { 10 | "groupId": "Group ID, maximum length of 64 characters. Supports combinations of uppercase and lowercase letters and numbers.", 11 | "name": "Group name, maximum length of 64 characters. Group names can be duplicated." 12 | }, 13 | "joinedQuery": { 14 | "userId": "User ID" 15 | }, 16 | "profileQuery": { 17 | "groupIds": "Group ID, maximum of 50 at a time." 18 | }, 19 | "transferOwner": { 20 | "groupId": "Group ID", 21 | "newOwner": "ID of the new group owner" 22 | }, 23 | "groupId": { 24 | "groupId": "Group ID" 25 | }, 26 | "groupId_userId": { 27 | "groupId": "Group ID", 28 | "userId": "Group member ID" 29 | }, 30 | "groupId_userIds": { 31 | "groupId": "Group ID", 32 | "userIds": "User IDs, maximum of 100 at a time" 33 | } 34 | } 35 | }, 36 | "member": { 37 | "params": { 38 | "kickAll": { 39 | "userId": "User ID" 40 | }, 41 | "set": { 42 | "groupId": "Group ID", 43 | "userId": "Group member ID", 44 | "nickname": "Group member nickname, maximum length of 64 characters" 45 | }, 46 | "follow": { 47 | "groupId": "Group ID", 48 | "userId": "Group member ID", 49 | "followUserIds": "Users I Follow ID, maximum of 100 users at a time" 50 | } 51 | } 52 | }, 53 | "remarkName": { 54 | "params": { 55 | "set": { 56 | "groupId": "Group ID", 57 | "userId": "Group member ID", 58 | "remarkName": "Group member nickname, maximum length of 64 characters" 59 | } 60 | } 61 | }, 62 | "response": { 63 | "success": { 64 | "code": "200", 65 | "msg": "Successfully returned" 66 | }, 67 | "fail": { 68 | "1502": { 69 | "code": "1502", 70 | "msg": "{{name}} exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 71 | }, 72 | "1002": { 73 | "code": "1002", 74 | "msg": "{{name}} is a required parameter" 75 | }, 76 | "1501": { 77 | "code": "1501", 78 | "msg": "Incorrect parameter type, please check the parameter type, should be {{type}}, currently is {{currentType}}" 79 | }, 80 | "1004": { 81 | "code": "1004", 82 | "msg": "Signature error, please check if Appkey and Secret are correct" 83 | }, 84 | "1008": { 85 | "code": "1008", 86 | "msg": "Exceeds the limit" 87 | } 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Group/MuteAllMembers/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/group/groupblock#alladd", 4 | "url": "group/ban/add", 5 | "params": { 6 | "group": { 7 | "id": "10001" 8 | } 9 | }, 10 | "response":{ 11 | "success": { 12 | "code": "200", 13 | "msg": "Successfully returned" 14 | }, 15 | "fail": { 16 | "1002": { 17 | "code": "1002", 18 | "msg": "{{name}} is a required parameter" 19 | }, 20 | "1501": { 21 | "code": "1501", 22 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but is currently {{currentType}}" 23 | }, 24 | "1004": { 25 | "code": "1004", 26 | "msg": "Signature error, please verify if Appkey and Secret are correct" 27 | }, 28 | "1008": { 29 | "code": "1008", 30 | "msg": "Call frequency exceeded" 31 | } 32 | } 33 | } 34 | }, 35 | "remove": { 36 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/group/groupblock#allremove", 37 | "url": "group/ban/rollback", 38 | "params": { 39 | "group": { 40 | "id": "10001" 41 | } 42 | }, 43 | "response": { 44 | "success": { 45 | "code": "200", 46 | "msg": "Successfully returned" 47 | }, 48 | "fail": { 49 | "1002": { 50 | "code": "1002", 51 | "msg": "{{name}} is a required parameter" 52 | }, 53 | "1501": { 54 | "code": "1501", 55 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but is currently {{currentType}}" 56 | }, 57 | "1004": { 58 | "code": "1004", 59 | "msg": "Signature error, please verify if Appkey and Secret are correct" 60 | }, 61 | "1008": { 62 | "code": "1008", 63 | "msg": "Call frequency exceeded" 64 | } 65 | } 66 | } 67 | }, 68 | "getList": { 69 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/group/groupblock#allget", 70 | "url": "group/ban/query", 71 | "params": { 72 | "group": { 73 | 74 | } 75 | }, 76 | "response":{ 77 | "success": { 78 | "code": "200", 79 | "users": [{ 80 | "time": "2015-09-25 16:12:38", 81 | "member": { 82 | "id": "2582" 83 | } 84 | }] 85 | }, 86 | "fail": { 87 | "1005": { 88 | "code": "1005", 89 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 90 | }, 91 | "1002": { 92 | "code": "1002", 93 | "msg": "{{name}} is a required parameter" 94 | }, 95 | "1501": { 96 | "code": "1501", 97 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but is currently {{currentType}}" 98 | }, 99 | "1004": { 100 | "code": "1004", 101 | "msg": "Signature error, please verify if Appkey and Secret are correct" 102 | }, 103 | "1008": { 104 | "code": "1008", 105 | "msg": "Call frequency exceeded" 106 | } 107 | } 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Group/Remark/Remark.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 41 | } 42 | 43 | /** 44 | * Add group remark 45 | * 46 | * @param array $User 47 | * @param 48 | * $User = [ 49 | * 'userId'=> 'userId',//User ID 50 | * 'groupId'=> 'groupId',//Group ID 51 | * 'remark'=> 'Remark'//Group remark 52 | * ]; 53 | * @return array 54 | */ 55 | public function set(array $Group=[]){ 56 | $conf = $this->conf['set']; 57 | $error = (new Utils())->check([ 58 | 'api'=> $conf, 59 | 'model'=> 'group', 60 | 'data'=> $Group, 61 | 'verify'=> $this->verify['remark'] 62 | ]); 63 | if($error) return $error; 64 | $result = (new Request())->Request($conf['url'],$Group); 65 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 66 | return $result; 67 | } 68 | 69 | /** 70 | * Delete group remark 71 | * 72 | * @param array $User 73 | * @param 74 | * $User = [ 75 | * 'userId'=> 'ujadk90ha1',//User ID 76 | * 'groupId'=> 'targetUserid'//Group ID 77 | * ]; 78 | * @return array 79 | */ 80 | public function del(array $Group=[]){ 81 | $conf = $this->conf['del']; 82 | $error = (new Utils())->check([ 83 | 'api'=> $conf, 84 | 'model'=> 'group', 85 | 'data'=> $Group, 86 | 'verify'=> $this->verify['remark'] 87 | ]); 88 | if($error) return $error; 89 | $result = (new Request())->Request($conf['url'],$Group); 90 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 91 | return $result; 92 | } 93 | 94 | /** 95 | * Get group annotation 96 | * @param array $User 97 | * @param 98 | * $User = [ 99 | * 'userId'=> 'ujadk90ha1',//User ID 100 | * 'groupId'=> 'groupId'//Group ID 101 | * ]; 102 | * @return array 103 | * @return array 104 | */ 105 | public function get(array $Group=[]){ 106 | $conf = $this->conf['get']; 107 | $error = (new Utils())->check([ 108 | 'api'=> $conf, 109 | 'model'=> 'group', 110 | 'data'=> $Group, 111 | 'verify'=> $this->verify['remark'] 112 | ]); 113 | if($error) return $error; 114 | $result = (new Request())->Request($conf['url'],$Group); 115 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 116 | return $result; 117 | } 118 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Group/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | "id": { 14 | "require": { 15 | "must": true, 16 | "invalid": "1002" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "1005" 22 | } 23 | }, 24 | "members": { 25 | "require": { 26 | "must": true, 27 | "invalid": "1002" 28 | }, 29 | "typeof": { 30 | "type": "array", 31 | "invalid": "1501" 32 | }, 33 | "length": { 34 | "max": 99999999999, 35 | "min": 1, 36 | "invalid": "1005" 37 | } 38 | }, 39 | "name": { 40 | "require": { 41 | "must": true, 42 | "invalid": "1002" 43 | }, 44 | "length": { 45 | "max": 64, 46 | "min": 1, 47 | "invalid": "1005" 48 | } 49 | } 50 | }, 51 | "user":{ 52 | "id": { 53 | "require": { 54 | "must": true, 55 | "invalid": "1002" 56 | }, 57 | "length": { 58 | "max": 64, 59 | "min": 1, 60 | "invalid": "1005" 61 | } 62 | }, 63 | "groups":{ 64 | "require": { 65 | "must": true, 66 | "invalid": "1002" 67 | }, 68 | "typeof": { 69 | "type": "array", 70 | "invalid": "1501" 71 | } 72 | } 73 | }, 74 | "minute": { 75 | "require": { 76 | "must": true, 77 | "invalid": "1002" 78 | }, 79 | "size": { 80 | "max": 43200, 81 | "min": 0, 82 | "invalid": "1502" 83 | }, 84 | "typeof": { 85 | "type": "number", 86 | "invalid": "1501" 87 | } 88 | }, 89 | "member":{ 90 | "member": { 91 | "require": { 92 | "must": true, 93 | "invalid": "1002" 94 | } 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/Broadcast/Broadcast.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 38 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 39 | } 40 | 41 | /** 42 | * @param array $Message Broadcast message recall 43 | * @param 44 | * $message = [ 45 | * 'senderId'=> 'test',// Sender ID 46 | * "objectName"=>'RC:RcCmd',// Message type 47 | * 'content'=>[ 48 | * 'uId'=>'xxxxx',// Unique message identifier, obtained after sending a broadcast message via /push, returned as id. 49 | * 'type'=>'SYSTEM',// System session 50 | * 'isAdmin'=>'0',// Whether it is an administrator, default is 0; when set to 1, the IMKit SDK will display a gray bar as "Admin recalled a message" upon receiving this message. 51 | * 'isDelete'=>0]// Whether to delete the message, default is 0. When recalling this message, the client will delete it and replace it with a gray bar recall prompt message; when set to 1, the message will be deleted without being replaced by a gray bar prompt message. 52 | * ]; 53 | * @return array 54 | */ 55 | public function recall(array $Message=[]){ 56 | $conf = $this->conf['broadcast']; 57 | $verify = $this->verify['broadcast']; 58 | if(isset($verify['targetId'])){ 59 | unset($verify['targetId']); 60 | } 61 | $error = (new Utils())->check([ 62 | 'api'=> $conf, 63 | 'model'=> 'message', 64 | 'data'=> $Message, 65 | 'verify'=> $verify 66 | ]); 67 | if($error) return $error; 68 | $Message['content'] = isset($Message['content'])?json_decode($Message['content'],true):[]; 69 | $content = $Message['content']; 70 | $Message = (new Utils())->rename($Message, [ 71 | 'senderId'=> 'fromUserId', 72 | ]); 73 | $content = (new Utils())->rename($content , [ 74 | 'uId'=>'messageUId' 75 | ]); 76 | $content['conversationType'] = 6; 77 | $Message['content'] = json_encode($content); 78 | $result = (new Request())->Request($conf['url'],$Message); 79 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 80 | return $result; 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/Discussion/Discussion.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 33 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; 34 | } 35 | 36 | /** 37 | * @param array $Message Discussion group message sending 38 | * @param 39 | * $Message = [ 40 | * 'senderId'=> 'ujadk90ha',//Sender ID 41 | * 'targetId'=> ['kkj9o01'],//Discussion group, multiple IDs 42 | * "objectName"=>'RC:TxtMsg',//Message type Text 43 | * 'content'=>json_encode(['content'=>'Hello, host'])//Message Body 44 | * ]; 45 | * @return array 46 | */ 47 | public function send($Message){ 48 | $conf = $this->conf['send']; 49 | $error = (new Utils())->check([ 50 | 'api'=> $conf, 51 | 'model'=> 'message', 52 | 'data'=> $Message, 53 | 'verify'=> $this->verify['message'] 54 | ]); 55 | if($error) return $error; 56 | $Message = (new Utils())->rename($Message, [ 57 | 'senderId'=> 'fromUserId', 58 | 'targetId'=> 'toChatroomId' 59 | ]); 60 | $result = (new Request())->Request($conf['url'],$Message); 61 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 62 | return $result; 63 | } 64 | 65 | /** 66 | * @param array $Message Discussion group broadcast message 67 | * @param 68 | * $Message = [ 69 | * 'senderId'=> 'ujadk90ha',//Sender ID 70 | * "objectName"=>'RC:TxtMsg',//Message type: text 71 | * 'content'=>json_encode(['content'=>'Hello, host']) //Message Body 72 | * ]; 73 | * @return array 74 | */ 75 | public function broadcast($Message){ 76 | $conf = $this->conf['broadcast']; 77 | $error = (new Utils())->check([ 78 | 'api'=> $conf, 79 | 'model'=> 'message', 80 | 'data'=> $Message, 81 | 'verify'=> $this->verify['message'] 82 | ]); 83 | if($error) return $error; 84 | $Message = (new Utils())->rename($Message, [ 85 | 'senderId'=> 'fromUserId', 86 | ]); 87 | $result = (new Request())->Request($conf['url'],$Message); 88 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 89 | return $result; 90 | } 91 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/Discussion/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "send": { 3 | "url": "message/discussion/publish", 4 | "params": { 5 | "message": { 6 | "senderId": "2191", 7 | "targetId": "2192", 8 | "objectName": "RC:TxterrorMessage", 9 | "content": { 10 | "content": "hello" 11 | } 12 | } 13 | }, 14 | "response": { 15 | "success": { 16 | "code": "200", 17 | "msg": "Successfully returned" 18 | }, 19 | "fail": { 20 | "1502": { 21 | "code": "1502", 22 | "msg": "{{name}} quantity exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 23 | }, 24 | "1005": { 25 | "code": "1005", 26 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 27 | }, 28 | "1002": { 29 | "code": "1002", 30 | "msg": "{{name}} parameter is required" 31 | }, 32 | "1501": { 33 | "code": "1501", 34 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 35 | }, 36 | "1004": { 37 | "code": "1004", 38 | "msg": "Signature error, please verify if Appkey and Secret are correct" 39 | }, 40 | "1008": { 41 | "code": "1008", 42 | "msg": "Call frequency exceeds limit" 43 | } 44 | } 45 | } 46 | }, 47 | "recall": { 48 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/msgrecall#recall", 49 | "url": "message/recall", 50 | "params": { 51 | "message": { 52 | "senderId": "fDR2cVpxxR5zSMUNh3yAwh", 53 | "targetId": "MersNRhaKwJkRV9mJR5JXY", 54 | "uId": "5FGT-7VA9-G4DD-4V5P", 55 | "sentTime": "1507778882124" 56 | } 57 | }, 58 | "response": { 59 | "success": { 60 | "code": "200", 61 | "msg": "Successfully returned" 62 | }, 63 | "fail": { 64 | "1502": { 65 | "code": "1502", 66 | "msg": "{{name}} quantity exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 67 | }, 68 | "1005": { 69 | "code": "1005", 70 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 71 | }, 72 | "1002": { 73 | "code": "1002", 74 | "msg": "{{name}} parameter is required" 75 | }, 76 | "1501": { 77 | "code": "1501", 78 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 79 | }, 80 | "1004": { 81 | "code": "1004", 82 | "msg": "Signature error, please verify if Appkey and Secret are correct" 83 | }, 84 | "1008": { 85 | "code": "1008", 86 | "msg": "Call frequency exceeds limit" 87 | } 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/Expansion/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#set", 4 | "url": "message/expansion/set", 5 | "params": { 6 | "expansion": { 7 | "msgUID": "aFo990k", 8 | "userId": "aFo990k", 9 | "conversationType": "aFo990k", 10 | "targetId": "aFo990k", 11 | "extraKeyVal": "aFo990k" 12 | } 13 | }, 14 | "response": { 15 | "success": { 16 | "code": "200", 17 | "msg": "Successfully returned" 18 | }, 19 | "fail": { 20 | "1501": { 21 | "code": "1501", 22 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}}, currently {{currentType}}" 23 | }, 24 | "1002": { 25 | "code": "1002", 26 | "msg": "{{name}} parameter is required" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "msg": "Signature error, please verify if Appkey and Secret are correct" 31 | } 32 | } 33 | } 34 | }, 35 | "remove": { 36 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#delete", 37 | "url": "message/expansion/delete", 38 | "params": { 39 | "expansion": { 40 | "msgUID": "aFo990k", 41 | "userId": "aFo990k", 42 | "conversationType": "aFo990k", 43 | "targetId": "aFo990k", 44 | "extraKey": "aFo990k" 45 | } 46 | }, 47 | "response": { 48 | "success": { 49 | "code": "200", 50 | "msg": "Successfully returned" 51 | }, 52 | "fail": { 53 | "1501": { 54 | "code": "1501", 55 | "msg": "Incorrect minute parameter, please check the parameter type, it should be number, currently {{currentType}}" 56 | }, 57 | "1002": { 58 | "code": "1002", 59 | "msg": "{{name}} parameter is required" 60 | }, 61 | "1004": { 62 | "code": "1004", 63 | "msg": "Signature error, please verify if Appkey and Secret are correct" 64 | } 65 | } 66 | } 67 | }, 68 | "getList": { 69 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#query", 70 | "url": "message/expansion/query", 71 | "params": { 72 | "expansion": { 73 | "msgUID": "aFo990k" 74 | } 75 | }, 76 | "response": { 77 | "success": { 78 | "code": "200", 79 | "msg": "Successfully returned" 80 | }, 81 | "fail": { 82 | "1004": { 83 | "code": "1004", 84 | "msg": "Signature error, please verify if Appkey and Secret are correct" 85 | } 86 | } 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/History/History.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 33 | $this->verify = Utils::getJson($this->jsonPath.'verify.json');; 34 | } 35 | 36 | /** 37 | * @param array $Message History message retrieval 38 | * @param 39 | * $Message = [ 40 | * 'date'=> '2018030613',//Date 41 | * ]; 42 | * @return array 43 | */ 44 | public function get(array $Message=[]){ 45 | $conf = $this->conf['get']; 46 | $error = (new Utils())->check([ 47 | 'api'=> $conf, 48 | 'model'=> 'message', 49 | 'data'=> $Message, 50 | 'verify'=> $this->verify['message'] 51 | ]); 52 | if($error) return $error; 53 | $result = (new Request())->Request($conf['url'],$Message); 54 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 55 | return $result; 56 | } 57 | 58 | /** 59 | * @param array $Message History message file deletion 60 | * @param 61 | * $Message = [ 62 | * 'date'=> '2018030613',//Date 63 | * ]; 64 | * @return array 65 | */ 66 | public function remove(array $User=[]){ 67 | $conf = $this->conf['remove']; 68 | $error = (new Utils())->check([ 69 | 'api'=> $conf, 70 | 'model'=> 'message', 71 | 'data'=> $User, 72 | 'verify'=> $this->verify['message'] 73 | ]); 74 | if($error) return $error; 75 | $result = (new Request())->Request($conf['url'],$User); 76 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 77 | return $result; 78 | } 79 | 80 | /** 81 | * @param array $Message Message clearance 82 | * @param 83 | * $Message = [ 84 | * 'conversationType'=> '1',//Conversation type, supports single chat, group chat, system message. Single chat is 1, group chat is 3, system notification is 6 85 | * 'fromUserId'=>"fromUserId",//User ID, delete the specified user's historical messages before the msgTimestamp 86 | * 'targetId'=>"userId",//Target conversation ID that needs to be cleared 87 | * 'msgTimestamp'=>"16888383883222",//Clear all historical messages before this timestamp, accurate to milliseconds, leave empty to clear all historical messages of the conversation. 88 | * 89 | * ]; 90 | * @return array 91 | */ 92 | public function clean(array $User=[]){ 93 | $conf = $this->conf['clean']; 94 | $error = (new Utils())->check([ 95 | 'api'=> $conf, 96 | 'model'=> 'message', 97 | 'data'=> $User, 98 | 'verify'=> $this->verify['clean'] 99 | ]); 100 | if($error) return $error; 101 | $result = (new Request())->Request($conf['url'],$User); 102 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 103 | return $result; 104 | } 105 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/History/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "get": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/storage#getmsglog", 4 | "url": "message/history", 5 | "params": { 6 | "message": { 7 | "date": "2017010101" 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": "200", 13 | "msg": "Successfully returned" 14 | }, 15 | "fail": { 16 | "1004": { 17 | "code": "1004", 18 | "msg": "Signature error, please check if Appkey and Secret are correct" 19 | }, 20 | "1008": { 21 | "code": "1008", 22 | "msg": "Call frequency limit exceeded" 23 | }, 24 | "1002": { 25 | "code": "1002", 26 | "msg": "{{name}} parameter is required" 27 | }, 28 | "1501": { 29 | "code": "1501", 30 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 31 | } 32 | } 33 | } 34 | }, 35 | "remove": { 36 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/storage#delmsglog", 37 | "url": "message/history/delete", 38 | "params": { 39 | "message": { 40 | "date": "2017010101" 41 | } 42 | }, 43 | "response": { 44 | "success": { 45 | "code": "200", 46 | "msg": "Successfully returned" 47 | }, 48 | "fail": { 49 | "1004": { 50 | "code": "1004", 51 | "msg": "Signature error, please check if Appkey and Secret are correct" 52 | }, 53 | "1008": { 54 | "code": "1008", 55 | "msg": "Call frequency limit exceeded" 56 | }, 57 | "1002": { 58 | "code": "1002", 59 | "msg": "{{name}} parameter is required" 60 | }, 61 | "1501": { 62 | "code": "1501", 63 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 64 | } 65 | } 66 | } 67 | }, 68 | "clean": { 69 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/delete#output", 70 | "url": "conversation/message/history/clean", 71 | "params": { 72 | "clean": { 73 | "conversationType": "1", 74 | "fromUserId": "1", 75 | "targetId": "1", 76 | "msgTimestamp": "1" 77 | } 78 | }, 79 | "response": { 80 | "success": { 81 | "code": "200", 82 | "msg": "Successfully returned" 83 | }, 84 | "fail": { 85 | "1004": { 86 | "code": "1004", 87 | "msg": "Signature error, please check if Appkey and Secret are correct" 88 | }, 89 | "1008": { 90 | "code": "1008", 91 | "msg": "Call frequency limit exceeded" 92 | }, 93 | "1002": { 94 | "code": "1002", 95 | "msg": "{{name}} parameter is required" 96 | }, 97 | "1501": { 98 | "code": "1501", 99 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 100 | } 101 | } 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/History/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": { 3 | "date": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | } 8 | } 9 | }, 10 | "clean": { 11 | "conversationType": { 12 | "require": { 13 | "must": true, 14 | "invalid": "1002" 15 | } 16 | }, 17 | "fromUserId": { 18 | "require": { 19 | "must": true, 20 | "invalid": "1002" 21 | } 22 | }, 23 | "targetId": { 24 | "require": { 25 | "must": true, 26 | "invalid": "1002" 27 | } 28 | }, 29 | "msgTimestamp": { 30 | "require": { 31 | "must": true, 32 | "invalid": "1002" 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Message/Message.php: -------------------------------------------------------------------------------- 1 | hejinyu 5 | */ 6 | namespace RongCloud\Lib\Push; 7 | 8 | use RongCloud\Lib\Request; 9 | use RongCloud\Lib\Utils; 10 | class Push 11 | { 12 | /** 13 | * Push module path 14 | * 15 | * @var string 16 | */ 17 | private $jsonPath = 'Lib/Push/'; 18 | 19 | /** 20 | * Request configuration file 21 | * 22 | * @var string 23 | * 24 | */ 25 | private $conf = ''; 26 | 27 | /** 28 | * Verify configuration file 29 | * 30 | * @var string 31 | */ 32 | private $verify = ''; 33 | 34 | /** 35 | * Push constructor. 36 | */ 37 | function __construct() 38 | { 39 | $this->conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'verify.json'); 41 | } 42 | 43 | /** 44 | * Broadcast Message 45 | * 46 | * @param array $Push Push parameters 47 | * @param 48 | * $Push = [ 49 | * 'platform'=> ['ios','android'],//Target operating systems 50 | * 'fromuserid'=>'mka091amn',//Sender user ID 51 | * 'audience'=>['is_to_all'=>true],//Push conditions, including: tag, userid, is_to_all. 52 | * 'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],//Message content to be sent 53 | * 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']]//Push display 54 | * ]; 55 | * @return array 56 | */ 57 | public function broadcast(array $Push=[]){ 58 | $conf = $this->conf['broadcast']; 59 | $error = (new Utils())->check([ 60 | 'api'=> $conf, 61 | 'model'=> 'broadcast', 62 | 'data'=> $Push, 63 | 'verify'=> $this->verify['broadcast'] 64 | ]); 65 | if($error) return $error; 66 | $result = (new Request())->Request($conf['url'],$Push,'json'); 67 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 68 | return $result; 69 | } 70 | 71 | /** 72 | * push 73 | * 74 | * @param Push $Push parameter 75 | * @param 76 | * $Push = [ 77 | * 'platform'=> ['ios','android'],//Target operating systems 78 | * 'audience'=>['is_to_all'=>true],//Push conditions, including: tag, userid, is_to_all. 79 | * 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']]//Push display 80 | * ]; 81 | * @return array 82 | */ 83 | public function push(array $Push=[]){ 84 | $conf = $this->conf['push']; 85 | $error = (new Utils())->check([ 86 | 'api'=> $conf, 87 | 'model'=> 'broadcast', 88 | 'data'=> $Push, 89 | 'verify'=> $this->verify['push'] 90 | ]); 91 | if($error) return $error; 92 | $result = (new Request())->Request($conf['url'],$Push,'json'); 93 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 94 | return $result; 95 | } 96 | 97 | 98 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Push/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "broadcast": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "20005" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "20001" 11 | } 12 | }, 13 | "fromuserid": { 14 | "require": { 15 | "must": true, 16 | "invalid": "20005" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "20003" 22 | } 23 | }, 24 | "platform": { 25 | "require": { 26 | "must": true, 27 | "invalid": "20005" 28 | }, 29 | "size": { 30 | "max": 2, 31 | "min": 1, 32 | "invalid": "20002" 33 | }, 34 | "typeof": { 35 | "type": "array", 36 | "invalid": "20001" 37 | } 38 | }, 39 | "message": { 40 | "require": { 41 | "must": true, 42 | "invalid": "20005" 43 | }, 44 | "typeof": { 45 | "type": "object", 46 | "invalid": "20001" 47 | } 48 | }, 49 | "audience": { 50 | "require": { 51 | "must": true, 52 | "invalid": "20005" 53 | }, 54 | "typeof": { 55 | "type": "object", 56 | "invalid": "20001" 57 | } 58 | }, 59 | "notification": { 60 | "require": { 61 | "must": true, 62 | "invalid": "20005" 63 | }, 64 | "typeof": { 65 | "type": "object", 66 | "invalid": "20001" 67 | } 68 | } 69 | }, 70 | "push": { 71 | "_self": { 72 | "require": { 73 | "must": true, 74 | "invalid": "20005" 75 | }, 76 | "typeof": { 77 | "type": "object", 78 | "invalid": "20001" 79 | } 80 | }, 81 | "platform": { 82 | "require": { 83 | "must": true, 84 | "invalid": "20005" 85 | }, 86 | "size": { 87 | "max": 2, 88 | "min": 1, 89 | "invalid": "20002" 90 | }, 91 | "typeof": { 92 | "type": "array", 93 | "invalid": "20001" 94 | } 95 | }, 96 | "audience": { 97 | "require": { 98 | "must": true, 99 | "invalid": "20005" 100 | }, 101 | "typeof": { 102 | "type": "object", 103 | "invalid": "20001" 104 | } 105 | }, 106 | "notification": { 107 | "require": { 108 | "must": true, 109 | "invalid": "20005" 110 | }, 111 | "typeof": { 112 | "type": "object", 113 | "invalid": "20001" 114 | } 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Sensitive/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "rule": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | "keyword": { 14 | "require": { 15 | "must": true, 16 | "invalid": "1002" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "1005" 22 | } 23 | }, 24 | "replace": { 25 | "length": { 26 | "max": 64, 27 | "min": 0, 28 | "invalid": "1005" 29 | } 30 | } 31 | }, 32 | "sensitive": { 33 | "_self": { 34 | "require": { 35 | "must": true, 36 | "invalid": "1002" 37 | }, 38 | "typeof": { 39 | "type": "object", 40 | "invalid": "1501" 41 | } 42 | }, 43 | "keywords": { 44 | "require": { 45 | "must": true, 46 | "invalid": "1002" 47 | } 48 | } 49 | }, 50 | "batchAdd": { 51 | "_self": { 52 | "require": { 53 | "must": true, 54 | "invalid": "1002" 55 | }, 56 | "typeof": { 57 | "type": "object", 58 | "invalid": "1501" 59 | } 60 | }, 61 | "words": { 62 | "require": { 63 | "must": true, 64 | "invalid": "1002" 65 | }, 66 | "typeof": { 67 | "type": "array", 68 | "invalid": "1501" 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Ultragroup/Expansion/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#set", 4 | "url": "ultragroup/message/expansion/set", 5 | "params": { 6 | "expansion": { 7 | "msgUID": "aFo990k", 8 | "userId": "aFo990k", 9 | "groupId": "aFo990k", 10 | "extraKeyVal": "aFo990k", 11 | "busChannel": "busChannel" 12 | } 13 | }, 14 | "response": { 15 | "success": { 16 | "code": "200", 17 | "msg": "Successfully returned" 18 | }, 19 | "fail": { 20 | "1501": { 21 | "code": "1501", 22 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 23 | }, 24 | "1002": { 25 | "code": "1002", 26 | "msg": "{{name}} parameter is required" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "msg": "Signature error, please verify if Appkey and Secret are correct" 31 | } 32 | } 33 | } 34 | }, 35 | "remove": { 36 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#delete", 37 | "url": "ultragroup/message/expansion/delete", 38 | "params": { 39 | "expansion": { 40 | "msgUID": "aFo990k", 41 | "extraKey": "aFo990k", 42 | "userId": "aFo990k", 43 | "groupId": "aFo990k", 44 | "busChannel": "busChannel" 45 | } 46 | }, 47 | "response": { 48 | "success": { 49 | "code": "200", 50 | "msg": "Successfully returned" 51 | }, 52 | "fail": { 53 | "1501": { 54 | "code": "1501", 55 | "msg": "Incorrect minute parameter, please check the parameter type, it should be number but currently is {{currentType}}" 56 | }, 57 | "1002": { 58 | "code": "1002", 59 | "msg": "{{name}} parameter is required" 60 | }, 61 | "1004": { 62 | "code": "1004", 63 | "msg": "Signature error, please verify if Appkey and Secret are correct" 64 | } 65 | } 66 | } 67 | }, 68 | "getList": { 69 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/message/expansion#query", 70 | "url": "ultragroup/message/expansion/query", 71 | "params": { 72 | "expansion": { 73 | "msgUID": "aFo990k", 74 | "groupId": "aFo990k", 75 | "busChannel": "busChannel", 76 | "pageNo": 1 77 | } 78 | }, 79 | "response": { 80 | "success": { 81 | "code": "200", 82 | "msg": "Successfully returned" 83 | }, 84 | "fail": { 85 | "1004": { 86 | "code": "1004", 87 | "msg": "Signature error, please verify if Appkey and Secret are correct" 88 | } 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Ultragroup/MuteAllMembers/MuteAllMembers.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 39 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 40 | } 41 | 42 | /** 43 | * Set super group ban 44 | * 45 | * @param array $Group Add super group ban parameters 46 | * @param 47 | * $Group = [ 48 | * 'id'=> 'ujadk90ha', // Super group id 49 | * 'busChannel'=> 'busid', // Channel id can be empty 50 | * 'status'=> true, // Ultra group ban status true for ban 0 for cancel 51 | * ]; 52 | * @return array 53 | */ 54 | public function set(array $Group=[]){ 55 | $conf = $this->conf['add']; 56 | $verify = $this->verify['group']; 57 | $verify = ['id'=>$verify['id']]; 58 | $error = (new Utils())->check([ 59 | 'api'=> $conf, 60 | 'model'=> 'group', 61 | 'data'=> $Group, 62 | 'verify'=> $verify 63 | ]); 64 | if($error) return $error; 65 | $Group = (new Utils())->rename($Group, [ 66 | 'id'=> 'groupId', 67 | ]); 68 | $result = (new Request())->Request($conf['url'],$Group); 69 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 70 | return $result; 71 | } 72 | 73 | /** 74 | * Query the mute status of a super group 75 | * 76 | * @param array $Group ultra group parameter 77 | * @param 78 | * $Group = [ 79 | * 'id'=> 'ujadk90ha',//super group id 80 | * 'busChannel'=> 'busid',//channel id can be empty 81 | * ]; 82 | * @return array 83 | */ 84 | public function get(array $Group=[]){ 85 | $conf = $this->conf['get']; 86 | $verify = $this->verify['group']; 87 | $verify = ['id'=>$verify['id']]; 88 | $error = (new Utils())->check([ 89 | 'api'=> $conf, 90 | 'model'=> 'group', 91 | 'data'=> $Group, 92 | 'verify'=> $verify 93 | ]); 94 | if($error) return $error; 95 | $Group = (new Utils())->rename($Group, [ 96 | 'id'=> 'groupId', 97 | ]); 98 | $result = (new Request())->Request($conf['url'],$Group); 99 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 100 | return $result; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /RongCloud/Lib/Ultragroup/MuteAllMembers/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/group/groupblock#alladd", 4 | "url": "ultragroup/globalbanned/set", 5 | "params": { 6 | "group": { 7 | "id": "10001", 8 | "status":true 9 | } 10 | }, 11 | "response":{ 12 | "success": { 13 | "code": "200", 14 | "msg": "Success" 15 | }, 16 | "fail": { 17 | "1002": { 18 | "code": "1002", 19 | "msg": "{{name}} is a required parameter" 20 | }, 21 | "1501": { 22 | "code": "1501", 23 | "msg": "Incorrect parameter type, expected {{type}} but got {{currentType}}" 24 | }, 25 | "1004": { 26 | "code": "1004", 27 | "msg": "Signature error, please check if Appkey and Secret are correct" 28 | }, 29 | "1008": { 30 | "code": "1008", 31 | "msg": "Request frequency exceeded" 32 | } 33 | } 34 | } 35 | }, 36 | "get": { 37 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/group/groupblock#allget", 38 | "url": "ultragroup/globalbanned/get", 39 | "params": { 40 | "group": { 41 | "id": "groupId" 42 | } 43 | }, 44 | "response":{ 45 | "success": { 46 | "code": "200", 47 | "status": 1 48 | }, 49 | "fail": { 50 | "1005": { 51 | "code": "1005", 52 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 53 | }, 54 | "1002": { 55 | "code": "1002", 56 | "msg": "{{name}} is a required parameter" 57 | }, 58 | "1501": { 59 | "code": "1501", 60 | "msg": "Incorrect parameter type, expected {{type}} but got {{currentType}}" 61 | }, 62 | "1004": { 63 | "code": "1004", 64 | "msg": "Signature error, please check if Appkey and Secret are correct" 65 | }, 66 | "1008": { 67 | "code": "1008", 68 | "msg": "Request frequency exceeded" 69 | } 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Ultragroup/Notdisturb/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/ultragroup/set-do-not-disturb", 4 | "url": "ultragroup/notdisturb/set", 5 | "params": { 6 | "group": { 7 | "id": "10001", 8 | "unpushLevel":1 9 | } 10 | }, 11 | "response":{ 12 | "success": { 13 | "code": "200", 14 | "msg": "Success" 15 | }, 16 | "fail": { 17 | "1002": { 18 | "code": "1002", 19 | "msg": "{{name}} is a required parameter" 20 | }, 21 | "1501": { 22 | "code": "1501", 23 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 24 | }, 25 | "1004": { 26 | "code": "1004", 27 | "msg": "Signature error, please verify if Appkey and Secret are correct" 28 | }, 29 | "1008": { 30 | "code": "1008", 31 | "msg": "Call frequency exceeded the limit" 32 | } 33 | } 34 | } 35 | }, 36 | "get": { 37 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/ultragroup/get-do-not-disturb", 38 | "url": "ultragroup/notdisturb/get", 39 | "params": { 40 | "group": { 41 | "id": "groupId" 42 | } 43 | }, 44 | "response":{ 45 | "success": { 46 | "code": "200", 47 | "status": 1 48 | }, 49 | "fail": { 50 | "1005": { 51 | "code": "1005", 52 | "msg": "{{name}} length exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 53 | }, 54 | "1002": { 55 | "code": "1002", 56 | "msg": "{{name}} is a required parameter" 57 | }, 58 | "1501": { 59 | "code": "1501", 60 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 61 | }, 62 | "1004": { 63 | "code": "1004", 64 | "msg": "Signature error, please verify if Appkey and Secret are correct" 65 | }, 66 | "1008": { 67 | "code": "1008", 68 | "msg": "Call frequency exceeded the limit" 69 | } 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /RongCloud/Lib/Ultragroup/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | "id": { 14 | "require": { 15 | "must": true, 16 | "invalid": "1002" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "1005" 22 | } 23 | }, 24 | "busChannel": { 25 | "require": { 26 | "must": true, 27 | "invalid": "1002" 28 | }, 29 | "length": { 30 | "max": 20, 31 | "min": 1, 32 | "invalid": "1005" 33 | } 34 | }, 35 | "members": { 36 | "require": { 37 | "must": true, 38 | "invalid": "1002" 39 | }, 40 | "typeof": { 41 | "type": "array", 42 | "invalid": "1501" 43 | }, 44 | "length": { 45 | "max": 99999999999, 46 | "min": 1, 47 | "invalid": "1005" 48 | } 49 | }, 50 | "name": { 51 | "require": { 52 | "must": true, 53 | "invalid": "1002" 54 | }, 55 | "length": { 56 | "max": 64, 57 | "min": 1, 58 | "invalid": "1005" 59 | } 60 | } 61 | }, 62 | "user":{ 63 | "id": { 64 | "require": { 65 | "must": true, 66 | "invalid": "1002" 67 | }, 68 | "length": { 69 | "max": 64, 70 | "min": 1, 71 | "invalid": "1005" 72 | } 73 | }, 74 | "groups":{ 75 | "require": { 76 | "must": true, 77 | "invalid": "1002" 78 | }, 79 | "typeof": { 80 | "type": "array", 81 | "invalid": "1501" 82 | } 83 | } 84 | }, 85 | "member":{ 86 | "member": { 87 | "require": { 88 | "must": true, 89 | "invalid": "1002" 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Block/Block.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 41 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 42 | } 43 | 44 | /** 45 | * Add banned user 46 | * 47 | * @param array $User Banned user parameters 48 | * @param 49 | * $User = [ 50 | * 'id'=> 'ujadk90ha1',// Banned user ID, unique identifier, maximum length 30 characters 51 | * 'minute'=> 20 // Ban duration 1 - 1 * 30 * 24 * 60 minutes 52 | * ]; 53 | * @return array 54 | */ 55 | public function add(array $User=[]){ 56 | $conf = $this->conf['add']; 57 | $error = (new Utils())->check([ 58 | 'api'=> $conf, 59 | 'model'=> 'user', 60 | 'data'=> $User, 61 | 'verify'=> $this->verify['user'] 62 | ]); 63 | if($error) return $error; 64 | $User = (new Utils())->rename($User, [ 65 | 'id'=> 'userId', 66 | ]); 67 | $result = (new Request())->Request($conf['url'],$User); 68 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 69 | return $result; 70 | } 71 | 72 | /** 73 | * Unblock user 74 | * 75 | * @param array $User Unblock parameters 76 | * @param 77 | * $user = [ 78 | * 'id'=> 'ujadk90ha',//Unblock user ID, unique identifier, maximum length 30 characters 79 | * ]; 80 | * @return array 81 | */ 82 | public function remove(array $User=[]){ 83 | $conf = $this->conf['remove']; 84 | $error = (new Utils())->check([ 85 | 'api'=> $conf, 86 | 'model'=> 'user', 87 | 'data'=> $User, 88 | 'verify'=> $this->verify['user'] 89 | ]); 90 | if($error) return $error; 91 | $User = (new Utils())->rename($User, [ 92 | 'id'=> 'userId', 93 | ]); 94 | $result = (new Request())->Request($conf['url'],$User); 95 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 96 | return $result; 97 | } 98 | 99 | /** 100 | * Get the list of banned users 101 | * 102 | * @param array $User Banned user list parameter 103 | * @param 104 | * $user = [ 105 | * ]; 106 | * @return array 107 | */ 108 | public function getList(array $User=[]){ 109 | $conf = $this->conf['getList']; 110 | $result = (new Request())->Request($conf['url'],$User); 111 | // foreach ($result['']) 112 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 113 | return $result; 114 | } 115 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Block/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blockadd", 4 | "url": "user/block", 5 | "params": { 6 | "user": { 7 | "id": "aFo990k", 8 | "minute": 30 9 | } 10 | }, 11 | "response": { 12 | "success": { 13 | "code": "200", 14 | "msg": "Successfully returned" 15 | }, 16 | "fail": { 17 | "1502": { 18 | "code": "1502", 19 | "msg": "Invalid ban duration, current input is {{size}}, valid range is 1 - 1 * 30 * 24 * 60 minutes" 20 | }, 21 | "1501": { 22 | "code": "1501", 23 | "msg": "Invalid parameter type, please check the parameter type, it should be {{type}}, currently {{currentType}}" 24 | }, 25 | "1002": { 26 | "code": "1002", 27 | "msg": "{{name}} parameter is required" 28 | }, 29 | "1004": { 30 | "code": "1004", 31 | "msg": "Signature error, please verify if Appkey and Secret are correct" 32 | }, 33 | "1008": { 34 | "code": "1008", 35 | "msg": "Request frequency exceeded" 36 | } 37 | } 38 | } 39 | }, 40 | "remove": { 41 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blockremove", 42 | "url": "user/unblock", 43 | "params": { 44 | "user": { 45 | "id": "aFo990k" 46 | } 47 | }, 48 | "response": { 49 | "success": { 50 | "code": "200", 51 | "msg": "Successfully returned" 52 | }, 53 | "fail": { 54 | "1501": { 55 | "code": "1501", 56 | "msg": "Invalid minute parameter, please check the parameter type, it should be number, currently {{currentType}}" 57 | }, 58 | "1002": { 59 | "code": "1002", 60 | "msg": "{{name}} parameter is required" 61 | }, 62 | "1004": { 63 | "code": "1004", 64 | "msg": "Signature error, please verify if Appkey and Secret are correct" 65 | }, 66 | "1008": { 67 | "code": "1008", 68 | "msg": "Request frequency exceeded" 69 | } 70 | } 71 | } 72 | }, 73 | "getList": { 74 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blocklist", 75 | "url": "user/block/query", 76 | "params": {}, 77 | "response": { 78 | "success": { 79 | "code": "200", 80 | "msg": "Successfully returned" 81 | }, 82 | "fail": { 83 | "1004": { 84 | "code": "1004", 85 | "msg": "Signature error, please verify if Appkey and Secret are correct" 86 | }, 87 | "1008": { 88 | "code": "1008", 89 | "msg": "Request frequency exceeded" 90 | } 91 | } 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/BlockPushPeriod/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blockadd", 4 | "url": "user/blockPushPeriod/set", 5 | "params": { 6 | "user": { 7 | "id": "aFo990k", 8 | "startTime": "23:59:59", 9 | "period": 600 10 | } 11 | }, 12 | "response": { 13 | "success": { 14 | "code": "200", 15 | "msg": "Success" 16 | }, 17 | "fail": { 18 | "1502": { 19 | "code": "1502", 20 | "msg": "Invalid block time, current input is {{size}}, valid range is 1 - 1 * 30 * 24 * 60 minutes" 21 | }, 22 | "1501": { 23 | "code": "1501", 24 | "msg": "Invalid parameter type, expected {{type}}, current is {{currentType}}" 25 | }, 26 | "1002": { 27 | "code": "1002", 28 | "msg": "{{name}} parameter is required" 29 | }, 30 | "1004": { 31 | "code": "1004", 32 | "msg": "Signature error, please check if Appkey and Secret are correct" 33 | }, 34 | "1008": { 35 | "code": "1008", 36 | "msg": "Call frequency exceeded" 37 | } 38 | } 39 | } 40 | }, 41 | "remove": { 42 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blockremove", 43 | "url": "user/blockPushPeriod/delete", 44 | "params": { 45 | "user": { 46 | "id": "aFo990k" 47 | } 48 | }, 49 | "response": { 50 | "success": { 51 | "code": "200", 52 | "msg": "Success" 53 | }, 54 | "fail": { 55 | "1501": { 56 | "code": "1501", 57 | "msg": "Invalid minute parameter, expected number, current is {{currentType}}" 58 | }, 59 | "1002": { 60 | "code": "1002", 61 | "msg": "{{name}} parameter is required" 62 | }, 63 | "1004": { 64 | "code": "1004", 65 | "msg": "Signature error, please check if Appkey and Secret are correct" 66 | }, 67 | "1008": { 68 | "code": "1008", 69 | "msg": "Call frequency exceeded" 70 | } 71 | } 72 | } 73 | }, 74 | "getList": { 75 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/block#blocklist", 76 | "url": "user/blockPushPeriod/get", 77 | "params": { 78 | "user": { 79 | "id": "aFo990k" 80 | } 81 | }, 82 | "response": { 83 | "success": { 84 | "code": "200", 85 | "msg": "Success" 86 | }, 87 | "fail": { 88 | "1004": { 89 | "code": "1004", 90 | "msg": "Signature error, please check if Appkey and Secret are correct" 91 | }, 92 | "1008": { 93 | "code": "1008", 94 | "msg": "Call frequency exceeded" 95 | } 96 | } 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Chat/Ban.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath . 'api.json'); 45 | $this->verify = Utils::getJson($this->jsonPath . 'verify.json'); 46 | } 47 | 48 | /** 49 | * Set user single chat ban 50 | * 51 | * @param array $User Set user single chat ban parameters 52 | * @param 53 | * $User = [ 54 | * 'id' => ['ujadk90ha1'], //Banned user Id, supports batch setting, maximum not exceeding 1000. 55 | * 'state' => 1, //Ban status, 0 unban, 1 add ban 56 | * 'type' => 'PERSON' //Conversation type, currently supports single chat PERSON 57 | * ]; 58 | * @return array 59 | */ 60 | public function set(array $User = []) 61 | { 62 | $conf = $this->conf['set']; 63 | $error = (new Utils())->check([ 64 | 'api' => $conf, 65 | 'model' => 'user', 66 | 'data' => $User, 67 | 'verify' => $this->verify['set'] 68 | ]); 69 | if ($error) return $error; 70 | $User = (new Utils())->rename($User, [ 71 | 'id' => 'userId', 72 | ]); 73 | $result = (new Request())->Request($conf['url'], $User); 74 | $bodyParameter = (new Request())->getQueryFields($User); 75 | $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); 76 | return $result; 77 | } 78 | 79 | /** 80 | * Query the list of banned users 81 | * 82 | * @param array $param Parameters for querying the list of banned users 83 | * @param 84 | * $param = [ 85 | * 'num' => 100, // Number of rows to fetch, default is 100, maximum supported is 200. 86 | * 'offset' => 0, // Starting position for the query, default is 0. 87 | * 'type' => 'PERSON' // Conversation type, currently supports single chat PERSON 88 | * ]; 89 | * @return array 90 | */ 91 | public function getList(array $param = []) 92 | { 93 | $conf = $this->conf['getList']; 94 | $error = (new Utils())->check([ 95 | 'api' => $conf, 96 | 'model' => 'param', 97 | 'data' => $param, 98 | 'verify' => $this->verify['getList'] 99 | ]); 100 | if ($error) return $error; 101 | $result = (new Request())->Request($conf['url'], $param); 102 | $bodyParameter = (new Request())->getQueryFields($param); 103 | $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); 104 | return $result; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /RongCloud/Lib/User/Chat/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/ban#ban_set", 4 | "url": "user/chat/fb/set", 5 | "params": { 6 | "user": { 7 | "id": ["ujadk90ha1"], 8 | "state": 0, 9 | "type": "PERSON" 10 | } 11 | }, 12 | "response": { 13 | "success": { 14 | "code": 200 15 | }, 16 | "fail": { 17 | "20003": { 18 | "code": "1002", 19 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}} unit: bytes" 20 | }, 21 | "1002": { 22 | "code": "1002", 23 | "msg": "{{name}} parameter is required" 24 | }, 25 | "1004": { 26 | "code": "1004", 27 | "msg": "Signature error, please check if Appkey and Secret are correct" 28 | }, 29 | "1008": { 30 | "code": "1008", 31 | "msg": "Call frequency exceeds limit" 32 | } 33 | } 34 | } 35 | }, 36 | "getList": { 37 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/ban#ban_querylist", 38 | "url": "user/chat/fb/querylist", 39 | "params": { 40 | "param": { 41 | "type": "PERSON" 42 | } 43 | }, 44 | "response": { 45 | "success": { 46 | "code": "200", 47 | "msg": "Successfully returned" 48 | }, 49 | "fail": { 50 | "1005": { 51 | "code": "1005", 52 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 53 | }, 54 | "1002": { 55 | "code": "1002", 56 | "msg": "{{name}} parameter is required" 57 | }, 58 | "1004": { 59 | "code": "1004", 60 | "msg": "Signature error, please check if Appkey and Secret are correct" 61 | }, 62 | "1008": { 63 | "code": "1008", 64 | "msg": "Call frequency exceeds limit" 65 | } 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Chat/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | 14 | "id": { 15 | "require": { 16 | "must": true, 17 | "invalid": "1002" 18 | }, 19 | "typeof": { 20 | "type": "array", 21 | "invalid": "1501" 22 | } 23 | }, 24 | "state": { 25 | "require": { 26 | "must": true, 27 | "invalid": "1002" 28 | }, 29 | "length": { 30 | "max": 1, 31 | "min": 0, 32 | "invalid": "1005" 33 | } 34 | }, 35 | "type": { 36 | "require": { 37 | "must": true, 38 | "invalid": "1002" 39 | }, 40 | "length": { 41 | "max": 64, 42 | "min": 1, 43 | "invalid": "1005" 44 | } 45 | } 46 | }, 47 | "getList":{ 48 | "_self": { 49 | "require": { 50 | "must": true, 51 | "invalid": "1002" 52 | }, 53 | "typeof": { 54 | "type": "object", 55 | "invalid": "1501" 56 | } 57 | }, 58 | "type": { 59 | "require": { 60 | "must": true, 61 | "invalid": "1002" 62 | }, 63 | "length": { 64 | "max": 64, 65 | "min": 1, 66 | "invalid": "1005" 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/MuteChatrooms/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_add", 4 | "url": "chatroom/user/ban/add", 5 | "params": { 6 | "chatroom": { 7 | "members": [{ 8 | "id": "akfj0a1" 9 | }], 10 | "minute": 100 11 | } 12 | }, 13 | "response": { 14 | "success": { 15 | "code": 200, 16 | "msg": "Successfully returned" 17 | }, 18 | "fail": { 19 | "1502": { 20 | "code": "1502", 21 | "msg": "Invalid ban duration, current input is {{size}}, valid range is 1 - 1 * 30 * 24 * 60 minutes" 22 | }, 23 | "1002": { 24 | "code": "1002", 25 | "msg": "{{name}} parameter is required" 26 | }, 27 | "1501": { 28 | "code": "1501", 29 | "msg": "Invalid parameter type, please check the parameter type, it should be {{type}}, current is {{currentType}}" 30 | }, 31 | "1004": { 32 | "code": "1004", 33 | "msg": "Signature error, please verify if Appkey and Secret are correct" 34 | }, 35 | "1008": { 36 | "code": "1008", 37 | "msg": "Request frequency limit exceeded" 38 | } 39 | } 40 | } 41 | }, 42 | "remove": { 43 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_remove", 44 | "url": "chatroom/user/ban/remove", 45 | "params": { 46 | "chatroom": { 47 | "members": [{ 48 | "id": "akfj0a1" 49 | }] 50 | } 51 | }, 52 | "response": { 53 | "success": { 54 | "code": 200, 55 | "msg": "Successfully returned" 56 | }, 57 | "fail": { 58 | "1002": { 59 | "code": "1002", 60 | "msg": "{{name}} parameter is required" 61 | }, 62 | "1501": { 63 | "code": "1501", 64 | "msg": "Invalid {{name}} type, please check the parameter type, it should be Object, current is {{currentType}}" 65 | }, 66 | "1004": { 67 | "code": "1004", 68 | "msg": "Signature error, please verify if Appkey and Secret are correct" 69 | }, 70 | "1008": { 71 | "code": "1008", 72 | "msg": "Request frequency limit exceeded" 73 | } 74 | } 75 | } 76 | }, 77 | "getList": { 78 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/chatroom/global-gag#ban_query", 79 | "url": "chatroom/user/ban/query", 80 | "params": {}, 81 | "response": { 82 | "success": { 83 | "code": "200", 84 | "members": [{ 85 | "time": "2015-09-25 16:12:38", 86 | "id": "2582" 87 | }] 88 | }, 89 | "fail": { 90 | "1004": { 91 | "code": "1004", 92 | "msg": "Signature error, please verify if Appkey and Secret are correct" 93 | }, 94 | "1008": { 95 | "code": "1008", 96 | "msg": "Request frequency limit exceeded" 97 | } 98 | } 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/MuteChatrooms/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "chatroom": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | } 8 | }, 9 | "id": { 10 | "require": { 11 | "must": true, 12 | "invalid": "1002" 13 | } 14 | }, 15 | "name": { 16 | "require": { 17 | "must": true, 18 | "invalid": "1002" 19 | } 20 | }, 21 | "members": { 22 | "require": { 23 | "must": true, 24 | "invalid": "1002" 25 | }, 26 | "typeof": { 27 | "type": "array", 28 | "invalid": "1501" 29 | } 30 | }, 31 | "minute": { 32 | "require": { 33 | "must": true, 34 | "invalid": "1002" 35 | }, 36 | "size": { 37 | "max": 43200, 38 | "min": 1, 39 | "invalid": "1502" 40 | }, 41 | "typeof": { 42 | "type": "number", 43 | "invalid": "1501" 44 | } 45 | } 46 | }, 47 | "demotion": { 48 | "_self": { 49 | "require": { 50 | "must": true, 51 | "invalid": "1002" 52 | } 53 | }, 54 | "msgs": { 55 | "require": { 56 | "must": true, 57 | "invalid": "1002" 58 | }, 59 | "typeof": { 60 | "type": "array", 61 | "invalid": "1501" 62 | } 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/MuteGroups/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | "members": { 14 | "require": { 15 | "must": true, 16 | "invalid": "1002" 17 | }, 18 | "typeof": { 19 | "type": "array", 20 | "invalid": "1501" 21 | }, 22 | "length": { 23 | "max": 99999999999, 24 | "min": 1, 25 | "invalid": "1005" 26 | } 27 | }, 28 | "name": { 29 | "require": { 30 | "must": true, 31 | "invalid": "1002" 32 | }, 33 | "length": { 34 | "max": 64, 35 | "min": 1, 36 | "invalid": "1005" 37 | } 38 | } 39 | }, 40 | "user":{ 41 | "id": { 42 | "require": { 43 | "must": true, 44 | "invalid": "1002" 45 | }, 46 | "length": { 47 | "max": 64, 48 | "min": 1, 49 | "invalid": "1005" 50 | } 51 | }, 52 | "groups":{ 53 | "require": { 54 | "must": true, 55 | "invalid": "1002" 56 | }, 57 | "typeof": { 58 | "type": "array", 59 | "invalid": "1501" 60 | } 61 | } 62 | }, 63 | "minute": { 64 | "require": { 65 | "must": true, 66 | "invalid": "1002" 67 | }, 68 | "size": { 69 | "max": 43200, 70 | "min": 0, 71 | "invalid": "1502" 72 | }, 73 | "typeof": { 74 | "type": "number", 75 | "invalid": "1501" 76 | } 77 | }, 78 | "member":{ 79 | "member": { 80 | "require": { 81 | "must": true, 82 | "invalid": "1002" 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Onlinestatus/Onlinestatus.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 41 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 42 | } 43 | 44 | /** 45 | * Check user online status 46 | * 47 | * @param array $User Parameters for checking user online status 48 | * @param 49 | * $User = [ 50 | * 'id'=> 'ujadk90ha1',//User ID, unique identifier, maximum length 30 characters 51 | * ]; 52 | * @return array 53 | */ 54 | public function check(array $User=[]){ 55 | $conf = $this->conf['get']; 56 | $error = (new Utils())->check([ 57 | 'api'=> $conf, 58 | 'model'=> 'user', 59 | 'data'=> $User, 60 | 'verify'=> $this->verify['user'] 61 | ]); 62 | if($error) return $error; 63 | $User = (new Utils())->rename($User, [ 64 | 'id'=> 'userId', 65 | ]); 66 | $result = (new Request())->Request($conf['url'],$User); 67 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 68 | return $result; 69 | } 70 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Onlinestatus/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "get": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/onlinestatus#check", 4 | "url": "user/checkOnline", 5 | "params": { 6 | "user": { 7 | "id": "aFo990k" 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": 200, 13 | "status": 1 14 | }, 15 | "fail": { 16 | "9999": { 17 | "code": "1002", 18 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}} unit: bytes" 19 | }, 20 | "1501": { 21 | "code": "1501", 22 | "msg": "Incorrect parameter type, please check the parameter type, it should be {{type}} but currently is {{currentType}}" 23 | }, 24 | "1002": { 25 | "code": "1002", 26 | "msg": "{{name}} parameter is required" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "msg": "Signature error, please check if Appkey and Secret are correct" 31 | }, 32 | "1008": { 33 | "code": "1008", 34 | "msg": "Call frequency exceeds limit" 35 | } 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Profile/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "1002" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "1501" 11 | } 12 | }, 13 | "userId": { 14 | "require": { 15 | "must": true, 16 | "invalid": "1002" 17 | } 18 | } 19 | }, 20 | "batchQuery": { 21 | "_self": { 22 | "require": { 23 | "must": true, 24 | "invalid": "1002" 25 | }, 26 | "typeof": { 27 | "type": "object", 28 | "invalid": "1501" 29 | } 30 | }, 31 | "userId": { 32 | "require": { 33 | "must": true, 34 | "invalid": "20005" 35 | }, 36 | "size": { 37 | "max": 100, 38 | "min": 1, 39 | "invalid": "1005" 40 | }, 41 | "typeof": { 42 | "type": "array", 43 | "invalid": "20001" 44 | } 45 | } 46 | }, 47 | "clean": { 48 | "_self": { 49 | "require": { 50 | "must": true, 51 | "invalid": "1002" 52 | }, 53 | "typeof": { 54 | "type": "object", 55 | "invalid": "1501" 56 | } 57 | }, 58 | "userId": { 59 | "require": { 60 | "must": true, 61 | "invalid": "20005" 62 | }, 63 | "size": { 64 | "max": 20, 65 | "min": 1, 66 | "invalid": "1005" 67 | }, 68 | "typeof": { 69 | "type": "array", 70 | "invalid": "20001" 71 | } 72 | } 73 | }, 74 | "query": { 75 | "_self": { 76 | "require": { 77 | "must": true, 78 | "invalid": "1002" 79 | }, 80 | "typeof": { 81 | "type": "object", 82 | "invalid": "1501" 83 | } 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Remark/Remark.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 41 | } 42 | 43 | /** 44 | * Add user remark 45 | * 46 | * @param array $User 47 | * @param 48 | * $User = [ 49 | * 'userId'=> 'ujadk90ha1',//User ID 50 | * 'remark'=> [ 51 | * ["id"=>'userid',"remark"=>'Remark2'], 52 | * ["id"=>'userid2',"remark"=>'Remark2'] 53 | * ]//User remark 54 | * ]; 55 | * @return array 56 | */ 57 | public function set(array $User=[]){ 58 | $conf = $this->conf['set']; 59 | $error = (new Utils())->check([ 60 | 'api'=> $conf, 61 | 'model'=> 'user', 62 | 'data'=> $User, 63 | 'verify'=> $this->verify['remark'] 64 | ]); 65 | if($error) return $error; 66 | $result = (new Request())->Request($conf['url'],$User); 67 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 68 | return $result; 69 | } 70 | 71 | /** 72 | * Delete user remark 73 | * 74 | * @param array $User 75 | * @param 76 | * $User = [ 77 | * 'userId'=> 'ujadk90ha1',//User ID 78 | * 'targetId'=> 'targetUserid'//User remark 79 | * ]; 80 | * @return array 81 | */ 82 | public function del(array $User=[]){ 83 | $conf = $this->conf['del']; 84 | $error = (new Utils())->check([ 85 | 'api'=> $conf, 86 | 'model'=> 'user', 87 | 'data'=> $User, 88 | 'verify'=> $this->verify['remark'] 89 | ]); 90 | if($error) return $error; 91 | $result = (new Request())->Request($conf['url'],$User); 92 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 93 | return $result; 94 | } 95 | 96 | /** 97 | * Get user annotation 98 | * @param array $User 99 | * @param 100 | * $User = [ 101 | * 'userId'=> 'ujadk90ha1', // User ID 102 | * 'size'=> 50 // Default 50 103 | * 'page' => 1 // Default first page 104 | * ]; 105 | * @return array 106 | * @return array 107 | */ 108 | public function get(array $User=[]){ 109 | $conf = $this->conf['get']; 110 | $error = (new Utils())->check([ 111 | 'api'=> $conf, 112 | 'model'=> 'user', 113 | 'data'=> $User, 114 | 'verify'=> $this->verify['remark'] 115 | ]); 116 | if($error) return $error; 117 | $result = (new Request())->Request($conf['url'],$User); 118 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 119 | return $result; 120 | } 121 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Tag/Tag.php: -------------------------------------------------------------------------------- 1 | conf = Utils::getJson($this->jsonPath.'api.json'); 40 | $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); 41 | } 42 | 43 | /** 44 | * Add user tags 45 | * 46 | * @param array $User 47 | * @param 48 | * $User = [ 49 | * 'userId'=> 'ujadk90ha1',//User ID 50 | * 'tags'=> ['Tag1','Tag2']//User tags 51 | * ]; 52 | * @return array 53 | */ 54 | public function set(array $User=[]){ 55 | $conf = $this->conf['setTag']; 56 | $error = (new Utils())->check([ 57 | 'api'=> $conf, 58 | 'model'=> 'user', 59 | 'data'=> $User, 60 | 'verify'=> $this->verify['tag'] 61 | ]); 62 | if($error) return $error; 63 | $result = (new Request())->Request($conf['url'],$User,'json'); 64 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 65 | return $result; 66 | } 67 | 68 | /** 69 | * Batch add user tags 70 | * 71 | * @param array $User 72 | * @param 73 | * $User = [ 74 | * 'userIds'=> ['ujadk90ha1','ujadk90ha1'],//User ID list 75 | * 'tags'=> ['Tag1','Tag2']//User tags 76 | * ]; 77 | * @return array 78 | */ 79 | public function batchset(array $User=[]){ 80 | $conf = $this->conf['batchSetTag']; 81 | $error = (new Utils())->check([ 82 | 'api'=> $conf, 83 | 'model'=> 'user', 84 | 'data'=> $User, 85 | 'verify'=> $this->verify['batchTag'] 86 | ]); 87 | if($error) return $error; 88 | $result = (new Request())->Request($conf['url'],$User,'json'); 89 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 90 | return $result; 91 | } 92 | 93 | /** 94 | * Get user tags 95 | * @param array $User 96 | * @param 97 | * $User = [ 98 | * 'userIds'=> ['ujadk90ha1','ujadk90ha1'],//User ID list 99 | * ]; 100 | * @return array 101 | * @return array 102 | */ 103 | public function get(array $User=[]){ 104 | $conf = $this->conf['getTag']; 105 | $error = (new Utils())->check([ 106 | 'api'=> $conf, 107 | 'model'=> 'user', 108 | 'data'=> $User, 109 | 'verify'=> $this->verify['getTag'] 110 | ]); 111 | if($error) return $error; 112 | $result = (new Request())->Request($conf['url'],$User); 113 | $result = (new Utils())->responseError($result, $conf['response']['fail']); 114 | return $result; 115 | } 116 | } -------------------------------------------------------------------------------- /RongCloud/Lib/User/Whitelist/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "add": { 3 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/whitelist#whitelist_add", 4 | "url": "user/whitelist/add", 5 | "params": { 6 | "user": { 7 | "id": "kkfh091", 8 | "whitelist": [{ 9 | "id": "ggsk902" 10 | }] 11 | } 12 | }, 13 | "response": { 14 | "success": { 15 | "code": "200", 16 | "msg": "Success" 17 | }, 18 | "fail": { 19 | "1005": { 20 | "code": "1005", 21 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 22 | }, 23 | "1004": { 24 | "code": "1004", 25 | "msg": "Signature error, please check if Appkey and Secret are correct" 26 | }, 27 | "1008": { 28 | "code": "1008", 29 | "msg": "Call frequency exceeds limit" 30 | }, 31 | "1002": { 32 | "code": "1002", 33 | "msg": "{{name}} parameter is required" 34 | }, 35 | "1501": { 36 | "code": "1501", 37 | "msg": "Parameter type is incorrect, please check the parameter type, should be {{type}} but currently is {{currentType}}" 38 | } 39 | } 40 | } 41 | }, 42 | "remove": { 43 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/whitelist#whitelist_remove", 44 | "url": "user/whitelist/remove", 45 | "params": { 46 | "user": { 47 | "id": "kkfh091", 48 | "whitelist": [{ 49 | "id": "ggsk902" 50 | }] 51 | } 52 | }, 53 | "response": { 54 | "success": { 55 | "code": "200", 56 | "msg": "Success" 57 | }, 58 | "fail": { 59 | "1005": { 60 | "code": "1005", 61 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 62 | }, 63 | "1002": { 64 | "code": "1002", 65 | "msg": "{{name}} parameter is required" 66 | }, 67 | "1501": { 68 | "code": "1501", 69 | "msg": "Parameter type is incorrect, please check the parameter type, should be {{type}} but currently is {{currentType}}" 70 | }, 71 | "1004": { 72 | "code": "1004", 73 | "msg": "Signature error, please check if Appkey and Secret are correct" 74 | }, 75 | "1008": { 76 | "code": "1008", 77 | "msg": "Call frequency exceeds limit" 78 | } 79 | } 80 | } 81 | }, 82 | "getList": { 83 | "docs": "https://doc.rongcloud.cn/imserver/server/v1/user/whitelist#whitelist_query", 84 | "url": "user/whitelist/query", 85 | "params": { 86 | "user": { 87 | "id": "kkfh091" 88 | } 89 | }, 90 | "response": { 91 | "success": { 92 | "code": "200", 93 | "msg": "Success" 94 | }, 95 | "fail": { 96 | "1005": { 97 | "code": "1005", 98 | "msg": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 99 | }, 100 | "1002": { 101 | "code": "1002", 102 | "msg": "{{name}} parameter is required" 103 | }, 104 | "1004": { 105 | "code": "1004", 106 | "msg": "Signature error, please check if Appkey and Secret are correct" 107 | }, 108 | "1008": { 109 | "code": "1008", 110 | "msg": "Call frequency exceeds limit" 111 | } 112 | } 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Ban.php: -------------------------------------------------------------------------------- 1 | [ 21 | ['id'=>'seal9901']// Personnel ID 22 | ], 23 | 'minute'=>30// Forbidden duration 24 | ]; 25 | $Ban = $RongSDK->getChatroom()->Ban()->add($chatroom); 26 | Utils::dump("Add global chat room ban",$Ban); 27 | } 28 | add(); 29 | 30 | /** 31 | * Unblock global chat room restrictions 32 | */ 33 | function remove() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $chatroom = [ 37 | 'members'=> [ 38 | ['id'=>'seal9901']// Person ID 39 | ], 40 | ]; 41 | $Ban = $RongSDK->getChatroom()->Ban()->remove($chatroom); 42 | Utils::dump("Unblock global chat room restrictions",$Ban); 43 | } 44 | remove(); 45 | 46 | /** 47 | * Get the global banned word list of the chat room 48 | */ 49 | function getList() 50 | { 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $chatroom = [ 53 | 54 | ]; 55 | $Ban = $RongSDK->getChatroom()->Ban()->getList($chatroom); 56 | Utils::dump("Get the global banned word list of the chat room",$Ban); 57 | } 58 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Block.php: -------------------------------------------------------------------------------- 1 | 'OIBbeKlkx',// Chat room id 21 | 'members'=> [ 22 | ['id'=>'aP9uvganV']// Ban member id 23 | ], 24 | 'minute'=>500// Block duration 25 | ]; 26 | $Block = $RongSDK->getChatroom()->Block()->add($chatroom); 27 | Utils::dump("Add ban",$Block); 28 | } 29 | add(); 30 | 31 | /** 32 | * Unblock 33 | */ 34 | function remove() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $chatroom = [ 38 | 'id'=> 'OIBbeKlkx',// Chat room ID 39 | 'members'=> [ 40 | ['id'=>'aP9uvganV']// Unblock member id 41 | ], 42 | ]; 43 | $Block = $RongSDK->getChatroom()->Block()->remove($chatroom); 44 | Utils::dump("Unblock",$Block); 45 | } 46 | remove(); 47 | 48 | /** 49 | * Query the list of banned members 50 | */ 51 | function getList() 52 | { 53 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 54 | $chatroom = [ 55 | 'id'=>'OIBbeKlkx'// @param chatroom id 56 | ]; 57 | $Block = $RongSDK->getChatroom()->Block()->getList($chatroom); 58 | Utils::dump("Query the list of banned members",$Block); 59 | } 60 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Demotion.php: -------------------------------------------------------------------------------- 1 | ['RC:TxtMsg03','RC:TxtMsg02']// Message type list 21 | ]; 22 | $Demotion = $RongSDK->getChatroom()->Demotion()->add($chatroom); 23 | Utils::dump("Add in-app chat room downgrade message",$Demotion); 24 | } 25 | add(); 26 | 27 | /** 28 | * Remove application chat room downgrade message 29 | */ 30 | function remove() 31 | { 32 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 33 | $chatroom = [ 34 | 'msgs'=> ['RC:TxtMsg01','RC:TxtMsg02']// Message type list 35 | ]; 36 | $Demotion = $RongSDK->getChatroom()->Demotion()->remove($chatroom); 37 | Utils::dump("Remove in-app chat room downgrade message",$Demotion); 38 | } 39 | remove(); 40 | 41 | /** 42 | * Get the downgrade message within the app chat room 43 | */ 44 | function getList() 45 | { 46 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 47 | $chatroom = [ 48 | 49 | ]; 50 | $Demotion = $RongSDK->getChatroom()->Demotion()->getList($chatroom); 51 | Utils::dump("Get app chat room downgrade message",$Demotion); 52 | } 53 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Distribute.php: -------------------------------------------------------------------------------- 1 | "Txtmsg03"// Chatroom ID 22 | /* Chatroom ID */ 23 | ]; 24 | $Demotion = $RongSDK->getChatroom()->Distribute()->stop($chatroom); 25 | Utils::dump("Stop chat room message distribution",$Demotion); 26 | } 27 | stop(); 28 | 29 | /** 30 | * Restore chat room message distribution 31 | */ 32 | function resume() 33 | { 34 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 35 | $chatroom = [ 36 | 'id'=> "Txtmsg03"// Chatroom ID 37 | ]; 38 | $Demotion = $RongSDK->getChatroom()->Distribute()->resume($chatroom); 39 | Utils::dump("Restore chat room message distribution",$Demotion); 40 | } 41 | resume(); 42 | -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Entry.php: -------------------------------------------------------------------------------- 1 | getChatroom()->create(['id' => 'chatroom001', 'name' => 'RongCloud']); 22 | 23 | $params = [ 24 | 'id' => 'chatroom001',// Chat room ID 25 | 'userId' => 'userId01',// Operator User Id 26 | 'key' => 'key01',// Chat room attribute name 27 | 'value' => 'value01',// The value corresponding to the chat room attribute 28 | ]; 29 | 30 | $Entry = $RongSDK->getChatroom()->Entry()->set($params); 31 | Utils::dump("Set chat room attributes (KV)", $Entry); 32 | } 33 | 34 | set(); 35 | 36 | 37 | /** 38 | * Batch set chat room properties (KV) 39 | */ 40 | function batchSet() { 41 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 42 | 43 | // Create a chat room 44 | $RongSDK->getChatroom()->createV2(['id' => 'chatroom001']); 45 | 46 | $params = [ 47 | 'id' => 'chatroom001',// Chat room ID 48 | 'autoDelete'=> 0, // Whether to delete this key value after the user (entryOwnerId) exits the chat room 49 | 'entryOwnerId'=> 'test', // Custom attribute of the chat room's user ID 50 | 'entryInfo'=> '{"key1":"value1","key2":"value2"}',// Chat room attribute corresponding value 51 | ]; 52 | 53 | $Entry = $RongSDK->getChatroom()->Entry()->batchSet($params); 54 | Utils::dump("Batch set chat room properties (KV)", $Entry); 55 | } 56 | 57 | batchSet(); 58 | 59 | 60 | /** 61 | * Get chat room properties 62 | */ 63 | function query() { 64 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 65 | 66 | $params = [ 67 | 'id' => 'chatroom001',// chatroom id 68 | ]; 69 | $Entry = $RongSDK->getChatroom()->Entry()->query($params); 70 | Utils::dump("Get chat room properties", $Entry); 71 | } 72 | 73 | query(); 74 | 75 | /** 76 | * Delete chat room attribute 77 | */ 78 | function remove() { 79 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 80 | $params = [ 81 | 'id' => 'chatroom001',// Chat room id 82 | 'userId' => 'userId01',// Operator User ID 83 | 'key' => 'key01',// Chat room attribute name 84 | ]; 85 | 86 | $Entry = $RongSDK->getChatroom()->Entry()->remove($params); 87 | Utils::dump("Delete chat room attribute", $Entry); 88 | } 89 | 90 | remove(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Gag.php: -------------------------------------------------------------------------------- 1 | 'chatroom001',// Chat room id 21 | 'members'=> [ 22 | ['id'=>'seal9901']// Forbidden personnel id 23 | ], 24 | 'minute'=>30// Forbidden utterance duration 25 | ]; 26 | $Gag = $RongSDK->getChatroom()->Gag()->add($chatroom); 27 | Utils::dump("Add chat room member mute",$Gag); 28 | } 29 | add(); 30 | 31 | /** 32 | * Unban chat room member 33 | */ 34 | function remove() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $chatroom = [ 38 | 'id'=> 'ujadk90ha',// Chat room id 39 | 'members'=> [ 40 | ['id'=>'seal9901']// Personnel ID 41 | ], 42 | ]; 43 | $Gag = $RongSDK->getChatroom()->Gag()->remove($chatroom); 44 | Utils::dump("Unban chat room member",$Gag); 45 | } 46 | remove(); 47 | 48 | /** 49 | * Get the list of muted members in the chat room 50 | */ 51 | function getList() 52 | { 53 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 54 | $chatroom = [ 55 | "id"=>"chatroom001"// chatroom id 56 | ]; 57 | $Gag = $RongSDK->getChatroom()->Gag()->getList($chatroom); 58 | Utils::dump("Get the list of muted members in the chat room",$Gag); 59 | } 60 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Keepalive.php: -------------------------------------------------------------------------------- 1 | "Txtmsg03" 21 | ]; 22 | $Keeplive = $RongSDK->getChatroom()->Keepalive()->add($chatroom); 23 | Utils::dump("Add a chat room for live conversations",$Keeplive); 24 | } 25 | add(); 26 | 27 | /** 28 | * Delete chat room with keep-alive 29 | */ 30 | function remove() 31 | { 32 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 33 | $chatroom = [ 34 | 'id'=> "chrmId001" 35 | ]; 36 | $Keeplive = $RongSDK->getChatroom()->Keepalive()->remove($chatroom); 37 | Utils::dump("Delete chat room with keep-alive",$Keeplive); 38 | } 39 | remove(); 40 | 41 | /** 42 | * Get the chat room for preservation 43 | */ 44 | function getList() 45 | { 46 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 47 | $chatroom = [ 48 | 49 | ]; 50 | $Keeplive = $RongSDK->getChatroom()->Keepalive()->getList($chatroom); 51 | Utils::dump("Get the chat room for preservation",$Keeplive); 52 | } 53 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/MuteAllMembers.php: -------------------------------------------------------------------------------- 1 | "chatroom" 21 | ]; 22 | $MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->add($chatroom); 23 | Utils::dump("Add a chat room-wide ban",$MuteAllMembers); 24 | } 25 | add(); 26 | 27 | /** 28 | * Unmute all participants in the chat room 29 | */ 30 | function remove() 31 | { 32 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 33 | $chatroom = [ 34 | "id"=>"chatroom" 35 | ]; 36 | $MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->remove($chatroom); 37 | Utils::dump("Unmute all participants in the chat room",$MuteAllMembers); 38 | } 39 | remove(); 40 | 41 | /** 42 | * Check the status of the entire chat room's mute state 43 | */ 44 | function check() 45 | { 46 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 47 | $chatroom = [ 48 | "id"=>"chatroom" 49 | ]; 50 | $MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->check($chatroom); 51 | Utils::dump("Check the status of the entire chat room's mute state",$MuteAllMembers); 52 | } 53 | check(); 54 | 55 | /** 56 | * Get the list of all banned words in the chat room 57 | */ 58 | function getList() 59 | { 60 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 61 | $MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->getList(1, 50); 62 | Utils::dump("Get the list of all banned words in the chat room",$MuteAllMembers); 63 | } 64 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/MuteWhiteList.php: -------------------------------------------------------------------------------- 1 | "chatroom", 21 | "members"=>[ 22 | ["id"=>"user1"], 23 | ["id"=>"user2"], 24 | ] 25 | ]; 26 | $MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->add($chatroom); 27 | Utils::dump("Add the chat room's entire ban list to the whitelist",$MuteWhiteList); 28 | } 29 | add(); 30 | 31 | /** 32 | * Remove the chat room's global ban whitelist 33 | */ 34 | function remove() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $chatroom = [ 38 | "id"=>"chatroom", 39 | "members"=>[ 40 | ["id"=>"user3"], 41 | ["id"=>"user4"], 42 | ] 43 | ]; 44 | $MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->remove($chatroom); 45 | Utils::dump("Remove the chat room's global ban whitelist",$MuteWhiteList); 46 | } 47 | remove(); 48 | 49 | /** 50 | * Get the whitelist of the chat room's global mute list 51 | */ 52 | function getList() 53 | { 54 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 55 | $chatroom = [ 56 | "id"=>"chatroom", 57 | ]; 58 | $MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->getList($chatroom); 59 | Utils::dump("Get the chat room's entire ban list whitelist",$MuteWhiteList); 60 | } 61 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Whitelist/Message.php: -------------------------------------------------------------------------------- 1 | ["RC:TxtMsg"]// Message type list 20 | ]; 21 | $Message = $RongSDK->getChatroom()->Whitelist()->Message()->add($chatroom); 22 | Utils::dump("Add chat room message whitelist",$Message); 23 | } 24 | add(); 25 | 26 | /** 27 | * Get the chat room message whitelist 28 | */ 29 | function getList() 30 | { 31 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 32 | $chatroom = [ 33 | 34 | ]; 35 | $Message = $RongSDK->getChatroom()->Whitelist()->Message()->getList($chatroom); 36 | Utils::dump("Get the chat room message whitelist",$Message); 37 | } 38 | getList(); 39 | 40 | /** 41 | * Remove chat room message whitelist 42 | */ 43 | function remove() 44 | { 45 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 46 | $chatroom = [ 47 | 'msgs'=> ["RC:TxtMsg"]// Message type list 48 | ]; 49 | $Message = $RongSDK->getChatroom()->Whitelist()->Message()->remove($chatroom); 50 | Utils::dump("Remove chat room message whitelist",$Message); 51 | } 52 | remove(); -------------------------------------------------------------------------------- /RongCloud/example/Chatroom/Whitelist/User.php: -------------------------------------------------------------------------------- 1 | "seal9901",// Chat room ID 21 | "members"=>[ 22 | ["id"=>"user1"],// User ID 23 | ["id"=>"user2"] 24 | ] 25 | ]; 26 | $User = $RongSDK->getChatroom()->Whitelist()->User()->add($chatroom); 27 | Utils::dump("Add chat room user whitelist",$User); 28 | } 29 | add(); 30 | 31 | /** 32 | * Remove chat room user whitelist 33 | */ 34 | function remove() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $chatroom = [ 38 | "id"=>"seal9901",// Chat room ID 39 | "members"=>[ 40 | ["id"=>"user4"],// User ID 41 | ["id"=>"user5"] 42 | ] 43 | ]; 44 | $User = $RongSDK->getChatroom()->Whitelist()->User()->remove($chatroom); 45 | Utils::dump("Remove chat room user whitelist",$User); 46 | } 47 | remove(); 48 | 49 | /** 50 | * Get the chat room user whitelist 51 | */ 52 | function getList() 53 | { 54 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 55 | $chatroom = [ 56 | "id"=>"seal9901",// chatroom id 57 | ]; 58 | $User = $RongSDK->getChatroom()->Whitelist()->User()->getList($chatroom); 59 | Utils::dump("Get the chat room user whitelist",$User); 60 | } 61 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Conversation/Conversation.php: -------------------------------------------------------------------------------- 1 | 'PRIVATE',// Conversation types: PRIVATE, GROUP, DISCUSSION, SYSTEM 20 | 'userId'=>'Vu-oC0_LQ6kgPqltm_zYtI',// Session owner 21 | 'targetId'=>'Vu-oC0_LQ6kgPqltm_zYtI'// Session ID 22 | ]; 23 | $result = $RongSDK->getConversation()->mute($conversation); 24 | Utils::dump("Set user's session screen to Push",$result); 25 | } 26 | mute(); 27 | 28 | /** 29 | * Set the user to receive Push notifications for a specific session 30 | */ 31 | function unmute() 32 | { 33 | 34 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 35 | $conversation = [ 36 | 'type'=> 'PRIVATE',// Session types PRIVATE, GROUP, DISCUSSION, SYSTEM 37 | 'userId'=>'mka091amn',// Session owner 38 | 'targetId'=>'adm1klnm'// Session ID 39 | ]; 40 | $result = $RongSDK->getConversation()->unmute($conversation); 41 | Utils::dump("Set the user to receive Push notifications for a specific session",$result); 42 | } 43 | unmute(); 44 | 45 | /** 46 | * Set whether a conversation is pinned. 47 | */ 48 | function pinned() 49 | { 50 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 51 | $conversation = [ 52 | 'userId'=>'mka091amn', 53 | 'conversationType'=>'1', 54 | 'targetId'=>'adm1klnd', 55 | 'setTop'=>'true' 56 | ]; 57 | $result = $RongSDK->getConversation()->pinned($conversation); 58 | Utils::dump("Set whether a conversation is pinned",$result); 59 | } 60 | pinned(); 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /RongCloud/example/Entrust/GroupManager.php: -------------------------------------------------------------------------------- 1 | 'RC_GROUP_1', 21 | 'userIds' => ['C_U_1', 'C_U_2', 'C_U_3'] 22 | ]; 23 | $result = $RongSDK->getEntrust()->GroupManager()->add($param); 24 | Utils::dump("Set group administrator (Add group administrator)", $result); 25 | } 26 | add(); 27 | 28 | /** 29 | * Remove group administrator 30 | */ 31 | function remove() 32 | { 33 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 34 | $param = [ 35 | 'groupId' => 'RC_GROUP_1', 36 | 'userIds' => ['C_U_1', 'C_U_2', 'C_U_3'] 37 | ]; 38 | $result = $RongSDK->getEntrust()->GroupManager()->remove($param); 39 | Utils::dump("Remove group administrator", $result); 40 | } 41 | remove(); -------------------------------------------------------------------------------- /RongCloud/example/Entrust/GroupRemarkName.php: -------------------------------------------------------------------------------- 1 | 'RC_GROUP_1', 21 | 'userId' => '222', 22 | 'remarkName' => 'rongcloud' 23 | ]; 24 | $result = $RongSDK->getEntrust()->GroupRemarkName()->set($param); 25 | Utils::dump("Set the user-specified group name remark", $result); 26 | } 27 | remarkNameSet(); 28 | 29 | /** 30 | * Set user-specified group name annotation 31 | */ 32 | function remarkNameDelete() 33 | { 34 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 35 | $param = [ 36 | 'groupId' => 'RC_GROUP_1', 37 | 'userId' => '222' 38 | ]; 39 | $result = $RongSDK->getEntrust()->GroupRemarkName()->delete($param); 40 | Utils::dump("Set user-specified group name annotation", $result); 41 | } 42 | remarkNameDelete(); 43 | 44 | /** 45 | * Query the specified group name for user remarks 46 | */ 47 | function remarkNameQuery() 48 | { 49 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 50 | $param = [ 51 | 'groupId' => 'RC_GROUP_1', 52 | 'userId' => '222' 53 | ]; 54 | $result = $RongSDK->getEntrust()->GroupRemarkName()->query($param); 55 | Utils::dump("Query the specified group name for user remarks", $result); 56 | } 57 | remarkNameQuery(); 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /RongCloud/example/Group/Gag.php: -------------------------------------------------------------------------------- 1 | 'php group1',// Group ID 21 | 'members'=>[ // Forbidden personnel list 22 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 23 | ] 24 | , 25 | 'minute'=>3000 // Forbidden duration 26 | ]; 27 | $result = $RongSDK->getGroup()->Gag()->add($group); 28 | Utils::dump("Add group ban words",$result); 29 | } 30 | add(); 31 | /** 32 | * Query the list of banned members 33 | */ 34 | function getList() 35 | { 36 | 37 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 38 | $group = [ 39 | 'id'=> 'php group1',// group id 40 | ]; 41 | $result = $RongSDK->getGroup()->Gag()->getList($group); 42 | Utils::dump("Query the list of banned members",$result); 43 | } 44 | getList(); 45 | /** 46 | * Unblock 47 | */ 48 | function remove() 49 | { 50 | 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $group = [ 53 | 'id'=> 'php group1',// Group ID 54 | 'members'=>[ //Unblock the list of banned personnel 55 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 56 | ] 57 | ]; 58 | $result = $RongSDK->getGroup()->Gag()->remove($group); 59 | Utils::dump("Unblock",$result); 60 | } 61 | remove(); 62 | 63 | 64 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Group/Group.php: -------------------------------------------------------------------------------- 1 | 'uPj70HUrRSUk-ixtt7iIGc',// User ID 21 | 'groups'=>[['id'=> 'php group1', 'name'=> 'watergroup']]// User group information 22 | ]; 23 | $result = $RongSDK->getGroup()->sync($group); 24 | Utils::dump("Group information synchronization",$result); 25 | } 26 | sync(); 27 | 28 | /** 29 | * Create a group 30 | */ 31 | function create() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $group = [ 35 | 'id'=> 'php group1',// Group ID 36 | 'name'=> 'watergroup',// Group name 37 | 'members'=>[ // Group member list 38 | ['id'=> 'uPj70HUrRSUk-ixtt7iIGc'],['id'=>'Vu-oC0_LQ6kgPqltm_zYtI'] 39 | ] 40 | ]; 41 | $result = $RongSDK->getGroup()->create($group); 42 | Utils::dump("Create a group",$result); 43 | } 44 | create(); 45 | 46 | /** 47 | * Get group information 48 | */ 49 | function get() 50 | { 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $group = [ 53 | 'id'=> 'php group1',// @param group id 54 | ]; 55 | $result = $RongSDK->getGroup()->get($group); 56 | Utils::dump("Get group information",$result); 57 | } 58 | get(); 59 | 60 | /** 61 | * Join the group 62 | */ 63 | function joins() 64 | { 65 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 66 | $group = [ 67 | 'id'=> 'php group1',// Group ID 68 | 'name'=>"watergroup",// Group name 69 | 'member'=>['id'=> 'group999'],// Group member information 70 | ]; 71 | $result = $RongSDK->getGroup()->joins($group); 72 | Utils::dump("Join the group",$result); 73 | } 74 | joins(); 75 | 76 | /** 77 | * Exit group 78 | */ 79 | function quit() 80 | { 81 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 82 | $group = [ 83 | 'id'=> 'php group1',// Group ID 84 | 'member'=>['id'=> 'uPj70HUrRSUk-ixtt7iIGc']// Exit personnel information 85 | ]; 86 | $result = $RongSDK->getGroup()->quit($group); 87 | Utils::dump("Exit group",$result); 88 | } 89 | quit(); 90 | 91 | /** 92 | * Disband the group 93 | */ 94 | function dismiss() 95 | { 96 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 97 | $group = [ 98 | 'id'=> 'php group1',// Group ID 99 | 'member'=>['id'=> 'group999']// Administrator Information 100 | ]; 101 | $result = $RongSDK->getGroup()->dismiss($group); 102 | Utils::dump("Disband the group",$result); 103 | } 104 | dismiss(); 105 | 106 | /** 107 | * Modify group information 108 | */ 109 | function update() 110 | { 111 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 112 | $group = [ 113 | 'id'=> 'php group1',// Group ID 114 | 'name'=>"watergroup"// group name 115 | ]; 116 | $result = $RongSDK->getGroup()->update($group); 117 | Utils::dump("Modify group information",$result); 118 | } 119 | update(); 120 | 121 | -------------------------------------------------------------------------------- /RongCloud/example/Group/MuteAllMembers.php: -------------------------------------------------------------------------------- 1 | 'php group1',// group id 21 | ]; 22 | $result = $RongSDK->getGroup()->MuteAllMembers()->add($group); 23 | Utils::dump("Add group ban",$result); 24 | } 25 | add(); 26 | /** 27 | * Query the list of banned members 28 | */ 29 | function getList() 30 | { 31 | 32 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 33 | $group = [ 34 | 35 | ]; 36 | $result = $RongSDK->getGroup()->MuteAllMembers()->getList($group); 37 | Utils::dump("Query the list of banned members",$result); 38 | } 39 | getList(); 40 | /** 41 | * Remove ban 42 | */ 43 | function remove() 44 | { 45 | 46 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 47 | $group = [ 48 | 'id'=> 'php group1',// group id 49 | ]; 50 | $result = $RongSDK->getGroup()->MuteAllMembers()->remove($group); 51 | Utils::dump("Remove ban",$result); 52 | } 53 | remove(); 54 | 55 | 56 | -------------------------------------------------------------------------------- /RongCloud/example/Group/MuteWhiteList.php: -------------------------------------------------------------------------------- 1 | 'php group1',// Group ID 21 | 'members'=>[// Forbidden personnel whitelist 22 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 23 | ] 24 | , 25 | ]; 26 | $result = $RongSDK->getGroup()->MuteWhiteList()->add($group); 27 | Utils::dump("Add group blocklist",$result); 28 | } 29 | add(); 30 | /** 31 | * Query the forbidden whitelist member list 32 | */ 33 | function getList() 34 | { 35 | 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $group = [ 38 | 'id'=> 'php group1',// group id 39 | ]; 40 | $result = $RongSDK->getGroup()->MuteWhiteList()->getList($group); 41 | Utils::dump("Query the forbidden whitelist member list",$result); 42 | } 43 | getList(); 44 | /** 45 | * Remove the ban from the whitelist 46 | */ 47 | function remove() 48 | { 49 | 50 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 51 | $group = [ 52 | 'id'=> 'php group1',// Group ID 53 | 'members'=>[ //Unblock the whitelist personnel list 54 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 55 | ] 56 | ]; 57 | $result = $RongSDK->getGroup()->MuteWhiteList()->remove($group); 58 | Utils::dump("Remove the ban from the whitelist",$result); 59 | } 60 | remove(); 61 | 62 | 63 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Group/Remark.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha1',// @param personnelId 21 | 'groupId'=>'abca',// Group ID 22 | 'remark'=> '人员备注'// Group annotation 23 | ]; 24 | $Remark = $RongSDK->getGroup()->Remark()->set($group); 25 | Utils::dump("Add group annotation",$Remark); 26 | } 27 | set(); 28 | 29 | /** 30 | * Delete group backup 31 | */ 32 | function del() 33 | { 34 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 35 | $group = [ 36 | 'userId'=> 'ujadk90ha11',// Personnel ID 37 | 'groupId'=>'abca',// Group ID 38 | ]; 39 | $Remark = $RongSDK->getGroup()->Remark()->del($group); 40 | Utils::dump("Delete group backup",$Remark); 41 | } 42 | del(); 43 | 44 | /** 45 | * Get group remarks 46 | */ 47 | function get() 48 | { 49 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 50 | $group = [ 51 | 'userId'=> 'ujadk90ha1',// Personnel ID 52 | /* Personnel ID */ 53 | 'groupId'=>'abca',// Group ID 54 | ]; 55 | $Remark = $RongSDK->getGroup()->Remark()->get($group); 56 | Utils::dump("Get group remarks",$Remark); 57 | } 58 | get(); -------------------------------------------------------------------------------- /RongCloud/example/Message/Broadcast.php: -------------------------------------------------------------------------------- 1 | 'test',// Sender ID 21 | "objectName"=>'RC:RcCmd',// Message type 22 | 'content'=>json_encode([ 23 | 'uId'=>'xxxxx',// The unique message identifier, obtained after sending a broadcast message via /push, returns the name as id. 24 | 'isAdmin'=>'0',// Whether it is an administrator, default is 0; when set to 1, IMKit SDK will display the gray bar as "Admin revoked a message" upon receiving this message. 25 | 'isDelete'=>'0'// Whether to delete the message, default is 0: when the message is revoked, the client will delete the message and replace it with a small gray bar revocation prompt message; when it is 1, after the message is deleted, it will not be replaced with a small gray bar prompt message. 26 | ]) 27 | ]; 28 | $Result = $RongSDK->getMessage()->Broadcast()->recall($message); 29 | Utils::dump("Broadcast message recall",$Result); 30 | } 31 | recall(); 32 | 33 | -------------------------------------------------------------------------------- /RongCloud/example/Message/Chatroom.php: -------------------------------------------------------------------------------- 1 | 'aP9uvganV',// Sender ID 21 | 'targetId'=> ['OIBbeKlkx'],// Chat room ID 22 | "objectName"=>'RC:TxtMsg',// Message type: Text 23 | 'content'=>json_encode(['content'=>'php chatroom 你好,主播'])// Message content 24 | ]; 25 | $Chartromm = $RongSDK->getMessage()->Chatroom()->send($message); 26 | Utils::dump("Send messages in the chat room",$Chartromm); 27 | } 28 | send(); 29 | 30 | /** 31 | * Chat room broadcast message 32 | */ 33 | function broadcast() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $message = [ 37 | 'senderId'=> 'aP9uvganV',// Sender ID 38 | "objectName"=>'RC:TxtMsg',// Message type Text 39 | 'content'=>json_encode(['content'=>'php Chatroom Broadcast 你好,主播'])// Message content 40 | ]; 41 | $Chartromm = $RongSDK->getMessage()->Chatroom()->broadcast($message); 42 | Utils::dump("Chat room broadcast message",$Chartromm); 43 | } 44 | broadcast(); 45 | 46 | /** 47 | * Withdraw a sent chat room message 48 | */ 49 | function recall() 50 | { 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $message = [ 53 | 'senderId'=> 'ujadk90ha',// Sender Id 54 | 'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Chat room id 55 | "uId"=>'5GSB-RPM1-KP8H-9JHF',// The unique identifier of the message 56 | 'sentTime'=>'1519444243981'// Message delivery time 57 | ]; 58 | $Result = $RongSDK->getMessage()->Chatroom()->recall($message); 59 | Utils::dump("Withdraw a sent chat room message",$Result); 60 | } 61 | recall(); 62 | 63 | -------------------------------------------------------------------------------- /RongCloud/example/Message/Group.php: -------------------------------------------------------------------------------- 1 | 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID 21 | 'targetId'=> ['php group1'],// Group ID 22 | "objectName"=>'RC:TxtMsg',// Message type Text 23 | 'content'=>json_encode(['content'=>'PHP group message, hello, Xiaoming.'])// Message Body 24 | ]; 25 | $Result = $RongSDK->getMessage()->Group()->send($message); 26 | Utils::dump("Group message sending",$Result); 27 | } 28 | send(); 29 | 30 | /** 31 | * Send @ message 32 | */ 33 | function sendMention() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $message = [ 37 | 'senderId'=> 'ujadk90ha',// Sender ID 38 | 'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Group ID 39 | "objectName"=>'RC:TxtMsg',// Message type Text 40 | 'content'=>json_encode([// Message content 41 | 'content'=>'PHP group @message, hello, Xiaoming', 42 | 'mentionedInfo'=>[ 43 | 'type'=>'1',// Function type, 1 indicates @ all users, 2 indicates @ specified user 44 | 'userIds'=>['uPj70HUrRSUk-ixtt7iIGc'],// The @ list must be filled when the type is 2, and can be empty when the type is 1. 45 | 'pushContent'=>'PHP push greeting message'// Custom @ Message Push Content 46 | ] 47 | ]) 48 | ]; 49 | $Result = $RongSDK->getMessage()->Group()->sendMention($message); 50 | Utils::dump("Send @ message",$Result); 51 | } 52 | sendMention(); 53 | 54 | /** 55 | * Group status message sending 56 | */ 57 | function sendStatusMessage() 58 | { 59 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 60 | $message = [ 61 | 'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID 62 | 'targetId'=> ['php group1'],// Group ID 63 | "objectName"=>'RC:TxtMsg',// Message type Text 64 | 'content'=>json_encode(['content'=>'PHP group status message, hello, Xiaoming.'])// Message Body 65 | ]; 66 | $Result = $RongSDK->getMessage()->Group()->sendStatusMessage($message); 67 | Utils::dump("Group status message sending",$Result); 68 | } 69 | sendStatusMessage(); 70 | 71 | /** 72 | * Recall a sent group chat message 73 | */ 74 | function recall() 75 | { 76 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 77 | $message = [ 78 | 'senderId'=> 'ujadk90ha',//Sender ID 79 | 'targetId'=> ['STRe0shISpQlSOBvek1FfU'],//Group ID 80 | "uId"=>'5GSB-RPM1-KP8H-9JHF',//The unique identifier of the message 81 | 'sentTime'=>'1519444243981'//Message sending time 82 | ]; 83 | $Result = $RongSDK->getMessage()->Group()->recall($message); 84 | Utils::dump("Recall a sent group chat message",$Result); 85 | } 86 | recall(); 87 | -------------------------------------------------------------------------------- /RongCloud/example/Message/History.php: -------------------------------------------------------------------------------- 1 | '2019011711',//Date 21 | ]; 22 | $Chartromm = $RongSDK->getMessage()->History()->get($message); 23 | Utils::dump("Historical message retrieval",$Chartromm); 24 | } 25 | get(); 26 | 27 | /** 28 | * Historical message file deletion 29 | */ 30 | function remove() 31 | { 32 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 33 | $message = [ 34 | 'date'=> '2018011116',//Date 35 | ]; 36 | $Chartromm = $RongSDK->getMessage()->History()->remove($message); 37 | Utils::dump("Historical message file deletion",$Chartromm); 38 | } 39 | remove(); 40 | 41 | /** 42 | * Message clearance 43 | */ 44 | function clean() 45 | { 46 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 47 | $message = [ 48 | 'conversationType'=> '1',//Conversation types, supporting single chat, group chat, and system notifications. Single chat is 1, group chat is 3, and system notification is 6. 49 | 'fromUserId'=>"fromUserId",//@param userID The user ID 50 | //@param msgTimestamp The timestamp of the session message to delete historical messages before 51 | 'targetId'=>"userId",//The target session ID that needs to be cleared 52 | 'msgTimestamp'=>"1588838388320",//Clear all historical messages before the specified timestamp, accurate to the millisecond, to empty all historical messages of the session. 53 | ]; 54 | $Chartromm = $RongSDK->getMessage()->History()->clean($message); 55 | Utils::dump("Message clearance",$Chartromm); 56 | } 57 | clean(); 58 | -------------------------------------------------------------------------------- /RongCloud/example/Message/Person.php: -------------------------------------------------------------------------------- 1 | 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID 23 | 'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//recipient id 24 | "objectName"=>'RC:TxtMsg',//Message type Text 25 | 'content'=>json_encode(['content'=>'Hello, this is a two-person message'])//Message content 26 | ]; 27 | $Chartromm = $RongSDK->getMessage()->Person()->send($message); 28 | Utils::dump("Two-person message sending",$Chartromm); 29 | } 30 | send(); 31 | 32 | /** 33 | * Send different content messages to multiple users 34 | */ 35 | function sendTemplate() 36 | { 37 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 38 | $message = [ 39 | 'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID 40 | 'objectName'=>'RC:TxtMsg',//Message type: Text 41 | 'template'=>json_encode(['content'=>'{name}, Language score {score}']),// Template content 42 | 'content'=>json_encode([ 43 | 'uPj70HUrRSUk-ixtt7iIGc'=>[//Recipient ID 44 | 'data'=>['{name}'=>'Xiaoming','{score}'=>'90'],//Template Data 45 | 'push'=>'{name} 你的成绩出来了',//Push content 46 | ], 47 | 'Vu-oC0_LQ6kgPqltm_zYtI'=>[//Recipient ID 48 | 'data'=>['{name}'=>'XiaoHong','{score}'=>'95'],// Template Data 49 | 'push'=>'{name} Your grades are in.',//push notification content 50 | ] 51 | ]) 52 | ]; 53 | $Chartromm = $RongSDK->getMessage()->Person()->sendTemplate($message); 54 | Utils::dump("Send different content messages to multiple users",$Chartromm); 55 | } 56 | sendTemplate(); 57 | 58 | /** 59 | * Two-person status message sending 60 | */ 61 | function sendStatusMessage() 62 | { 63 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 64 | $message = [ 65 | 'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID 66 | 'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//Recipient ID 67 | "objectName"=>'RC:TxtMsg',//Message type Text 68 | 'content'=>json_encode(['content'=>'Hello, this is a two-person status message.'])//Message content 69 | ]; 70 | $Chartromm = $RongSDK->getMessage()->Person()->sendStatusMessage($message); 71 | Utils::dump("Two-person status message sending",$Chartromm); 72 | } 73 | sendStatusMessage(); 74 | /** 75 | * Two-person message recall 76 | */ 77 | function recall() 78 | { 79 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 80 | $message = [ 81 | 'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID 82 | 'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//Recipient ID 83 | "uId"=>'5GSB-RPM1-KP8H-9JHF',//Message unique identifier 84 | 'sentTime'=>'1519444243981'//Send time 85 | ]; 86 | $Chartromm = $RongSDK->getMessage()->Person()->recall($message); 87 | Utils::dump("Two-person message recall",$Chartromm); 88 | } 89 | recall(); 90 | -------------------------------------------------------------------------------- /RongCloud/example/Message/Ultragroup.php: -------------------------------------------------------------------------------- 1 | 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID 21 | 'targetId'=> ['phpgroup1'],// Super group ID 22 | "objectName"=>'RC:TxtMsg',// Message type Text 23 | 'content'=>json_encode(['content'=>'php Group message, hello, Xiaoming'])// Message Body 24 | ]; 25 | $Result = $RongSDK->getMessage()->Ultragroup()->send($message); 26 | Utils::dump("Super group message delivery",$Result); 27 | } 28 | send(); 29 | 30 | /** 31 | * Send @ message 32 | */ 33 | function sendMention() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $message = [ 37 | 'senderId'=> 'ujadk90ha',// Sender ID 38 | 'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Supergroup ID 39 | "objectName"=>'RC:TxtMsg',// Message type: Text 40 | 'content'=>json_encode([// Message content 41 | 'content'=>'PHP Group @message, hello, Xiaoming', 42 | 'mentionedInfo'=>[ 43 | 'type'=>'1',// @function type, 1 represents @all, 2 represents @specified user 44 | 'userIds'=>['uPj70HUrRSUk-ixtt7iIGc'],// The @ list is mandatory when type is 2, and can be empty when type is 1 45 | 'pushContent'=>'php push greeting message'// Custom @ Message Push Content 46 | ] 47 | ]) 48 | ]; 49 | $Result = $RongSDK->getMessage()->Ultragroup()->sendMention($message); 50 | Utils::dump("Send @ message",$Result); 51 | } 52 | sendMention(); 53 | /** 54 | * Supergroup message recall 55 | */ 56 | function recall() 57 | { 58 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 59 | $message = [ 60 | 'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID 61 | 'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],// Group ID 62 | "uId"=>'5GSB-RPM1-KP8H-9JHF',// Message unique identifier 63 | 'sentTime'=>'1519444243981'// Delivery Time 64 | /* Delivery Time */ 65 | ]; 66 | $Chartromm = $RongSDK->getMessage()->Ultragroup()->recall($message); 67 | Utils::dump("Supergroup message recall",$Chartromm); 68 | } 69 | recall(); 70 | -------------------------------------------------------------------------------- /RongCloud/example/Push/Push.php: -------------------------------------------------------------------------------- 1 | ['ios','android'],// Target operating system 21 | 'fromuserid'=>'mka091amn',// Recipient User ID 22 | 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 23 | 'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],// Send message content 24 | 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']] 25 | ]; 26 | $result = $RongSDK->getPush()->broadcast($sensitive); 27 | Utils::dump("Broadcast Message",$result); 28 | } 29 | broadcast(); 30 | 31 | /** 32 | * Push notifications 33 | */ 34 | function push() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $sensitive = [ 38 | 'platform'=> ['ios','android'],// Target operating system 39 | 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 40 | 'notification'=>['alert'=>"this is a push"] 41 | ]; 42 | $result = $RongSDK->getPush()->push($sensitive); 43 | Utils::dump("Push notifications",$result); 44 | } 45 | push(); 46 | 47 | -------------------------------------------------------------------------------- /RongCloud/example/Sensitive/Sensitive.php: -------------------------------------------------------------------------------- 1 | '***',// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word filtering can be empty 23 | 'keyword' => "abc",// Sensitive word 24 | 'type' => 0// 0: Sensitive word substitution 1: Sensitive word filtering 25 | ]; 26 | $result = $RongSDK->getSensitive()->add($sensitive); 27 | Utils::dump("Add sensitive words", $result); 28 | } 29 | add(); 30 | 31 | function batchAdd() 32 | { 33 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 34 | $sensitive = [ 35 | 'words' => [ 36 | [ 37 | 'word' => "abc1",// Screen 38 | ], 39 | [ 40 | 'word' => "abc2",// Sensitive words 41 | 'replaceWord' => '***'// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word screening can be empty 42 | ] 43 | ] 44 | ]; 45 | $result = $RongSDK->getSensitive()->batchAdd($sensitive); 46 | Utils::dump("batchAdd", $result); 47 | } 48 | batchAdd(); 49 | 50 | /** 51 | * Remove sensitive words 52 | */ 53 | function remove() 54 | { 55 | 56 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 57 | $sensitive = [ 58 | 'keywords' => ["cccccdddd"]// Delete sensitive words 59 | ]; 60 | $result = $RongSDK->getSensitive()->remove($sensitive); 61 | Utils::dump("Remove sensitive words", $result); 62 | } 63 | remove(); 64 | 65 | /** 66 | * Get the list of sensitive words 67 | */ 68 | function getList() 69 | { 70 | 71 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 72 | $sensitive = [ 73 | 'type' => '',// Sensitive word type, 0: Sensitive word replacement, 1: Sensitive word shielding, empty to retrieve all 74 | ]; 75 | $result = $RongSDK->getSensitive()->getList($sensitive); 76 | Utils::dump("Get the list of sensitive words", $result); 77 | } 78 | getList(); 79 | -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/Expansion.php: -------------------------------------------------------------------------------- 1 | 'BS45-NPH4-HV87-10LM', // The unique message identifier, which the server can obtain through the full message routing function. 26 | 'userId' => 'WNYZbMqpH', // The user ID for extended message delivery needs to be set. 27 | 'groupId' => 'tjw3zbMrU', // Super group ID 28 | 'busChannel' => '', // Channel ID can be empty 29 | 'extraKeyVal' => ['type1' => '1', 'type2' => '2', 'type3' => '3', 'type4' => '4',]// Custom message extension content, JSON structure, set in Key-Value format 30 | ]; 31 | $res = $RongSDK->getUltragroup()->Expansion()->set($message); 32 | Utils::dump("Message Sending", $res); 33 | } 34 | set(); 35 | 36 | 37 | function delete() 38 | { 39 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 40 | $message = [ 41 | 'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier ID, which the server can obtain through the full message routing function. 42 | 'userId' => 'WNYZbMqpH', // Need to set the extended message sending user Id. 43 | 'groupId' => 'tjw3zbMrU', // Super group ID 44 | 'busChannel' => '', // The channel ID can be empty 45 | 'extraKey' => ['type1', 'type2'] // The Key value of the extension information to be deleted, with a maximum of 100 extension information items that can be deleted at once 46 | ]; 47 | $res = $RongSDK->getUltragroup()->Expansion()->delete($message); 48 | Utils::dump("delete", $res); 49 | } 50 | delete(); 51 | 52 | /** 53 | * Get supergroup extension message 54 | */ 55 | function getList() 56 | { 57 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 58 | $message = [ 59 | 'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier ID, which can be obtained by the server through the full message routing function. 60 | 'groupId'=>"aaa" ,// Super cluster ID 61 | 'busChannel'=>"aaa" ,// Super Group Channel 62 | 'pageNo' => 1 // Page count, defaults to returning 300 extended information. 63 | ]; 64 | $res = $RongSDK->getUltragroup()->Expansion()->getList($message); 65 | Utils::dump("Get supergroup extension message", $res); 66 | } 67 | getList(); 68 | -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/Gag.php: -------------------------------------------------------------------------------- 1 | 'phpgroup1',// Supergroup ID 21 | 'members'=>[// Forbidden personnel list 22 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 23 | ] 24 | , 25 | 'minute'=>3000 // Forbidden utterance duration 26 | ]; 27 | $result = $RongSDK->getUltragroup()->Gag()->add($group); 28 | Utils::dump("Add super group ban speech",$result); 29 | } 30 | add(); 31 | /** 32 | * Query the list of banned members 33 | */ 34 | function getList() 35 | { 36 | 37 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 38 | $group = [ 39 | 'id'=> 'phpgroup1',// Ultra Group ID 40 | ]; 41 | $result = $RongSDK->getUltragroup()->Gag()->getList($group); 42 | Utils::dump("Query the list of banned members",$result); 43 | } 44 | getList(); 45 | /** 46 | * Lift the ban 47 | */ 48 | function remove() 49 | { 50 | 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $group = [ 53 | 'id'=> 'phpgroup1',// Supergroup ID 54 | 'members'=>[// Unban user list 55 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 56 | ] 57 | ]; 58 | $result = $RongSDK->getUltragroup()->Gag()->remove($group); 59 | Utils::dump("Lift the ban",$result); 60 | } 61 | remove(); 62 | 63 | 64 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/MuteAllMembers.php: -------------------------------------------------------------------------------- 1 | 'phpgroup1',// Super group ID 21 | "status"=>1 22 | ]; 23 | $result = $RongSDK->getUltragroup()->MuteAllMembers()->set($group); 24 | Utils::dump("Set supergroup ban",$result); 25 | } 26 | set(); 27 | /** 28 | * Query the status of super group bans 29 | */ 30 | function get() 31 | { 32 | 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $group = [ 35 | 'id'=> 'phpgroup1',// Ultra group ID 36 | ]; 37 | $result = $RongSDK->getUltragroup()->MuteAllMembers()->get($group); 38 | Utils::dump("Query the status of super group bans",$result); 39 | } 40 | get(); 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/MuteWhiteList.php: -------------------------------------------------------------------------------- 1 | 'phpgroup1',// Super group ID 21 | 'members'=>[// Forbidden whitelist personnel list 22 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 23 | ] 24 | , 25 | ]; 26 | $result = $RongSDK->getUltragroup()->MuteWhiteList()->add($group); 27 | Utils::dump("Add super group ban whitelist",$result); 28 | } 29 | add(); 30 | /** 31 | * Query the list of members in the forbidden word whitelist 32 | */ 33 | function getList() 34 | { 35 | 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $group = [ 38 | 'id'=> 'phpgroup1',// Ultra group ID 39 | ]; 40 | $result = $RongSDK->getUltragroup()->MuteWhiteList()->getList($group); 41 | Utils::dump("Query the list of members in the forbidden word whitelist",$result); 42 | } 43 | getList(); 44 | /** 45 | * Remove the denylist whitelist 46 | */ 47 | function remove() 48 | { 49 | 50 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 51 | $group = [ 52 | 'id'=> 'phpgroup1',// Super group ID 53 | 'members'=>[ //Unblock whitelisted personnel list 54 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 55 | ] 56 | ]; 57 | $result = $RongSDK->getUltragroup()->MuteWhiteList()->remove($group); 58 | Utils::dump("Remove the denylist whitelist",$result); 59 | } 60 | remove(); 61 | 62 | 63 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/Notdisturb.php: -------------------------------------------------------------------------------- 1 | 'phpgroup1',// Super group ID 21 | 'busChannel'=>"", 22 | "unpushLevel"=>1 23 | // Do Not Disturb Level 24 | // -1: All message notifications 25 | // 0: Not set (When the user has not set this state, it is the default state for all notifications. In this state, if a super group default state is set, the super group's default settings will be used as the standard) 26 | // 1: Only notify for @ messages, including @specific users and @everyone 27 | // Only notify the specified user with @, and only notify the user specified by @. 28 | //@Zhang San will receive the push notification, @all will not receive the push notification. 29 | // This is a sample comment 30 | /* 31 | * This is a multi-line comment 32 | * @param {string} input - The input string to process 33 | */ 34 | // Only notify @all members, and only receive push messages from @everyone 35 | // 5: No notifications will be received, even if it is an @ message. 36 | ]; 37 | $result = $RongSDK->getUltragroup()->Notdisturb()->set($group); 38 | Utils::dump("Set super group do not disturb",$result); 39 | } 40 | set(); 41 | /** 42 | * Query super group mute 43 | */ 44 | function get() 45 | { 46 | 47 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 48 | $group = [ 49 | 'id'=> 'phpgroup1',// Super group ID 50 | 'busChannel'=>"", 51 | ]; 52 | $result = $RongSDK->getUltragroup()->Notdisturb()->get($group); 53 | Utils::dump("Query super group mute",$result); 54 | } 55 | get(); 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /RongCloud/example/Ultragroup/Ultragroup.php: -------------------------------------------------------------------------------- 1 | 'phpgroup1',// Super group ID 22 | 'name'=> 'watergroup',// Supergroup Name 23 | 'member'=>['id'=> 'group999'],// Create a userId 24 | ]; 25 | $result = $RongSDK->getUltragroup()->create($group); 26 | Utils::dump("Create a super group",$result); 27 | } 28 | create(); 29 | 30 | /** 31 | * Join the super group 32 | */ 33 | function joins() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $group = [ 37 | 'id'=> 'phpgroup1',// Super group ID 38 | 'member'=>['id'=> 'group999'],// Group member information 39 | ]; 40 | $result = $RongSDK->getUltragroup()->joins($group); 41 | Utils::dump("Join the super group",$result); 42 | } 43 | joins(); 44 | 45 | 46 | /** 47 | * Exit super group 48 | */ 49 | function quit() 50 | { 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $group = [ 53 | 'id'=> 'phpgroup1',// Super group ID 54 | 'member'=>['id'=> 'uPj70HUrRSUk-ixtt7iIGc']// Exit personnel information 55 | ]; 56 | $result = $RongSDK->getUltragroup()->quit($group); 57 | Utils::dump("Exit super group",$result); 58 | } 59 | quit(); 60 | 61 | /** 62 | * Disassemble super cluster 63 | */ 64 | function dismiss() 65 | { 66 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 67 | $group = [ 68 | 'id'=> 'phpgroup1',// Ultra group ID 69 | ]; 70 | $result = $RongSDK->getUltragroup()->dismiss($group); 71 | Utils::dump("Disassemble super cluster",$result); 72 | } 73 | dismiss(); 74 | 75 | /** 76 | * Modify group information 77 | */ 78 | function update() 79 | { 80 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 81 | $group = [ 82 | 'id'=> 'phpgroup1',// Supergroup ID 83 | 'name'=>"watergroup"// group name 84 | ]; 85 | $result = $RongSDK->getUltragroup()->update($group); 86 | Utils::dump("Modify group information",$result); 87 | } 88 | update(); 89 | 90 | /** 91 | * Whether the group member exists 92 | */ 93 | function isExist() 94 | { 95 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 96 | $group = [ 97 | 'id'=> 'phpgroup1',// Super group ID 98 | 'member'=>"userId1"// Member ID 99 | ]; 100 | $result = $RongSDK->getUltragroup()->isExist($group); 101 | Utils::dump("Whether the group member exists ",$result); 102 | } 103 | isExist(); 104 | 105 | -------------------------------------------------------------------------------- /RongCloud/example/User/Ban.php: -------------------------------------------------------------------------------- 1 | ['kkj9o01', 'kkj9o02'], // Banned user Ids, supports batch setting, with a maximum of no more than 1000. 23 | 'state' => 1, // Forbidden status, 0 Remove forbidden. 1 Add forbidden 24 | 'type' => 'PERSON', // conversation type, currently supports single conversation PERSON 25 | ]; 26 | $res = $RongSDK->getUser()->Ban()->set($user); 27 | Utils::dump("set", $res); 28 | } 29 | set(); 30 | 31 | /** 32 | * Query the list of users with single chat ban remarks 33 | */ 34 | function getList() 35 | { 36 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 37 | $param = [ 38 | 'num' => 101, // Get the number of rows, default is 100, maximum support is 200. 39 | 'offset' => 0, // The starting position for the query, default is 0. 40 | 'type' => 'PERSON'// Conversation type, currently supports single conversation PERSON. 41 | ]; 42 | $res = $RongSDK->getUser()->Ban()->getList($param); 43 | Utils::dump("getList", $res); 44 | } 45 | getList(); 46 | -------------------------------------------------------------------------------- /RongCloud/example/User/Blacklist.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha',// User ID 21 | 'blacklist'=> ['kkj9o01']// List of personnel to be added to the blacklist 22 | ]; 23 | $Blacklist = $RongSDK->getUser()->Blacklist()->add($user); 24 | Utils::dump("add",$Blacklist); 25 | } 26 | add(); 27 | 28 | /** 29 | * Remove blacklist 30 | */ 31 | function remove() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $user = [ 35 | 'id'=> 'ujadk90ha',// User ID 36 | 'blacklist'=> ['kkj9o02']// List of personnel requiring removal from the blacklist 37 | ]; 38 | $Blacklist = $RongSDK->getUser()->Blacklist()->remove($user); 39 | Utils::dump("remove",$Blacklist); 40 | } 41 | remove(); 42 | 43 | /** 44 | * User blacklist 45 | */ 46 | function getList() 47 | { 48 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 49 | $user = [ 50 | 'id'=> 'ujadk90ha',// User ID 51 | 'size'=> 1000,// @param pageSize The number of rows per page when fetching the blacklist user list, default is 1000 if not provided, maximum does not exceed 1000 52 | 'pageToken'=> ''// Pagination information, the previous request returns next, no pagination processing when not transmitting, defaults to fetching the first 1000 user lists, sorted in reverse order by blacklist addition time. 53 | ]; 54 | $Blacklist = $RongSDK->getUser()->Blacklist()->getList($user); 55 | Utils::dump("getList",$Blacklist); 56 | } 57 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/User/Block.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha1',// User ID unique identifier, maximum length 30 characters 21 | 'minute'=> 20// Blocking duration 1 - 1 * 30 * 24 * 60 minutes 22 | ]; 23 | $Block = $RongSDK->getUser()->Block()->add($user); 24 | Utils::dump("banned user",$Block); 25 | } 26 | add(); 27 | 28 | /** 29 | * Unblock user 30 | */ 31 | function remove() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $user = [ 35 | 'id'=> 'ujadk90ha1',// Unlock user ID unique identifier, maximum length 30 characters 36 | ]; 37 | $Block = $RongSDK->getUser()->Block()->remove($user); 38 | Utils::dump("remove",$Block); 39 | } 40 | remove(); 41 | 42 | /** 43 | * Banned user list 44 | */ 45 | function getList() 46 | { 47 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 48 | $user = [ 49 | 50 | ]; 51 | $Block = $RongSDK->getUser()->Block()->getList($user); 52 | Utils::dump("getList",$Block); 53 | } 54 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/User/BlockPushPeriod.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha',// User ID 21 | 'startTime' => "23:59:59",// Do not disturb start time 22 | 'period'=>'600',// Do not disturb duration in minutes 23 | 'level'=>1,// Do Not Disturb Level 1 only targets single chats and @ messages for notifications, including @ specific users and @ all messages. 24 | // No notifications are received, even for @ messages. 25 | ]; 26 | $Blacklist = $RongSDK->getUser()->BlockPushPeriod()->add($user); 27 | Utils::dump("add",$Blacklist); 28 | } 29 | add(); 30 | 31 | /** 32 | * Remove the do-not-disturb period 33 | */ 34 | function remove() 35 | { 36 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 37 | $user = [ 38 | 'id'=> 'ujadk90ha',// User ID 39 | ]; 40 | $Blacklist = $RongSDK->getUser()->BlockPushPeriod()->remove($user); 41 | Utils::dump("remove",$Blacklist); 42 | } 43 | 44 | 45 | /** 46 | * Get the do-not-disturb period 47 | */ 48 | function getList() 49 | { 50 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 51 | $user = [ 52 | 'id'=> 'ujadk90ha',// User ID 53 | ]; 54 | $Blacklist = $RongSDK->getUser()->BlockPushPeriod()->getList($user); 55 | Utils::dump("getList",$Blacklist); 56 | } 57 | getList(); 58 | 59 | remove(); -------------------------------------------------------------------------------- /RongCloud/example/User/MuteChatrooms.php: -------------------------------------------------------------------------------- 1 | [ 21 | ['id'=>'seal9901']// Forbidden personnel id 22 | ], 23 | 'minute'=>30// Forbidden speech duration 24 | ]; 25 | $MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->add($chatroom); 26 | Utils::dump("add",$MuteChatrooms); 27 | } 28 | add(); 29 | 30 | /** 31 | * Unmute chat room member 32 | */ 33 | function remove() 34 | { 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $chatroom = [ 37 | 'members'=> [ 38 | ['id'=>'seal9901']// Personnel ID 39 | ], 40 | ]; 41 | $MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->remove($chatroom); 42 | Utils::dump("remove",$MuteChatrooms); 43 | } 44 | remove(); 45 | 46 | /** 47 | * Get the list of muted members in the chat room 48 | */ 49 | function getList() 50 | { 51 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 52 | $chatroom = [ 53 | 54 | ]; 55 | $MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->getList($chatroom); 56 | Utils::dump("getList",$MuteChatrooms); 57 | } 58 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/User/MuteGroups.php: -------------------------------------------------------------------------------- 1 | [// Forbidden personnel list 21 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 22 | ], 23 | 'minute'=>3000 // Forbidden utterance duration 24 | ]; 25 | $result = $RongSDK->getUser()->MuteGroups()->add($group); 26 | Utils::dump("add",$result); 27 | } 28 | add(); 29 | /** 30 | * Query the list of banned members 31 | */ 32 | function getList() 33 | { 34 | 35 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 36 | $group = [ 37 | 38 | ]; 39 | $result = $RongSDK->getUser()->MuteGroups()->getList($group); 40 | Utils::dump("getList",$result); 41 | } 42 | getList(); 43 | /** 44 | * Unblock 45 | */ 46 | function remove() 47 | { 48 | 49 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 50 | $group = [ 51 | 'members'=>[ //Unblock banned user list 52 | ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] 53 | ] 54 | ]; 55 | $result = $RongSDK->getUser()->MuteGroups()->remove($group); 56 | Utils::dump("remove",$result); 57 | } 58 | remove(); 59 | 60 | 61 | getList(); -------------------------------------------------------------------------------- /RongCloud/example/User/Onlinestatus.php: -------------------------------------------------------------------------------- 1 | 'ujadk90hadsdfasdf', 21 | ]; 22 | $register = $RongSDK->getUser()->Onlinestatus()->check($user); 23 | Utils::dump("check",$register); 24 | } 25 | check(); 26 | 27 | -------------------------------------------------------------------------------- /RongCloud/example/User/Profile.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha1',// User ID 23 | 'userProfile' => [ 24 | 'name' => 'testName', 25 | 'email' => 'tester@rongcloud.cn' 26 | ], // User basic information 27 | 'userExtProfile' => [ 28 | 'ext_Profile1' => 'testpro1' 29 | ] // User extension information 30 | ]; 31 | $res = $RongSDK->getUser()->Profile()->set($params); 32 | Utils::dump("set", $res); 33 | } 34 | set(); 35 | 36 | /** 37 | * Clear user custody information 38 | */ 39 | function clean() 40 | { 41 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 42 | $params = [ 43 | 'userId' => ['ujadk90ha1', 'ujadk90ha2'],// User ID 44 | ]; 45 | $res = $RongSDK->getUser()->Profile()->clean($params); 46 | Utils::dump("clean", $res); 47 | } 48 | clean(); 49 | 50 | /** 51 | * Batch query user data 52 | */ 53 | function batchQuery() 54 | { 55 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 56 | $params = [ 57 | 'userId' => ['ujadk90ha1', 'ujadk90ha2'],// User ID 58 | ]; 59 | $res = $RongSDK->getUser()->Profile()->batchQuery($params); 60 | Utils::dump("batchQuery", $res); 61 | } 62 | batchQuery(); 63 | 64 | /** 65 | * Paginate to retrieve the full list of application users 66 | */ 67 | function query() 68 | { 69 | $RongSDK = new RongCloud(APPKEY, APPSECRET); 70 | $params = [ 71 | 'page' => 1, 72 | 'size' => 20, 73 | 'order' => 0 74 | ]; 75 | $res = $RongSDK->getUser()->Profile()->query($params); 76 | Utils::dump("query", $res); 77 | } 78 | query(); 79 | -------------------------------------------------------------------------------- /RongCloud/example/User/Remark.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha1',// User ID 21 | 'remarks'=> json_encode([['id'=>'user1','remark'=>'note4'],['id'=>'user2','remark'=>'note4']])// User Annotation 22 | ]; 23 | $Remark = $RongSDK->getUser()->Remark()->set($user); 24 | Utils::dump("set",$Remark); 25 | } 26 | set(); 27 | 28 | /** 29 | * Delete user remarks 30 | */ 31 | function del() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $user = [ 35 | 'userId'=> 'ujadk90ha1',// User ID 36 | 'targetId'=> "userId1"// User backup 37 | ]; 38 | $Remark = $RongSDK->getUser()->Remark()->del($user); 39 | Utils::dump("del",$Remark); 40 | } 41 | del(); 42 | 43 | /** 44 | * Get user remark 45 | */ 46 | function get() 47 | { 48 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 49 | $user = [ 50 | 'userId'=> 'ujadk90ha1',// User ID 51 | 'size'=>100, 52 | 'page'=>1 53 | ]; 54 | $Remark = $RongSDK->getUser()->Remark()->get($user); 55 | Utils::dump("get",$Remark); 56 | } 57 | get(); -------------------------------------------------------------------------------- /RongCloud/example/User/Tag.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha1',// User ID 21 | 'tags'=> ['tag557','tag4']// User tag 22 | ]; 23 | $Block = $RongSDK->getUser()->Tag()->set($user); 24 | Utils::dump("set",$Block); 25 | } 26 | set(); 27 | 28 | /** 29 | * Batch add user tags 30 | */ 31 | function batchset() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $user = [ 35 | 'userIds'=> ['ujadk90ha1','ujadk90ha2'],// User ID 36 | 'tags'=> ['tag567','tag2']// User tag 37 | ]; 38 | $Block = $RongSDK->getUser()->Tag()->batchset($user); 39 | Utils::dump("batchset",$Block); 40 | } 41 | batchset(); 42 | 43 | /** 44 | * Get user tags 45 | */ 46 | function get() 47 | { 48 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 49 | $user = [ 50 | 'userIds'=> ['ujadk90ha1','ujadk90ha2'],// User ID 51 | ]; 52 | $Block = $RongSDK->getUser()->Tag()->get($user); 53 | Utils::dump("get",$Block); 54 | } 55 | get(); -------------------------------------------------------------------------------- /RongCloud/example/User/Whitelist.php: -------------------------------------------------------------------------------- 1 | 'ujadk90ha',// User ID 21 | 'whitelist'=> ['kkj9o01']// The list of personnel requiring whitelist addition 22 | ]; 23 | $Whitelist = $RongSDK->getUser()->Whitelist()->add($user); 24 | Utils::dump("add",$Whitelist); 25 | } 26 | add(); 27 | 28 | /** 29 | * Remove whitelist 30 | */ 31 | function remove() 32 | { 33 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 34 | $user = [ 35 | 'id'=> 'ujadk90ha',// User ID 36 | 'whitelist'=> ['kkj9o02']// List of personnel to be removed from the whitelist 37 | ]; 38 | $Whitelist = $RongSDK->getUser()->Whitelist()->remove($user); 39 | Utils::dump("remove",$Whitelist); 40 | } 41 | remove(); 42 | 43 | /** 44 | * User whitelist 45 | */ 46 | function getList() 47 | { 48 | $RongSDK = new RongCloud(APPKEY,APPSECRET); 49 | $user = [ 50 | 'id'=> 'ujadk90ha',// User ID 51 | 'size'=> 1000,// The number of rows per page when fetching the whitelist users, defaults to 1000 if not passed, with a maximum of no more than 1000 52 | 'pageToken'=> ''// Pagination information, the next request returns 'next', no pagination processing is done when not transmitting, defaults to fetching the first 1000 user lists, sorted in reverse order by whitelist addition time. 53 | ]; 54 | $Whitelist = $RongSDK->getUser()->Whitelist()->getList($user); 55 | Utils::dump("getList",$Whitelist); 56 | } 57 | getList(); -------------------------------------------------------------------------------- /RongCloud/tests/TestConversation.php: -------------------------------------------------------------------------------- 1 | getConversation(); 16 | $params = [ 17 | 'type'=> 'PRIVATE',// Session types PRIVATE, GROUP, DISCUSSION, SYSTEM 18 | 'userId'=>'mka091amn',// Session Owner 19 | 'targetId'=>'adm1klnm'// session id 20 | ]; 21 | Utils::dump("Set user's session screen push success",$Conversation->mute($params)); 22 | 23 | Utils::dump("Set the user's session screen push type error",$Conversation->mute()); 24 | 25 | $params = [ 26 | 'type'=> 'PRIVATE',// Conversation types PRIVATE, GROUP, DISCUSSION, SYSTEM 27 | 'userId'=>'mka091amn',// Session owner 28 | 'targetId'=>'adm1klnm'// Session ID 29 | ]; 30 | Utils::dump("Set the user's session to successfully receive Push",$Conversation->unmute($params)); 31 | 32 | Utils::dump("Set the user's session to receive Push type errors",$Conversation->unmute()); 33 | 34 | } 35 | 36 | testConversation($RongSDK); 37 | 38 | 39 | -------------------------------------------------------------------------------- /RongCloud/tests/TestPush.php: -------------------------------------------------------------------------------- 1 | getPush(); 16 | $params = [ 17 | 'platform'=> ['ios','android'],// Target operating system 18 | 'fromuserid'=>'mka091amn',// Sender User ID 19 | 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 20 | 'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],// Message content 21 | 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']] 22 | ]; 23 | Utils::dump("Broadcast message succeeded",$Push->broadcast($params)); 24 | 25 | Utils::dump("Broadcast message parameter error",$Push->broadcast()); 26 | 27 | $params = [ 28 | 'platform'=> ['ios','android'],// Target operating system 29 | 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 30 | 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']] 31 | ]; 32 | Utils::dump("Message pushed successfully",$Push->push($params)); 33 | 34 | Utils::dump("Push message parameter error",$Push->push()); 35 | 36 | 37 | } 38 | 39 | testPush($RongSDK); 40 | 41 | 42 | -------------------------------------------------------------------------------- /RongCloud/tests/TestSensitive.php: -------------------------------------------------------------------------------- 1 | getSensitive(); 16 | $params = [ 17 | 'replace'=> '***',// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word masking can be empty 18 | 'keyword'=>"abc",// Sensitive word 19 | 'type'=>0// 0: Sensitive word substitution 1: Sensitive word filtering 20 | ]; 21 | Utils::dump("Add sensitive word successfully",$Sensitive->add($params)); 22 | 23 | Utils::dump("Add sensitive keyword error",$Sensitive->add()); 24 | 25 | 26 | $params = [ 27 | 'words' => [ 28 | [ 29 | 'word' => "abc1",// Screen masking 30 | ], 31 | [ 32 | 'word' => "abc2",// Sensitive word 33 | 'replaceWord' => '***'// Sensitive word replacement, maximum length does not exceed 32 characters, sensitive word masking can be empty 34 | ] 35 | ] 36 | ]; 37 | Utils::dump("Batch addition of sensitive words successful",$Sensitive->batchAdd($params)); 38 | 39 | $params = [ 40 | 'keywords'=>["bbb"] 41 | ]; 42 | Utils::dump("Delete sensitive words successfully",$Sensitive->remove($params)); 43 | 44 | $params = [ 45 | 'keywords'=>[] 46 | ]; 47 | Utils::dump("Delete sensitive keywords error",$Sensitive->remove($params)); 48 | 49 | $params = [ 50 | 'type'=>0 51 | ]; 52 | Utils::dump("Get sensitive word success",$Sensitive->getList($params)); 53 | 54 | } 55 | testSensitive($RongSDK); 56 | 57 | 58 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rongcloud/php-sdk", 3 | "description": "Rong Cloud Server SDK in PHP.", 4 | "keywords": ["rongcloud", "rong cloud", "rlcoud", "sdk"], 5 | "homepage": "https://www.rongcloud.cn", 6 | "type": "library", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Rong Cloud", 11 | "email": "support@rongcloud.cn", 12 | "homepage": "https://github.com/rongcloud/" 13 | } 14 | ], 15 | "require": { 16 | "php": ">=5.3.0" 17 | }, 18 | "autoload": { 19 | "psr-4": {"RongCloud\\": "RongCloud"} 20 | } 21 | } 22 | --------------------------------------------------------------------------------