发布v2.6.8版本
This commit is contained in:
@@ -32,7 +32,8 @@ class apiAction extends ActionNot
|
||||
$time = time();
|
||||
$this->cfrom= $this->request('cfrom');
|
||||
$this->token= $this->request('token', $this->admintoken);
|
||||
$this->adminid = (int)$this->request('adminid', $this->adminid);
|
||||
$nadminid = $this->adminid;
|
||||
$this->adminid = (int)$this->request('adminid', $nadminid);
|
||||
$this->adminname = '';
|
||||
$boss = (M == 'login|api');
|
||||
if(!$boss){
|
||||
@@ -46,11 +47,11 @@ class apiAction extends ActionNot
|
||||
if(!$this->userrs && !$boss){
|
||||
$this->showreturn('', '用户已经不存在了,请重新登录', 199);
|
||||
}
|
||||
|
||||
$this->adminname = arrvalue($this->userrs, 'name');
|
||||
$this->rock->adminid = $this->adminid;
|
||||
$this->rock->adminname = $this->adminname;
|
||||
$this->admintoken = $this->token;
|
||||
if(!$boss && $nadminid != $this->adminid)m('login')->setsession($this->adminid, $this->adminname, $this->token, $this->userrs['user']);
|
||||
}
|
||||
|
||||
public function getvals($nae, $dev='')
|
||||
|
||||
@@ -168,8 +168,8 @@ class asynrunClassAction extends apiAction
|
||||
//订阅的
|
||||
public function subscribeAction()
|
||||
{
|
||||
$id = $this->get('id');
|
||||
$uid = $this->get('uid');
|
||||
$id = (int)$this->get('id');
|
||||
$uid = (int)$this->get('uid');
|
||||
$receid = $this->get('receid');
|
||||
$recename = $this->jm->base64decode($this->get('recename'));
|
||||
$flow = m('flow')->initflow('subscribeinfo');
|
||||
|
||||
@@ -139,6 +139,23 @@ class indexClassAction extends apiAction
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册了极光推送
|
||||
*/
|
||||
public function updateJPushAction()
|
||||
{
|
||||
$allfields = $this->db->getallfields('[Q]logintoken');
|
||||
if(!in_array('regid', $allfields)){
|
||||
$this->db->addFields('[Q]logintoken','regid','varchar(100)',null,'注册客户端id');
|
||||
}
|
||||
$regid = $this->get('regid');
|
||||
$uarr['regid'] = $regid;
|
||||
$uarr['moddt'] = $this->now;
|
||||
if(!isempt($regid))$uarr['ispush'] = 1;
|
||||
m('login')->update($uarr, "`token`='$this->admintoken'");
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
public function addlogAction()
|
||||
{
|
||||
$tit = $this->post('title');
|
||||
|
||||
@@ -26,7 +26,8 @@ class indexreimClassAction extends apiAction
|
||||
$modearr[]=array('type'=>$rs['type'],'num'=>$rs['num'],'name'=>$rs['name']);
|
||||
}
|
||||
}
|
||||
|
||||
$arr['loadtime'] = time();
|
||||
if($historyarr)$arr['loadtime'] = strtotime($historyarr[0]['optdt']);
|
||||
$arr['deptjson'] = json_encode($deptarr);
|
||||
$arr['userjson'] = json_encode($userarr);
|
||||
$arr['groupjson'] = json_encode($grouparr);
|
||||
|
||||
@@ -294,4 +294,53 @@ class loginClassAction extends apiAction
|
||||
'fid' => $fid,
|
||||
));
|
||||
}
|
||||
|
||||
//保存设置
|
||||
public function setwxqyAction()
|
||||
{
|
||||
$callback= $this->get('callback');
|
||||
$num = $this->get('num');
|
||||
$agentid = (int)$this->get('agentid');
|
||||
$shouji = $this->jm->base64decode($this->get('shouji'));
|
||||
$userid = $this->jm->base64decode($this->get('userid'));
|
||||
$urs = m('admin')->getone("`mobile`='$shouji' AND `status`=1");
|
||||
$barr = returnerror('错误');
|
||||
if(!$urs){
|
||||
$barr = returnerror('手机号“'.$shouji.'”在设置OA地址里不存在');
|
||||
}else{
|
||||
$barr = returnsuccess(array());
|
||||
}
|
||||
if($barr['success']){
|
||||
if($urs['type']==1)$this->option->setval('wxqyplat_cnum@-10', $num);
|
||||
$obj = m('zwxqy_user');
|
||||
$uarr['uid'] = $urs['id'];
|
||||
$uarr['mobile'] = $shouji;
|
||||
$uarr['userid'] = $userid;
|
||||
$uarr['agentid'] = $agentid;
|
||||
$uarr['cnum'] = $num;
|
||||
$uarr['state'] = 1;
|
||||
$ors = $obj->getone("`userid`='$userid'");
|
||||
if($ors){
|
||||
$obj->update($uarr, $ors['id']);
|
||||
}else{
|
||||
$obj->insert($uarr);
|
||||
}
|
||||
$data['user'] = $urs['user'];
|
||||
$barr['data'] = $data;
|
||||
}
|
||||
return ''.$callback.'('.json_encode($barr).')';
|
||||
}
|
||||
|
||||
//读取表结构
|
||||
public function dbinfoAction()
|
||||
{
|
||||
$tab = $this->get('tab');
|
||||
if(!$tab)return 'error';
|
||||
$table= ''.PREFIX.''.$tab.'';
|
||||
$rows = $this->db->gettablefields($table);
|
||||
if(!$rows)return '无表';
|
||||
|
||||
$barr[$table]['fields'] = $rows;
|
||||
return $barr;
|
||||
}
|
||||
}
|
||||
101
webmain/task/api/qywxplatAction.php
Normal file
101
webmain/task/api/qywxplatAction.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* 信呼企业微信回调
|
||||
*/
|
||||
class qywxplatClassAction extends apiAction
|
||||
{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->display= false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证的使用回调
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$huitoken = $this->get('huitoken');
|
||||
if(!$huitoken)return 'huitoken isempty';
|
||||
$mytoekn = $this->option->getval('qywxplat_huitoken');
|
||||
if(md5($mytoekn) != $huitoken)return 'huitoken error';
|
||||
|
||||
$postdata = $this->getpostdata();
|
||||
$calltype = '';
|
||||
$userid = '';
|
||||
if($postdata){
|
||||
$data = json_decode($postdata, true);
|
||||
$calltype = arrvalue($data, 'calltype');
|
||||
//m('log')->addlog('信呼回调', $postdata);
|
||||
$userid = arrvalue($data, 'userid');
|
||||
//$this->rock->debugs($postdata,'qywxcall_'.$calltype.'');
|
||||
}
|
||||
$where = "`user`='$userid'";
|
||||
|
||||
//激活关注
|
||||
if($calltype=='subscribe'){
|
||||
m('zqywx_user')->update('`state`=1', $where);
|
||||
}
|
||||
|
||||
//取消激活
|
||||
if($calltype=='unsubscribe'){
|
||||
m('zqywx_user')->update('`state`=4', $where);
|
||||
}
|
||||
|
||||
//删除用户
|
||||
if($calltype=='delete_user'){
|
||||
m('zqywx_user')->delete($where);
|
||||
}
|
||||
|
||||
//创建和更新用户
|
||||
if($calltype=='create_user' || $calltype=='update_user'){
|
||||
c('rockqueue')->push('qywx,qywxplatuserget', array(
|
||||
'userid' => $userid,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
/**
|
||||
* 回调处理的
|
||||
*/
|
||||
public function backAction()
|
||||
{
|
||||
$huitoken = $this->get('huitoken');
|
||||
if(!$huitoken)return 'huitoken isempty';
|
||||
$mytoekn = $this->option->getval('wxqyplat_huitoken');
|
||||
if(md5($mytoekn) != $huitoken)return 'huitoken error';
|
||||
|
||||
$postdata = $this->getpostdata();
|
||||
$calltype = '';
|
||||
$userid = '';
|
||||
if($postdata){
|
||||
$data = json_decode($postdata, true);
|
||||
$calltype = arrvalue($data, 'calltype');
|
||||
$userid = arrvalue($data, 'userid');
|
||||
}
|
||||
|
||||
$where = "`userid`='$userid'";
|
||||
$obj = m('zwxqy_user');
|
||||
|
||||
//激活关注
|
||||
if($calltype=='subscribe'){
|
||||
$obj->update('`state`=1', $where);
|
||||
}
|
||||
|
||||
//取消激活
|
||||
if($calltype=='unsubscribe'){
|
||||
$obj->update('`state`=4', $where);
|
||||
}
|
||||
|
||||
//取消授权
|
||||
if($calltype=='authcancel'){
|
||||
$obj->delete('1=1');
|
||||
}
|
||||
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,33 @@ class tonghuaClassAction extends apiAction
|
||||
if(!getconfig('video_bool'))return returnerror('系统未开启音视频');
|
||||
$id = (int)$this->get('id');
|
||||
$type = (int)$this->get('type');
|
||||
$rtctype = 1; //0,1腾讯
|
||||
if($id==$this->adminid)return returnerror('不能和自己通话');
|
||||
$nowtime = strtotime($this->now);
|
||||
|
||||
$allfields = $this->db->getallfields('[Q]im_tonghua');
|
||||
if(!in_array('toid', $allfields)){
|
||||
$this->db->addFields('[Q]im_tonghua','toid','int(11)','0','对于人id可能是组');
|
||||
}
|
||||
|
||||
|
||||
//判断是不是在通话中
|
||||
$thrs = m('im_tonghua')->getone('(`faid`='.$id.' or `toid`='.$id.') and (`state` in(0,4) or (`state`=1 and enddt is null))', '*', 'id desc');
|
||||
if($thrs){
|
||||
$time = time() - strtotime($thrs['adddt']);
|
||||
$state = (int)$thrs['state'];
|
||||
$stime = 60;
|
||||
if($state == 1)$stime = 30* 60;
|
||||
if($time < $stime)return returnerror('对方忙线');//60秒内
|
||||
}
|
||||
|
||||
//判断用户有没有在线
|
||||
$gbarr = m('reim')->pushserver('getonline', array(
|
||||
'onlineid' => $id
|
||||
));
|
||||
if(!$gbarr)return returnerror('没有服务端');
|
||||
|
||||
|
||||
if(!$gbarr['success'])return $gbarr;
|
||||
$ondats = json_decode(arrvalue($gbarr,'data'), true);
|
||||
$online = false;
|
||||
@@ -26,11 +45,21 @@ class tonghuaClassAction extends apiAction
|
||||
}
|
||||
|
||||
if(!$online){
|
||||
$to = m('login')->rows('`uid`='.$id.' and `online`=1 and `ispush`=1');
|
||||
if($to==0)return returnerror('对方不在线,无法通话');
|
||||
$trows = m('login')->getall('`uid`='.$id.' and `online`=1 and `ispush`=1');
|
||||
if(!$trows)return returnerror('对方不在线,无法通话');
|
||||
|
||||
$appfw = $this->option->getval('reimappwxsystem');
|
||||
if($appfw != '1')return returnerror('服务端没开启APP可用');
|
||||
|
||||
$isbo = true;
|
||||
foreach($trows as $k=>$rs){
|
||||
$web = $rs['web'];
|
||||
if(!contain($web, 'iphone'))$isbo = false;
|
||||
}
|
||||
//if($isbo)return returnerror('对方使用iphone,暂不支持通话');
|
||||
}
|
||||
|
||||
$barr = c('xinhuapi')->getdata('tonghua','thinit', array('faid'=>$this->adminid,'nowtime'=>$nowtime,'toid'=>$id,'type'=>$type));
|
||||
$barr = c('xinhuapi')->getdata('tonghua','thinit', array('faid'=>$this->adminid,'rtctype'=>$rtctype,'nowtime'=>$nowtime,'toid'=>$id,'type'=>$type));
|
||||
if(!$barr['success'])return $barr;
|
||||
$data = $barr['data'];
|
||||
$key = $data['channel'];
|
||||
@@ -42,7 +71,9 @@ class tonghuaClassAction extends apiAction
|
||||
'faid' => $this->adminid,
|
||||
'channel' =>$data['channel'],
|
||||
'type' =>$data['type'],
|
||||
'plat' =>$rtctype,
|
||||
'joinids' =>$id,
|
||||
'toid' =>$id,
|
||||
'adddt' =>$this->now,
|
||||
));
|
||||
|
||||
@@ -67,7 +98,7 @@ class tonghuaClassAction extends apiAction
|
||||
}
|
||||
|
||||
/**
|
||||
* 接电话了(1同意,2拒绝,3取消,4接受者已打开页面,5呼叫超过30秒无人接听)
|
||||
* 接电话了(0呼叫中,1同意,2拒绝,3取消,4接受者已打开页面,5呼叫超过30秒无人接听)
|
||||
*/
|
||||
public function jieAction()
|
||||
{
|
||||
@@ -76,18 +107,22 @@ class tonghuaClassAction extends apiAction
|
||||
$dbs = m('im_tonghua');
|
||||
$onrs = $dbs->getone("`channel`='$channel'");
|
||||
$satype = '';
|
||||
if(!$onrs)$satype = '通话不存在';
|
||||
if($onrs && ($onrs['state']=='3' || $onrs['state']=='5'))$satype = '对方已取消';
|
||||
if(!$satype){
|
||||
$nowtime = strtotime($this->now);
|
||||
$upstsr = '`state`='.$state.'';
|
||||
if($state==1)$upstsr.=",`jiedt`='$this->now'";
|
||||
$dbs->update($upstsr,"`channel`='$channel'");
|
||||
$barr = c('rockqueue')->push('tonghua,jie', array('key'=>$channel,'nowtime'=>$nowtime,'uid'=>$this->adminid,'state'=>$state));
|
||||
if(!$barr['success'])return $barr;
|
||||
}
|
||||
if(!$onrs)return returnerror('通话不存在');
|
||||
$zt = $onrs['state'];
|
||||
if($zt == '3' || $zt=='5')return returnerror('对方已取消');
|
||||
|
||||
if($zt=='1')return returnerror('已在另端接通');
|
||||
if($zt=='2')return returnerror('已在另端拒绝');
|
||||
|
||||
$nowtime = strtotime($this->now);
|
||||
$upstsr = '`state`='.$state.'';
|
||||
if($state==1)$upstsr.=",`jiedt`='$this->now'";
|
||||
$dbs->update($upstsr,"`channel`='$channel'");
|
||||
$barr = c('rockqueue')->push('tonghua,jie', array('key'=>$channel,'nowtime'=>$nowtime,'uid'=>$this->adminid,'state'=>$state));
|
||||
if(!$barr['success'])return $barr;
|
||||
|
||||
return returnsuccess(array(
|
||||
'satype' => $satype
|
||||
'satype' => ''
|
||||
));
|
||||
}
|
||||
|
||||
@@ -143,10 +178,10 @@ class tonghuaClassAction extends apiAction
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$onrs = m('im_tonghua')->getone("`channel`='$channel'");
|
||||
$tayar = array('','tongyi','jujue','cancel','wait','cancel');
|
||||
|
||||
$tayar = array('call','tongyi','jujue','cancel','wait','cancel','end');
|
||||
return returnsuccess(array(
|
||||
'state' => arrvalue($tayar, $onrs['state'])
|
||||
'state' => arrvalue($tayar, $onrs['state']),
|
||||
'th_channel'=> $channel
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ class uploadClassAction extends apiAction
|
||||
$this->rock->createtxt($filepath, file_get_contents($lujing));
|
||||
|
||||
$uarr = array(
|
||||
'filename' => $fname,
|
||||
'filename' => $this->rock->xssrepstr($fname),
|
||||
'fileext' => $fileext,
|
||||
'filepath' => $filepath,
|
||||
'filesize' => filesize($filepath),
|
||||
@@ -556,7 +556,7 @@ class uploadClassAction extends apiAction
|
||||
$where.=" and `fileext` in('".$uptp."')";
|
||||
}
|
||||
$db = m('file');
|
||||
$rows = $db->getall($where,'id,filename,filesizecn,fileext,thumbpath,filepath,filepathout','`id` desc limit 10');
|
||||
$rows = $db->getall($where,'id,filename,filesizecn,fileext,thumbpath,thumbplat,filepath,filepathout','`id` desc limit 10');
|
||||
foreach($rows as $k=>$rs){
|
||||
$rows[$k]['value'] = $rs['id'];
|
||||
$rows[$k]['name'] = $rs['filename'];
|
||||
@@ -570,6 +570,7 @@ class uploadClassAction extends apiAction
|
||||
unset($rows[$k]['filepathout']);
|
||||
if(!isempt($rs['thumbpath'])){
|
||||
$rows[$k]['iconsimg'] = $rs['thumbpath'];
|
||||
if(!isempt($rs['thumbplat']))$rows[$k]['iconsimg'] = $rs['thumbplat'];
|
||||
}else{
|
||||
$flx = $rs['fileext'];
|
||||
if(!contain($db->fileall,','.$flx.','))$flx='wz';
|
||||
|
||||
@@ -44,7 +44,7 @@ class weixinClassAction extends apiAction{
|
||||
$arr['location_y'] = $this->post('location_y');
|
||||
$arr['scale'] = (int)$this->post('scale');
|
||||
$arr['precision'] = (int)$this->post('precision');
|
||||
$arr['label'] = $this->getvals('label');
|
||||
$arr['label'] = $this->rock->iconvsql($this->getvals('label'));
|
||||
$arr['explain'] = $this->rock->xssrepstr($this->getvals('sm'));
|
||||
$arr['optdt'] = $now;
|
||||
$arr['uid'] = $uid;
|
||||
|
||||
@@ -33,7 +33,7 @@ class wordClassAction extends apiAction
|
||||
|
||||
$cqid = $this->post('cqid');
|
||||
$typeid = (int)$this->post('typeid','0');
|
||||
$name = $this->post('name');
|
||||
$name = $this->rock->xssrepstr($this->post('name'));
|
||||
|
||||
$arr = m('word')->createfolder($name, $cqid, $typeid);
|
||||
$this->showreturn($arr);
|
||||
@@ -43,7 +43,7 @@ class wordClassAction extends apiAction
|
||||
public function renameAction()
|
||||
{
|
||||
$id = (int)$this->post('id');
|
||||
$name = $this->getvals('name');
|
||||
$name = $this->rock->xssrepstr($this->getvals('name'));
|
||||
$type = $this->post('type');
|
||||
m('word')->update("`name`='$name'", $id);
|
||||
$this->showreturn('');
|
||||
|
||||
Reference in New Issue
Block a user