zoukankan      html  css  js  c++  java
  • 融云-》三个方法

    前段要调用的三个函数

    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);
    }

  • 相关阅读:
    什么是Java
    程序有问题解决方法
    面向对象三大特征
    实例变量和局部变量
    内存管理
    常见面试题(更新中)
    多态
    设计规则
    内部类
    编程英语
  • 原文地址:https://www.cnblogs.com/peipeiyu/p/7874885.html
Copyright © 2011-2022 走看看