发布v2.6.8版本

This commit is contained in:
雨中磐石
2025-03-31 20:54:32 +08:00
parent 0701e2a8b4
commit d41bd27082
122 changed files with 9827 additions and 9132 deletions

View File

@@ -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='')

View File

@@ -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');

View File

@@ -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');

View File

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

View File

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

View 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';
}
}

View File

@@ -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; //01腾讯
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
));
}

View File

@@ -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';

View File

@@ -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;

View File

@@ -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('');

View File

@@ -21,7 +21,7 @@ class openapiAction extends ActionNot
$this->display= false;
$openkey = $this->post('openkey');
$this->openkey = getconfig('openkey');
if($this->keycheck && HOST != '127.0.0.1' && !contain(HOST,'192.168') && $this->openkey != ''){
if($this->keycheck && $this->openkey != ''){
if($openkey != md5($this->openkey))$this->showreturn('', 'openkey not access', 201);
}
$this->getpostdata();

View File

@@ -15,7 +15,7 @@ class openbaseClassAction extends openapiAction
$arr = $this->getpostarr();
if(!$arr)return returnerror('not data');
$modenum = $arr['basemodenum'];
$modenum = $this->rock->xssrepstr($arr['basemodenum']);
$adminid = $this->rock->xssrepstr($arr['baseoptid']); //提交的用户
if(isempt($modenum))return returnerror('modenum is empty');
$uid = $this->getuserid($adminid);

View File

@@ -1,7 +1,7 @@
<?php
/**
* 群英考勤机
* 请求地址如http://127.0.0.1/api.php?m=opendkq&openkey=key
* 请求地址如http://127.0.0.1/api.php?m=openkqj&openkey=key
*/
class openkqjClassAction extends openapiAction
{
@@ -31,8 +31,10 @@ class openkqjClassAction extends openapiAction
$data = array();
$num = $this->get('sn'); //设备号
if(!$num)return 'notdata';
if(c('check')->onlynoen($num))return 'error:sn0';
$dbs = m('kqjsn');
$snid = (int)$dbs->getmou('id',"`num`='$num'");
if($snid==0)return 'error:sn1'; //20250307新增没有设备就不执行了
if($snid==0)$snid = $dbs->insert(array(
'num' => $num,
'optdt' => $this->rock->now,

View File

@@ -17,8 +17,10 @@ class openssoClassAction extends openapiAction
$lurl = urldecode($this->get('backurl')); //登录成功跳转地址urlencode
if(isempt($ssotoken))return '没有参数ssotoken';
$checkurls = $this->get('checkurl');
$checkurl = getconfig('sso_checkurl'); //验证地址
$ssokey = getconfig('sso_key'); //验证key
if($checkurls)$checkurl = c('rockwxqy')->geturlstr($checkurls,'','main');
if(isempt($checkurl))return '没有配置验证地址';
$jg = contain($checkurl,'?')?'&':'?';

View File

@@ -56,18 +56,24 @@ class beifenClassAction extends runtAction
/**
* 备份数据库
* php task.php beifen,create
* php task.php beifen,create -table=menu
*/
public function createAction()
{
if(PHP_SAPI != 'cli') return 'plase cli run';
$alltabls = $this->db->getalltable();
if(PHP_SAPI != 'cli') return 'plase cli run:php task.php beifen,create';
$table = $this->getparams('table');
ob_end_clean();
$path = ''.ROOT_PATH.'/'.DB_BASE.'_'.date('YmdHis').'.sql';
$path = ''.ROOT_PATH.'/'.DB_BASE.''.$table.'_'.date('YmdHis').'.sql';
$file = fopen($path, 'ab+');
$nobeifne = array(''.PREFIX.'log',''.PREFIX.'logintoken',''.PREFIX.'kqanay',''.PREFIX.'email_cont',''.PREFIX.'dailyfx',''.PREFIX.'reads',''.PREFIX.'todo',''.PREFIX.'city'); //不备份的表;
if($table){
$alltabls[] = ''.PREFIX.''.$table.'';
}else{
$alltabls = $this->db->getalltable();
}
foreach($alltabls as $tabs){
$sqla = $this->db->getall('show create table `'.$tabs.'`');
$createsql = $sqla[0]['Create Table'];

View File

@@ -82,7 +82,9 @@ class sysClassAction extends runtAction
if(in_array(''.PREFIX.'dailyfx', $alltabls))
m('dailyfx')->delete("`month`<'$month3'"); //日志分析
//更多清理自己添加
m('todo')->delete("`optdt`<'$date2 23:59:59'"); //6个月通知提醒
m('flow_todos')->delete("`adddt`<'$date2 23:59:59'"); //6个月单据提醒
return 'success';
}

View File

@@ -6,13 +6,14 @@
class tonghuaClassAction extends runtAction
{
public function sendcpush($arr)
public function sendcpush($arr, $isnei=false)
{
$arr['msgtype'] = 'calltonghua';
$arr['type'] = 'calltonghua';
$reimobj = m('reim');
$reimobj->pushserver('sendapp', $arr);
$reimobj->pushserver('send', $arr);
if($isnei)c('JPush')->sendJpush($arr);
}
/**
@@ -37,7 +38,19 @@ class tonghuaClassAction extends runtAction
$this->rock->adminid = $uid;
$this->rock->adminname = $urs['name'];
//每3秒呼叫一次
if($cishu==1){
$typea= array('语音','视频');
$cont = $this->jm->base64encode('['.$typea[$data['type']].'通话]');
$pushcont = $this->jm->base64encode('邀请与您'.$typea[$data['type']].'通话...');
m('reim')->sendinfor('user', $uid, $data['toid'], array(
'optdt' => $thrs['adddt'],
'cont' => $cont,
'pushcont' => $pushcont,
'msgid' => $channel
));
}
//每2秒呼叫一次
$this->sendcpush(array(
'adminid' => $uid,
'adminname' => $urs['name'],
@@ -50,17 +63,6 @@ class tonghuaClassAction extends runtAction
'receid' => $data['toid']
));
if($cishu==1){
$typea= array('语音','视频');
$cont = $this->jm->base64encode('['.$typea[$data['type']].'通话]');
$pushcont = $this->jm->base64encode('邀请与您'.$typea[$data['type']].'通话...');
m('reim')->sendinfor('user', $uid, $data['toid'], array(
'optdt' => $thrs['adddt'],
'cont' => $cont,
'pushcont' => $pushcont,
'msgid' => $channel,
));
}
c('rockqueue')->push('tonghua,call', array('key' => $key,'cishu'=>$cishu+1),time()+2);
return 'success';
@@ -78,9 +80,10 @@ class tonghuaClassAction extends runtAction
$this->sendcpush(array(
'adminid' => $data['uid'],
'calltype' => 'cancel',
'calltype' => 'cancel',
'th_channel'=> $channel,
'receid' => $data['toid']
));
), true);
return 'success';
}
@@ -103,6 +106,7 @@ class tonghuaClassAction extends runtAction
$this->sendcpush(array(
'adminid' => $data['toid'],
'calltype' => $tayar[$state],
'th_channel'=> $channel,
'receid' => $data['uid'].','.$data['toid']
));
@@ -122,7 +126,8 @@ class tonghuaClassAction extends runtAction
$channel = $this->getparams('channel');
$this->sendcpush(array(
'adminid' => $uid,
'calltype' => 'jiesu',
'calltype' => 'jiesu',
'th_channel'=> $channel,
'receid' => $toid
));
return c('xinhuapi')->getdata('tonghua','jiesu', array('uid'=>$uid,'nowtime'=>$nowtime,'channel'=>$channel));