usertype){ $this->ACT_msg('index.php','登录身份错误'); } if ($this->config['sy_chat_open']==1){ $this -> public_action(); $chatM = $this -> MODEL('chat'); if (isset($_GET['id']) && isset($_GET['type']) && $this->uid && $this->usertype){ $uid = intval($_GET['id']); $chatM->upFriend(array('fid'=>$uid,'fusertype'=>$_GET['type'],'uid'=>$this->uid,'usertype'=>$this->usertype),array('ntime'=>time())); $chat = $chatM->userinfo(array('uid'=>$uid,'usertype'=>intval($_GET['type']),'nowid'=>$this->uid,'nowtype'=>$this->usertype)); $this -> yunset('receive',$chat['mine']); $br = $chatM->getBeginid(array('fromid'=>$uid,'toid'=>$this->uid,'fusertype'=>$chat['mine']['usertype'],'tusertype'=>$this->usertype)); if (!empty($br['beginid'])){ $chatM->upChatLog(array('status'=>1),array('beginid'=>$br['beginid'],'to'=>$this->uid,'tusertype'=>$this->usertype,'status'=>2)); } } $canwx = $chatM->getFriendCan(array('type'=>'wx','uid'=>$this->uid,'usertype'=>$this->usertype,'fid'=>$uid,'fusertype'=>$_GET['type'])); $cantel = $chatM->getFriendCan(array('type'=>'tel','uid'=>$this->uid,'usertype'=>$this->usertype,'fid'=>$uid,'fusertype'=>$_GET['type'])); $this -> yunset('cantel',$cantel); $this -> yunset('canwx',$canwx); $myself = $chatM->userinfo(array('uid'=>$this->uid,'usertype'=>$this->usertype,'history'=>1,'friend'=>1)); $this -> yunset('rows',$myself['history']); // 招呼 $type = $this->usertype == 1 ? 4 : 3; $greeting = $chatM->getUsefulSet(array('type'=>$type, 'orderby'=>'sort')); $this->yunset('greeting', $greeting['content']); $this->yuntpl(array('chat/yunliao/index')); }else{ $this->ACT_msg('网站未开启'.$this->config['sy_chat_name'].'功能'); } } // 单对单聊天js预加载 function single_action() { $res = array(); $chatM = $this -> MODEL('chat'); $uid = intval($_POST['id']); $utype = intval($_POST['type']); $chat = $chatM->userinfo(array('uid'=>$uid,'usertype'=>$utype,'nowid'=>$this->uid,'nowtype'=>$this->usertype)); $res['receive'] = $chat['mine']; $br = $chatM->getBeginid(array('fromid'=>$uid,'toid'=>$this->uid,'fusertype'=>$chat['mine']['usertype'],'tusertype'=>$this->usertype)); if (!empty($br['beginid'])){ $chatM->upChatLog(array('status'=>1),array('beginid'=>$br['beginid'],'to'=>$this->uid,'tusertype'=>$this->usertype,'status'=>2)); } $res['canwx'] = $chatM->getFriendCan(array('type'=>'wx','uid'=>$this->uid,'usertype'=>$this->usertype,'fid'=>$uid,'fusertype'=>$utype)); $res['cantel'] = $chatM->getFriendCan(array('type'=>'tel','uid'=>$this->uid,'usertype'=>$this->usertype,'fid'=>$uid,'fusertype'=>$utype)); echo json_encode($res); } } ?>