...
|
...
|
@@ -3,6 +3,8 @@ |
|
|
namespace app\index\controller;
|
|
|
|
|
|
use app\common\controller\Frontend;
|
|
|
use RongCloud\Lib\Utils;
|
|
|
use RongCloud\RongCloud;
|
|
|
|
|
|
class Index extends Frontend
|
|
|
{
|
...
|
...
|
@@ -22,4 +24,79 @@ class Index extends Frontend |
|
|
return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.fastadmin.net?ref=news']);
|
|
|
}
|
|
|
|
|
|
// 融云创建用户
|
|
|
public function test() {
|
|
|
// 应用配置参数
|
|
|
$config = [
|
|
|
'appkey' => '3argexb63q3he',
|
|
|
'appsecret' => '1nb2RBxREmTICB',
|
|
|
];
|
|
|
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
|
|
|
$portrait = "http://7xogjk.com1.z0.glb.clouddn.com/IuDkFprSQ1493563384017406982"; // 头像
|
|
|
$User = $RongSDK->getUser();
|
|
|
|
|
|
$params = [
|
|
|
'id'=> 'xiaowei_master',//用户id
|
|
|
'name'=> 'xiaowei_admin',//用户名称
|
|
|
'portrait'=> $portrait //用户头像
|
|
|
];
|
|
|
Utils::dump("用户注册成功",$User->register($params));
|
|
|
}
|
|
|
|
|
|
// 创建群组
|
|
|
public function group() {
|
|
|
// 应用配置参数
|
|
|
$config = [
|
|
|
'appkey' => '3argexb63q3he',
|
|
|
'appsecret' => '1nb2RBxREmTICB',
|
|
|
];
|
|
|
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
|
|
|
$Group = $RongSDK->getGroup();
|
|
|
|
|
|
$params = [
|
|
|
'id'=> 'xiaowei_group1',//群组 id
|
|
|
'name'=> 'xiaowei_group1',//群组名称
|
|
|
'members'=>[ //群成员 列表
|
|
|
['id'=> 'xiaowei_master']
|
|
|
]
|
|
|
];
|
|
|
Utils::dump("创建群组成功",$Group->create($params));
|
|
|
}
|
|
|
|
|
|
// 群组用户禁言
|
|
|
public function group_dump_add() {
|
|
|
// 应用配置参数
|
|
|
$config = [
|
|
|
'appkey' => '3argexb63q3he',
|
|
|
'appsecret' => '1nb2RBxREmTICB',
|
|
|
];
|
|
|
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
|
|
|
$Group = $RongSDK->getGroup()->Gag();
|
|
|
$params = [
|
|
|
'id'=> 'xiaowei_group1',//群组 id
|
|
|
'members'=>[ //禁言人员列表
|
|
|
['id'=> 'xiaowei_master']
|
|
|
],
|
|
|
'minute'=>0 // 禁言时长
|
|
|
];
|
|
|
Utils::dump("添加群组禁言成功",$Group->add($params));
|
|
|
}
|
|
|
|
|
|
// 解除群组用户禁言
|
|
|
public function group_dump_remove() {
|
|
|
// 应用配置参数
|
|
|
$config = [
|
|
|
'appkey' => '3argexb63q3he',
|
|
|
'appsecret' => '1nb2RBxREmTICB',
|
|
|
];
|
|
|
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
|
|
|
$Group = $RongSDK->getGroup()->Gag();
|
|
|
$params = [
|
|
|
'id'=> 'xiaowei_group1',//群组 id
|
|
|
'members'=>[ //禁言人员列表
|
|
|
['id'=> 'xiaowei_master']
|
|
|
]
|
|
|
];
|
|
|
Utils::dump("解除禁言成功",$Group->remove($params));
|
|
|
}
|
|
|
} |
...
|
...
|
|