Пример #1
0
 public function alliance($params = array())
 {
     extract($params);
     $alliance = array();
     if (isset($alliance_id) && $alliance_id) {
         $model = Alliance::model()->findByPk($alliance_id);
     } else {
         $model = new Alliance();
         $alliance['type'] = 0;
     }
     if (isset($name) && $name) {
         $alliance['name'] = $name;
     }
     if (isset($center_name) && $center_name) {
         $alliance['center_name'] = $center_name;
     }
     if (isset($image) && $image) {
         $alliance['image'] = $image;
     }
     if (isset($notice) && $notice) {
         $alliance['notice'] = $notice;
     }
     if (isset($user_id) && $user_id) {
         $alliance['leader'] = $user_id;
         $owner_arr = User::model()->loadUserByPk($user_id);
         if ($owner_mobile = $owner_arr['mobile']) {
             $model->attributes = $alliance;
             if ($model->validate() && $model->save()) {
                 $id = $model->getPrimaryKey();
                 Yii::import("application.extensions.Emchat.*");
                 $h = new Easemob();
                 $options['groupname'] = $name;
                 $options['desc'] = isset($notice) && $notice ? $notice : "this is a love group";
                 $options['public'] = true;
                 $options['owner'] = 'ur_' . $owner_mobile;
                 $group = $h->createGroup($options);
                 if ($groupid = $group['data']['groupid']) {
                     $groups = array('name' => $name, 'owner' => 'ur_' . $owner_mobile, 'desc' => isset($notice) && $notice ? $notice : "this is a love group", 'emchat_id' => $groupid, 'alliance_id' => $id);
                     $emchat = new Emchat();
                     $emchat->attributes = $groups;
                     if ($emchat->validate() && $emchat->save()) {
                         $ret = $this->notice('OK', 0, '成功', $groups);
                     } else {
                         $ret = $this->notice('ERR', 307, '操作失败', $emchat->getErrors());
                     }
                 } else {
                     $ret = $this->notice('ERR', 306, '环信数据保存失败', $group);
                 }
             } else {
                 $ret = $this->notice('ERR', 305, '数据保存失败', $model->getErrors());
             }
         } else {
             $ret = $this->notice('ERR', 303, '用户数据不存在', []);
         }
     } else {
         $ret = $this->notice('ERR', 301, '缺少参数', []);
     }
     return $ret;
 }
Пример #2
0
 function show()
 {
     /*       echo date("Y-m-d",541008000);
             $model = new Model();
             $sql = "UPDATE student SET age=284 WHERE id=1";
             $result = $model->execute($sql);
             var_dump($result);*/
     /*       1451790866
            $time = 1452096000;
            echo timeToString($time);*/
     /*       $uid = $_REQUEST['uid'];
            $strTitle = '你有新的消息了';
            $strText = 'PLAN有新的版本了,赶快去下载,有红包相送哦';
     
            echo "uid=$uid title=$strTitle  text=$strText<br><br>";
     
     
            getuiSendDeviceUnicast($uid,$strTitle,$strText);
     
     
            newOrderNotification('1369','1367');*/
     /*       Vendor('GetuiPush.GetuiPush');
     
             show();
            pushMessageToSingle();
     
            echo __ROOT__;
            strtotime("-2 day");
            die();
            echo strtotime('1984-03-07')."<br>";
     
            $passwd = "0093chenrenjie";
            echo sha1($passwd);*/
     /*
     curl -X POST -i "https://a1.easemob.com/plan/plan/users" -d '{"username":"******","password":"******"}'
     
            $url = 'https://a1.easemob.com/plan/chatdemoui/token';
            $data['grant_type'] = 'client_credentials';
            $data['client_id'] = 'YXA6zOQxoEyAEeWJs5OjVUur7g';
            $data['client_secret'] = 'YXA63rRzrvgElyfAR2uGrEouPUf0-x0';
            $result = http_post($url,json_encode($data));
            var_dump($result);*/
     Vendor('EasemobApi.EasemobApi');
     $e = new \Easemob();
     //获取token
     $token = $e->getToken();
     echo $token;
     //注册单个用户
     $result = $e->registerUser('1111111', sha1('123456'), 'kaka');
     echo json_encode($result);
     /*  $data[] = array('username'=>'aaabbb','password'=>sha1('123456'));
            $data[] = array('username'=>'aaaccc','password'=>sha1('123456'));
     
            $result = $e->registerManyUser($data);
            echo json_encode($result);*/
     // $e->deleteUser();
 }
Пример #3
0
 protected function __construct($options)
 {
     $emchat = Yii::app()->params['partner']['emchat'];
     $options['client_id'] = $options['client_id'] ?: $emchat['app']['client_id'];
     $options['client_secret'] = $options['client_secret'] ?: $emchat['app']['client_secret'];
     $options['org_name'] = $options['org_name'] ?: $emchat['org']['name'];
     $options['app_name'] = $options['app_name'] ?: $emchat['app']['name'];
     parent::__construct($options);
 }
Пример #4
0
 public function register($params = array())
 {
     extract($params);
     if (isset($nickname) && isset($password) && isset($mobile)) {
         $cache = Yii::app()->cache;
         $save_code = strtolower($cache->hget($mobile, 'register'));
         if (isset($code) && $save_code == strtolower($code)) {
             //查询手机是否注册过
             $user = User::model()->exists(array('condition' => 'mobile=:mobile', 'params' => array(':mobile' => isset($mobile) ? $mobile : 0)));
             if (!$user) {
                 Yii::import("application.extensions.Emchat.*");
                 $h = new Easemob();
                 if (isset($mobile) && $mobile) {
                     $ur_name = 'ur_' . $mobile;
                     $pwd = isset($password) ? $password : '******';
                     $res = $h->createUser($ur_name, $pwd);
                 }
                 $result = array('nickname' => $nickname, 'sex' => isset($sex) ? $sex : 0, 'mobile' => isset($mobile) ? $mobile : 0, 'image' => isset($image) ? $image : '', 'password' => md5($mobile . md5($password)));
                 if ($uuid = $res['entities'][0]['uuid']) {
                     $result['uuid'] = $uuid;
                 }
                 $model = new User();
                 $model->attributes = $result;
                 if ($model->validate() && $model->save()) {
                     $id = $model->getPrimaryKey();
                     $res = array('id' => $id, 'nickname' => $nickname, 'uuid' => $uuid);
                     $ret = $this->notice('OK', 0, '成功', $res);
                 } else {
                     $ret = $this->notice('ERR', 307, '', $model->getErrors());
                 }
             } else {
                 $ret = $this->notice('ERR', 306, '该号码已经注册过了', []);
             }
         } else {
             $ret = $this->notice('ERR', 305, '验证码错误', ['code' => $code, 'save_code' => $save_code]);
         }
     } else {
         $ret = $this->notice('ERR', 307, '', []);
     }
     $result = array('password' => $params['password']);
     $ret = $this->notice('ERR', 307, '', $result);
     return $ret;
 }
Пример #5
0
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<div id="container">
	<div id="content">
<?php 
include "Easemob.class.php";
$options['client_id'] = 'YOUR_CLIENT_ID';
$options['client_secret'] = 'YOUR_CLIENT_SECRET';
$options['org_name'] = 'YOUR_ORG_NAME';
$options['app_name'] = 'YOUR_APP_NAME';
$h = new Easemob($options);
$i = 70;
switch ($i) {
    case 10:
        //获取token
        $token = $h->getToken();
        var_dump($token);
        break;
    case 11:
        //创建单个用户
        var_dump($h->createUser("zhangsan", "123456"));
        break;
    case 12:
        //创建批量用户
        var_dump($h->createUsers(array(array("username" => "zhangsan", "password" => "123456"), array("username" => "lisi", "password" => "123456"))));
        break;
Пример #6
0
function set_usernick($user, $nickname)
{
    include_once '/home/wwwroot/default/zaina/lib/huanxin/Easemob.class.php';
    $option = array('client_id' => '*****************************', 'client_secret' => '*****************************', 'org_name' => '*****************************', 'app_name' => '*****************************');
    $easemob = new Easemob($option);
    $res = $easemob->set_usernick($user, $nickname);
    //$res = $easemob->Send_file('kefu',$us,'hi');
    return $res;
}
Пример #7
0
<?php

include_once 'Easemob.class.php';
$options['client_id'] = "YXA6bI0xUFa1EeWjzYFxAxSayQ";
$options['client_secret'] = "YXA6Rlyaq7MK9i5L0luXKC00EJowt74";
$options['org_name'] = "lizhangqu";
$options['app_name'] = "test";
$easemob = new Easemob($options);
if (isset($_POST['username']) && isset($_POST['password'])) {
    $account['username'] = $_POST['username'];
    $account['password'] = $_POST['password'];
    //这里处理自己服务器注册的流程
    //自己服务器注册成功后向环信服务器注册
    $result = $easemob->accreditRegister($account);
    echo $result;
} else {
    $res['status'] = 404;
    $res['message'] = "params is not right";
    echo json_encode($res);
}
Пример #8
0
<?php

$options = array('client_id' => 'YXA6zOQxoEyAEeWJs5OjVUur7g', 'client_secret' => 'YXA63rRzrvgElyfAR2uGrEouPUf0-x0', 'org_name' => 'plan', 'app_name' => 'plan');
$e = new Easemob($options);
$groupInfo = array('groupname' => 'leeef', 'desc' => 'leeff');
$result = $e->getUserGroups('80983543');
//$result = $e->getGroupList();
//$result = $e->getGroupDetial("1423734662380237");
//echo "<pre>";
//print_r($result);
/*
 * --------------强调说明-------------
 * 参数 数字int 最好填 String 如groupId 1423734662380237 ,传参时传getGroupDetial("1423734662380237");
 */
class Easemob
{
    private $host = 'https://a1.easemob.com';
    private $client_id = 'YXA6zOQxoEyAEeWJs5OjVUur7g';
    private $client_secret = 'YXA63rRzrvgElyfAR2uGrEouPUf0-x0';
    private $org_name = 'plan';
    private $app_name = 'plan';
    private $token = '';
    /*
     * ------------------------
     * 公共方法             开始
     * ------------------------
     */
    /**
     * 初始化参数
     */
    public function __construct()
Пример #9
0
<?php

$filedir = dirname(__FILE__);
//当前文件的所在目录的路径
include $filedir . "/../conf.php";
include_once $filedir . '/../lib/huanxin/Easemob.class.php';
$option = array('client_id' => 'YXA6vpskYB7lEeSFFt0E5_hyiw', 'client_secret' => 'YXA6ZJ8yU3uRdiXP9yGgbnlOhxXjEnM', 'org_name' => 'ccxt', 'app_name' => 'sandbox');
$easemob = new Easemob($option);
$lastcursor = $db->row_select_one('db_error', "pagename = 'getmessage_cursor' ");
$res = $easemob->chatRecord_dao($lastcursor['errstr']);
$entities = $res['entities'];
$timestamp = $res['timestamp'];
$cursor = $res['cursor'];
foreach ($entities as $entitie_item) {
    $from = $entitie_item['from'];
    $to = $entitie_item['to'];
    $timestamp = $entitie_item['timestamp'];
    $type = $entitie_item['payload']['bodies'][0]['type'];
    $url = $entitie_item['payload']['bodies'][0]['url'];
    $msg = $entitie_item['payload']['bodies'][0]['msg'];
    $filename = $entitie_item['payload']['bodies'][0]['filename'];
    echo $type . "<br>";
    echo $url . "<br>";
    echo $msg . "<br>";
    echo $filename . "<br>";
    $insert = array("`from`" => $from, "`to`" => $to, "`timestamp`" => $timestamp, "`type`" => $type, "`content`" => addslashes($msg . $filename . $url));
    $db->row_insert('message', $insert);
    print_r($insert);
}
$messinsert = array("pagename" => 'getmessage_cursor', "timer" => $timestamp, "errstr" => $cursor);
//$db->row_insert('db_error',$messinsert);
Пример #10
0
 function register()
 {
     $param = json_decode(file_get_contents('php://input'), true);
     //用户名
     $username = $param['username'];
     if (empty($username)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     //密码
     $password = $param['password'];
     if (empty($password)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     //昵称
     $nicker = $param['nicker'];
     if (empty($nicker)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     $gender = $param['gender'];
     if ($gender != 0 && $gender != 1) {
         $gender = 0;
         //默认 男
     }
     //头像
     $header = $param['header'];
     if (empty($header)) {
         $header = '';
     }
     //短信验证码
     $verifycode = $param['verifycode'];
     if (empty($verifycode)) {
         err_ret(-306, 'lack of param verfiy', '验证码不能为空');
     }
     //注册时间
     $regtime = time();
     $model = new Model('user_info');
     //判断手机号是否注册过
     $data['username'] = $username;
     $result = $model->where($data)->select();
     if (count($result) > 0) {
         err_ret(-305, 'phone number is registered', '手机号已经注册过');
     }
     //数据库插入一条记录,生成新用户
     $data['username'] = $username;
     $data['password'] = $password;
     $data['nicker'] = $nicker;
     $data['header'] = $header;
     $data['regtime'] = $regtime;
     $data['gender'] = $gender;
     $lastId = $model->add($data);
     if (!$lastId) {
         err_ret(-311, 'register add new user failed', '注册添加新用户时失败');
     }
     //删除此用户临时短信验证码
     $delete_model = new Model('verify_tmp');
     $condition['phone'] = $username;
     $condition['verifycode'] = $verifycode;
     $delete_model->where($condition)->delete();
     // 删除id为最大的用户的短信验证码
     //生成用户token并保存
     $token = token_generate($lastId);
     $where['id'] = $lastId;
     $save['xtoken'] = $token;
     $count = $model->where($where)->save($save);
     if ($count == 0) {
         err_ret(-501, 'save token failed', '保存token失败');
     }
     //注册环信
     Vendor('EasemobApi.EasemobApi');
     $ease = new \Easemob();
     $result_arr = $ease->registerUser($username, $password, $nicker);
     if (isset($result_arr['error'])) {
         $delete_data['username'] = $username;
         $model->where($delete_data)->delete();
         err_ret(-205, 'failed registered', '注册失败');
     }
     $info['errno'] = 0;
     $info['xtoken'] = $token;
     $info['data']['nicker'] = $nicker;
     $info['data']['header'] = $header;
     $info['data']['uid'] = $lastId;
     echo json_encode($info);
 }
Пример #11
0
function getmessage()
{
    global $db;
    global $filedir;
    //mkdir('../temp/getmessage.lock',0777);
    if (file_exists($filedir . "/../temp/getmessage.lock")) {
        echo "getmessage ---> lock ";
        return;
    }
    /*$dir = "www.php100.com/newdata";
    if(file_exists($file))
    {
        echo "当前目录中,文件".$file."存在";
        echo "
    ";
    }*/
    include_once $filedir . '/../lib/huanxin/Easemob.class.php';
    $option = array('client_id' => 'YXA6vpskYB7lEeSFFt0E5_hyiw', 'client_secret' => 'YXA6ZJ8yU3uRdiXP9yGgbnlOhxXjEnM', 'org_name' => 'ccxt', 'app_name' => 'sandbox');
    $easemob = new Easemob($option);
    $lastcursor = $db->row_select_one('db_error', "pagename = 'getmessage_cursor' ");
    $res = $easemob->chatRecord_dao($lastcursor['errstr']);
    $entities = $res['entities'];
    $timestamp = $res['timestamp'];
    $cursor = $res['cursor'];
    echo $cursor;
    foreach ($entities as $entitie_item) {
        $from = $entitie_item['from'];
        $to = $entitie_item['to'];
        $timestamp = $entitie_item['timestamp'];
        $type = $entitie_item['payload']['bodies'][0]['type'];
        $url = $entitie_item['payload']['bodies'][0]['url'];
        $msg = $entitie_item['payload']['bodies'][0]['msg'];
        $filename = $entitie_item['payload']['bodies'][0]['filename'];
        //echo $type."<br>";
        //echo $url."<br>";
        //echo $msg."<br>";
        //echo $filename."<br>";
        $insert = array("`from`" => $from, "`to`" => $to, "`timestamp`" => $timestamp, "`type`" => $type, "`content`" => addslashes($msg . $filename . $url));
        $db->row_insert('message', $insert);
        //print_r($insert);
    }
    $messinsert = array("pagename" => 'getmessage_cursor', "timer" => $timestamp, "errstr" => $cursor);
    //$db->row_insert('db_error',$messinsert);
    if (!empty($cursor)) {
        $messupdate = array("pagename" => 'getmessage_cursor', "timer" => $timestamp, "errstr" => $cursor);
        $db->row_update('db_error', $messupdate, "pagename = 'getmessage_cursor' ");
    } else {
        //如果为空则说明后面没有数据
        $data = $cursor;
        file_put_contents($filedir . '/../temp/getmessage.lock', $data);
        echo 'getmessage ---> empty';
    }
}
Пример #12
0
 public function emchat($params = array())
 {
     extract($params);
     Yii::import("application.extensions.Emchat.*");
     $h = new Easemob();
     //$i=70;
     if (isset($channel) && $channel) {
         $c = $channel;
     } else {
         $c = 44;
     }
     switch ($c) {
         case 10:
             //获取token
             $token = $h->getToken();
             var_dump($token);
             break;
         case 11:
             //创建单个用户
             var_dump($h->createUser("zhangsan", "123456"));
             break;
         case 12:
             //创建批量用户
             var_dump($h->createUsers(array(array("username" => "zhangsan", "password" => "123456"), array("username" => "lisi", "password" => "123456"))));
             break;
         case 13:
             //重置用户密码
             var_dump($h->resetPassword("zhangsan", "123456"));
             break;
         case 14:
             //获取单个用户
             var_dump($h->getUser("zhangsan"));
             break;
         case 15:
             //获取批量用户---不分页(默认返回10个)
             var_dump($h->getUsers());
             break;
         case 16:
             //获取批量用户----分页
             $cursor = $h->readCursor("userfile.txt");
             var_dump($h->getUsersForPage(10, $cursor));
             break;
         case 17:
             //删除单个用户
             var_dump($h->deleteUser("zhangsan"));
             break;
         case 18:
             //删除批量用户
             var_dump($h->deleteUsers(2));
             break;
         case 19:
             //修改昵称
             var_dump($h->editNickname("zhangsan", "小B"));
             break;
         case 20:
             //添加好友------400
             var_dump($h->addFriend("zhangsan", "lisi"));
             break;
         case 21:
             //删除好友
             var_dump($h->deleteFriend("zhangsan", "lisi"));
             break;
         case 22:
             //查看好友
             var_dump($h->showFriends("zhangsan"));
             break;
         case 23:
             //查看黑名单
             var_dump($h->getBlacklist("zhangsan"));
             break;
         case 24:
             //往黑名单中加人
             $usernames = array("usernames" => array("wangwu", "lisi"));
             var_dump($h->addUserForBlacklist("zhangsan", $usernames));
             break;
         case 25:
             //从黑名单中减人
             var_dump($h->deleteUserFromBlacklist("zhangsan", "lisi"));
             break;
         case 26:
             //查看用户是否在线
             var_dump($h->isOnline("zhangsan"));
             break;
         case 27:
             //查看用户离线消息数
             var_dump($h->getOfflineMessages("zhangsan"));
             break;
         case 28:
             //查看某条消息的离线状态
             var_dump($h->getOfflineMessageStatus("zhangsan", "77225969013752296_pd7J8-20-c3104"));
             break;
         case 29:
             //禁用用户账号----
             var_dump($h->deactiveUser("zhangsan"));
             break;
         case 30:
             //解禁用户账号-----
             var_dump($h->activeUser("zhangsan"));
             break;
         case 31:
             //强制用户下线
             var_dump($h->disconnectUser("zhangsan"));
             break;
         case 32:
             //上传图片或文件
             var_dump($h->uploadFile("./resource/up/pujing.jpg"));
             //var_dump($h->uploadFile("./resource/up/mangai.mp3"));
             //var_dump($h->uploadFile("./resource/up/sunny.mp4"));
             break;
         case 33:
             //下载图片或文件
             var_dump($h->downloadFile('01adb440-7be0-11e5-8b3f-e7e11cda33bb', 'Aa20SnvgEeWul_Mq8KN-Ck-613IMXvJN8i6U9kBKzYo13RL5'));
             break;
         case 34:
             //下载图片缩略图
             var_dump($h->downloadThumbnail('01adb440-7be0-11e5-8b3f-e7e11cda33bb', 'Aa20SnvgEeWul_Mq8KN-Ck-613IMXvJN8i6U9kBKzYo13RL5'));
             break;
         case 35:
             //发送文本消息
             $from = 'admin';
             $target_type = "users";
             //$target_type="chatgroups";
             $target = array("zhangsan", "lisi", "wangwu");
             //$target=array("122633509780062768");
             $content = "Hello HuanXin!";
             $ext['a'] = "a";
             $ext['b'] = "b";
             var_dump($h->sendText($from, $target_type, $target, $content, $ext));
             break;
         case 36:
             //发送透传消息
             $from = 'admin';
             $target_type = "users";
             //$target_type="chatgroups";
             $target = array("zhangsan", "lisi", "wangwu");
             //$target=array("122633509780062768");
             $action = "Hello HuanXin!";
             $ext['a'] = "a";
             $ext['b'] = "b";
             var_dump($h->sendCmd($from, $target_type, $target, $action, $ext));
             break;
         case 37:
             //发送图片消息
             $filePath = "./resource/up/pujing.jpg";
             $from = 'admin';
             $target_type = "users";
             $target = array("zhangsan", "lisi");
             $filename = "pujing.jpg";
             $ext['a'] = "a";
             $ext['b'] = "b";
             var_dump($h->sendImage($filePath, $from, $target_type, $target, $filename, $ext));
             break;
         case 38:
             //发送语音消息
             $filePath = "./resource/up/mangai.mp3";
             $from = 'admin';
             $target_type = "users";
             $target = array("zhangsan", "lisi");
             $filename = "mangai.mp3";
             $length = 10;
             $ext['a'] = "a";
             $ext['b'] = "b";
             var_dump($h->sendAudio($filePath, $from = "admin", $target_type, $target, $filename, $length, $ext));
             break;
         case 39:
             //发送视频消息
             $filePath = "./resource/up/sunny.mp4";
             $from = 'admin';
             $target_type = "users";
             $target = array("zhangsan", "lisi");
             $filename = "sunny.mp4";
             $length = 10;
             //时长
             $thumb = 'https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/c06588c0-7df4-11e5-932c-9f90699e6d72';
             $thumb_secret = 'wGWIyn30EeW9AD1fA7wz23zI8-dl3PJI0yKyI3Iqk08NBqCJ';
             $ext['a'] = "a";
             $ext['b'] = "b";
             var_dump($h->sendVedio($filePath, $from = "admin", $target_type, $target, $filename, $length, $thumb, $thumb_secret, $ext));
             break;
         case 40:
             //发文件消息
             break;
         case 41:
             //获取app中的所有群组-----不分页(默认返回10个)
             var_dump($h->getGroups());
             break;
         case 42:
             ////获取app中的所有群组--------分页
             $cursor = $h->readCursor("groupfile.txt");
             var_dump($h->getGroupsForPage(2, $cursor));
             break;
         case 43:
             //获取一个或多个群组的详情
             $group_ids = array("1445830526109", "1445833238210");
             var_dump($h->getGroupDetail($group_ids));
             break;
         case 44:
             //创建一个群组
             $options['groupname'] = "group001";
             $options['desc'] = "this is a love group";
             $options['public'] = true;
             $options['owner'] = "zhaoqing";
             $options['members'] = array("fengpei", "lisi");
             var_dump($h->createGroup($options));
             break;
         case 45:
             //修改群组信息
             $group_id = "124113058216804760";
             $options['groupname'] = "group002";
             $options['description'] = "修改群描述";
             $options['maxusers'] = 300;
             var_dump($h->modifyGroupInfo($group_id, $options));
             break;
         case 46:
             //删除群组
             $group_id = "124113058216804760";
             var_dump($h->deleteGroup($group_id));
             break;
         case 47:
             //获取群组中的成员
             $group_id = "122633509780062768";
             var_dump($h->getGroupUsers($group_id));
             break;
         case 48:
             //群组单个加人------
             $group_id = "122633509780062768";
             $username = "******";
             var_dump($h->addGroupMember($group_id, $username));
             break;
         case 49:
             //群组批量加人
             $group_id = "122633509780062768";
             $usernames['usernames'] = array("wangwu", "lisi");
             var_dump($h->addGroupMembers($group_id, $usernames));
             break;
         case 50:
             //群组单个减人
             $group_id = "122633509780062768";
             $username = "******";
             var_dump($h->deleteGroupMember($group_id, $username));
             break;
         case 51:
             //群组批量减人-----
             $group_id = "122633509780062768";
             $usernames['usernames'] = array("wangwu", "lisi");
             var_dump($h->deleteGroupMembers($group_id, $usernames));
             break;
         case 52:
             //获取一个用户参与的所有群组
             var_dump($h->getGroupsForUser("zhangsan"));
             break;
         case 53:
             //群组转让
             $group_id = "122633509780062768";
             $options['newowner'] = "lisi";
             var_dump($h->changeGroupOwner($group_id, $options));
             break;
         case 54:
             //查询一个群组黑名单用户名列表
             $group_id = "122633509780062768";
             var_dump($h->getGroupBlackList($group_id));
             break;
         case 55:
             //群组黑名单单个加人-----
             $group_id = "122633509780062768";
             $username = "******";
             var_dump($h->addGroupBlackMember($group_id, $username));
             break;
         case 56:
             //群组黑名单批量加人
             $group_id = "122633509780062768";
             $usernames['usernames'] = array("lisi", "wangwu");
             var_dump($h->addGroupBlackMembers($group_id, $usernames));
             break;
         case 57:
             //群组黑名单单个减人
             $group_id = "122633509780062768";
             $username = "******";
             var_dump($h->deleteGroupBlackMember($group_id, $username));
             break;
         case 58:
             //群组黑名单批量减人
             $group_id = "122633509780062768";
             $usernames['usernames'] = array("wangwu", "lisi");
             var_dump($h->deleteGroupBlackMembers($group_id, $usernames));
             break;
         case 59:
             //创建聊天室
             $options['name'] = "chatroom001";
             $options['description'] = "this is a love chatroom";
             $options['maxusers'] = 300;
             $options['owner'] = "zhangsan";
             $options['members'] = array("man", "lisi");
             var_dump($h->createChatRoom($options));
             break;
         case 60:
             //修改聊天室信息
             $chatroom_id = "124121390293975664";
             $options['name'] = "chatroom002";
             $options['description'] = "修改聊天室描述";
             $options['maxusers'] = 300;
             var_dump($h->modifyGroupInfo($chatroom_id, $options));
             break;
         case 61:
             //删除聊天室
             $chatroom_id = "124121390293975664";
             var_dump($h->deleteChatRoom($chatroom_id));
             break;
         case 62:
             //获取app中所有的聊天室
             var_dump($h->getChatRooms());
             break;
         case 63:
             //获取一个聊天室的详情
             $chatroom_id = "124121939693277716";
             var_dump($h->getChatRoomDetail($chatroom_id));
             break;
         case 64:
             //获取一个用户加入的所有聊天室
             var_dump($h->getChatRoomJoined("zhangsan"));
             break;
         case 65:
             //聊天室单个成员添加--
             $chatroom_id = "124121939693277716";
             $username = "******";
             var_dump($h->addChatRoomMember($chatroom_id, $username));
             break;
         case 66:
             //聊天室批量成员添加
             $chatroom_id = "124121939693277716";
             $usernames['usernames'] = array('wangwu', 'lisi');
             var_dump($h->addChatRoomMembers($chatroom_id, $usernames));
             break;
         case 67:
             //聊天室单个成员删除
             $chatroom_id = "124121939693277716";
             $username = "******";
             var_dump($h->deleteChatRoomMember($chatroom_id, $username));
             break;
         case 68:
             //聊天室批量成员删除
             $chatroom_id = "124121939693277716";
             $usernames['usernames'] = array('zhangsan', 'lisi');
             var_dump($h->deleteChatRoomMembers($chatroom_id, $usernames));
             break;
         case 69:
             //导出聊天记录-------不分页
             $ql = "select+*+where+timestamp>1435536480000";
             var_dump($h->getChatRecord($ql));
             break;
         case 70:
             //导出聊天记录-------分页
             $ql = "select+*+where+timestamp>1435536480000";
             $cursor = $h->readCursor("chatfile.txt");
             //var_dump($h->$cursor);
             var_dump($h->getChatRecordForPage($ql, 10, $cursor));
             break;
     }
 }