• 融云-》三个方法


    前段要调用的三个函数

    public function flash_rcloud()
    {
    $data = $this->data;
    if (empty($data['user_id']) || empty($data['token'])) {
    return $this->returnValue(105,'尚未登录,请先登录',(object)array());
    }
    $user = M('user')->where('id=%d',array($data['user_id']))->field('token')->find();
    if ($user['token']!=$data['token']) {
    return $this->returnValue(100,'已在另一台机器上登录',(object)array());
    }
    $rcloud_id = M('rcloud_list')->where('user_id=%d and user_type=1',array($data['user_id']))->getField('rcloud_id');
    $result = json_decode(gettalktoken($rcloud_id,$user['nickname'],$user['headimgurl']),true);
    $user['rcloud_token'] = $save['rcloud_token'] = $result['token']?$result['token']:'';
    M('user')->where('id=%d',array($data['user_id']))->save($save);
    $content = array(
    'rcloud_token' => $user['rcloud_token']
    );
    return $this->returnValue(0,'',$content);
    }

    public function chat_detail()
    {
    $data = $this->data;
    $id = $data['rcloud_id'];
    $result = M('rcloud_list')->where('rcloud_id="%s"',array($id))->field('user_id,user_type')->find();
    if ($result['user_type'] == 1) {
    $user = M('user')->where('id=%d',array($result['user_id']))->field('nickname,headimgurl')->find();
    }
    if ($result['user_type'] == 2) {
    $user = M('purchasing')->where('id=%d',array($result['user_id']))->field(array('purchasing_name'=>'nickname','headimg'=>'headimgurl'))->find();
    }
    if ($result['user_type'] == 3) {
    $user = M('admin')->where('id=%d',array($result['user_id']))->field(array('purchasing_name'=>'nickname','headimg'=>'headimgurl'))->find();
    }
    if (empty($user)) {
    $user = (object)array();
    }
    return $this->returnValue(0,'',$user);
    }

    public function allkey()
    {
    $cloumn = array('JP_appid','RC_appkey','WX_appid','BD_appkey');
    $where['code'] = array('in',$cloumn);
    $key = M('shop_config')->where($where)->field('code,value')->select();
    if (empty($key)) {
    $key = (object)array();
    }
    else{
    foreach ($key as $key => $value) {
    $key = $value['code'];
    $keys[$key] = $value['value']?$value['value']:'';
    }
    }
    return $this->returnValue(0,'',$keys);
    }

  • 相关阅读:
    函数调用与参数传递总结(完成)
    序列总结
    python中如何调用.py文件
    反射获取Class对象的方式有哪些,反射创建对象的方式有哪些
    Dubbo的协议
    长连接和短连接
    hashset 和 treeset
    说说你对java中GC机制的理解
    找不着 jdbc 配置文件解决方案
    web.xml标准配置
  • 原文地址:https://www.cnblogs.com/peipeiyu/p/7874885.html
Copyright © 2020-2023  润新知