信呼OA版本v2.3.8

This commit is contained in:
雨中磐石
2022-08-14 16:47:40 +08:00
parent 4640677d27
commit e3fcd913e3
1405 changed files with 133635 additions and 73 deletions

View File

@@ -0,0 +1,32 @@
<?php
class agentClassAction extends apiAction
{
/**
* 手机app读取应用
*/
public function dataAction()
{
$agentarr = m('reim')->getappagent($this->adminid);
$arr['agentjson'] = json_encode($agentarr['rows']);
$this->showreturn($arr);
}
/**
* app上读取数组的
*/
public function dataappAction()
{
$agentarr = m('reim')->getappagent($this->adminid);
$arr['agentarr'] = $agentarr;
$this->showreturn($arr);
}
public function getoptnumAction()
{
$num = $this->post('num');
$mid = (int)$this->post('mid');
$arr = m('flow')->opt('getoptmenu', $num, $mid);
$this->showreturn($arr);
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* 接口文件
* createname雨中磐石
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2016-01-01
* explain返回200为正常
*/
//设置允许跨域用于最新版本APP
$origin = getheader('Origin');
if(!isempt($origin) && !contain($origin, HOST)){
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:X-Requested-With');
header('Access-Control-Allow-Credentials:true');
if(arrvalue($_SERVER,'REQUEST_METHOD')=='OPTIONS'){
showreturn('ok');
}
}
class apiAction extends ActionNot
{
public $userrs = array();
public $cfrom = '';
public $token = '';
public function initAction()
{
$this->display= false;
$time = time();
$this->cfrom= $this->request('cfrom');
$this->token= $this->request('token', $this->admintoken);
$this->adminid = (int)$this->request('adminid', $this->adminid);
$this->adminname = '';
$boss = (M == 'login|api');
if(!$boss){
if($this->isempt($this->token))$this->showreturn('','token invalid', 199);
$lodb = m('login');
$onto = $lodb->getone("`uid`='$this->adminid' and `token`='$this->token' and `online`=1");
if(!$onto)$this->showreturn('','登录失效,请重新登录', 199);
$lodb->update("`moddt`='{$this->rock->now}'", $onto['id']);
}
$this->userrs = m('admin')->getone("`id`='$this->adminid' and `status`=1", '`name`,`user`,`id`,`ranking`,`deptname`,`deptid`');
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;
}
public function getvals($nae, $dev='')
{
$sv = $this->rock->jm->base64decode($this->post($nae));
if($this->isempt($sv))$sv=$dev;
return $sv;
}
public function getpostdata()
{
$postdata = '';
if(isset($GLOBALS['HTTP_RAW_POST_DATA']))$postdata = $GLOBALS['HTTP_RAW_POST_DATA'];
if($postdata=='')$postdata = trim(file_get_contents('php://input'));
return $postdata;
}
}

View File

@@ -0,0 +1,195 @@
<?php
class asynrunClassAction extends apiAction
{
public $queuelogid = 0;
public function initAction()
{
$this->display = false;
$uid = (int)$this->get('adminid');
$this->queuelogid = (int)$this->get('queuelogid','0');
if($uid==0)$uid = 1;
$key = $this->get('asynkey');
$mykey = getconfig('asynkey');
if($mykey != ''){
$wodkey = md5(md5($mykey));
if($wodkey != $key)exit('sorry,asyn');
}
$urs = m('admin')->getone($uid,'`id`,`name`,`user`');
if($urs)$this->setNowUser($urs['id'], $urs['name'], $urs['user']);
}
public function afterAction()
{
if($this->queuelogid > 0){
$cont = ob_get_contents();
m('log')->update(array('result' => $cont), $this->queuelogid);
}
}
public function asyntestAction()
{
$krand = $this->get('krand');
m('option')->setval('asyntest', $krand);
return $krand;
}
//测试
public function indexAction()
{
$runtime = $this->get('runtime');
$this->rock->debugs('hehe:'.time().','.$runtime.'','yibu');
echo 'lala'.time().'';
}
//消息同步到微信企业会话
public function wxchattbAction()
{
$id = (int)$this->get('id');
return m('weixin:chat')->chattongbu($id);
}
//消息同步到企业客服消息汇总
public function wxkefutbAction()
{
$id = (int)$this->get('id');
return m('weixin:kefu')->chattongbu($id);
}
//薪资发放通知给人员
public function salaryffAction()
{
$id = (int)$this->get('id');
return m('flow')->initflow('hrsalary', $id)->todouser();
}
//下载微信发送的图片到服务器
public function downwxpicAction()
{
$picurl = $this->rock->jm->uncrypt($this->get('picurl'));
$msgid = $this->get('msgid');
return m('reim')->downwximg($picurl, $msgid);
}
//下载微信上媒体文件
public function downwxmediaAction()
{
$mediaid = $this->get('mediaid');
$msgid = $this->get('msgid');
$fileext = $this->get('fileext');
$barr = m('weixin:media')->downmedia($mediaid, $fileext, $msgid);
return $barr;
}
//异步发送邮件
public function sendemailAction()
{
$id = (int)$this->get('id');
$msg = m('email')->sendemailcont($id);
if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
return $msg;
}
//异步微信企业号发送提醒
public function wxsendmsgAction()
{
$body = $this->get('body');
if($body=='')return;
$body = $this->jm->base64decode($body);
$barr = m('weixin:index')->sendbody($body);
m('log')->todolog('微信提醒', $barr);
return $barr;
}
//异步企业微信发送提醒
public function wxqysendmsgAction()
{
$body = $this->get('body');
$agentid = $this->get('agentid');
if($body=='')return;
$body = $this->jm->base64decode($body);
$barr = m('weixinqy:index')->sendbody($body, $agentid);
m('log')->todolog('企业微信提醒', $barr);
return $barr;
}
//企业微信异步获取头像
public function wxqyfaceAction()
{
$userid = $this->get('userid');
if($userid=='')return;
$barr = m('weixinqy:user')->anayface($userid);
m('log')->todolog('企业微信提醒', $barr);
return $barr;
}
//钉钉异步提醒
public function ddsendmsgAction()
{
$body = $this->get('body');
if($body=='')return;
$body = $this->jm->base64decode($body);
$barr = m('dingding:index')->sendbody($body);
m('log')->todolog('钉钉提醒', $barr);
return $barr;
}
//转pdf完成了设置
public function topdfokAction()
{
$id = (int)$this->get('id');
$type = $this->get('type','html');
$status = $this->get('status','1'); //转化状态
$frs = m('file')->getone($id);
$pdfpath= str_replace('.'.$frs['fileext'].'','.'.$type.'', $frs['filepath']);
if(!file_exists($pdfpath))return;
if($type=='html'){
$cont = file_get_contents($pdfpath);
$str1 = '<meta http-equiv=Content-Type content="text/html; charset=gb2312">';
$cont = str_replace('</head>', ''.$str1.'</head>', $cont);
$this->rock->createtxt($pdfpath, $cont);
}
m('file')->update("`pdfpath`='$pdfpath'", $id);
}
//发送短信
public function sendsmsAction()
{
$tomobile = $this->get('tomobile');
$qiannum = $this->get('qiannum');
$tplnum = $this->get('tplnum');
$url = $this->jm->base64decode($this->get('url'));
$params = json_decode($this->jm->base64decode($this->get('params')), true);
return c('xinhuapi')->send($tomobile, $qiannum, $tplnum, $params, $url);
}
//订阅的
public function subscribeAction()
{
$id = $this->get('id');
$uid = $this->get('uid');
$receid = $this->get('receid');
$recename = $this->jm->base64decode($this->get('recename'));
$flow = m('flow')->initflow('subscribeinfo');
return $flow->subscribe($id, $uid, $receid, $recename);
}
//获取打卡记录
public function wxdkjlAction()
{
$dt1 = $this->get('dt1');
$dt2 = $this->get('dt2');
$page = (int)$this->get('page','2');
return m('weixinqy:daka')->getrecord('', $dt1, $dt2, $page);
}
//发送模版消息
public function wxgzhtplsendAction()
{
$body = $this->jm->base64decode($this->get('body'));
$barr = m('wxgzh:index')->sendtplasyn($body);
m('log')->todolog('模版消息', $barr);
return $barr;
}
}

View File

@@ -0,0 +1,33 @@
<?php
class deptClassAction extends apiAction
{
public function dataAction()
{
$udarr = m('dept')->getdeptuserdata(0);
$userarr = $udarr['uarr'];
$deptarr = $udarr['darr'];
$grouparr = m('reim')->getgroup($this->adminid);
$arr['deptjson'] = json_encode($deptarr);
$arr['userjson'] = json_encode($userarr);
$arr['groupjson'] = json_encode($grouparr);
$this->showreturn($arr);
}
/**
* app获取数据
*/
public function dataappAction()
{
$udarr = m('dept')->getdeptuserdata(0);
$userarr = $udarr['uarr'];
$deptarr = $udarr['darr'];
$grouparr = m('reim')->getgroup($this->adminid);
$arr['deptarr'] = $deptarr;
$arr['userarr'] = $userarr;
$arr['grouparr']= $grouparr;
$this->showreturn($arr);
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* 文件下载相关接口-用于app
*/
class fileClassAction extends apiAction
{
/**
* 获取文件信息
*/
public function getfileAction()
{
$id = (int)$this->post('id',0);
$rs = m('file')->getone($id);
if(!$rs)$this->showreturn('', '文件不存在1', 201);
$path = $rs['filepath'];
if(isempt($path) || !file_exists($path))$this->showreturn('', '文件['.$rs['filename'].']不存在', 202);
$rs['filetype'] = m('file')->getmime($rs['fileext']);
$this->showreturn($rs);
}
/**
* 下载文件
*/
public function downAction()
{
$id = (int)$this->jm->gettoken('id');
m('file')->show($id);
}
/**
* 获取文件信息
*/
public function getfilenewAction()
{
$id = (int)$this->post('id',0);
$rs = m('file')->getone($id);
if(!$rs)$this->showreturn('', '文件不存在1', 201);
$path = $rs['filepath'];
if(isempt($rs['filenum'])){
if(substr($path,0,4)!='http' && !file_exists($path))
$this->showreturn('', '文件['.$rs['filename'].']不存了', 202);
}
$rs['filetype'] = m('file')->getmime($rs['fileext']);
$rs['downurl'] = '';
$this->showreturn($rs);
}
/**
* 生成水印图片
*/
public function shuiyinAction()
{
header("Content-type:image/png");
$font = 'upload/data/simsun.ttc';
if(!file_exists($font))$font = 'C:/Windows/Fonts/simsun.ttc';
$w = 110;
$im = imagecreatetruecolor($w,$w);
$bg = imagecolorallocate($im,255,255,255);
imagefill($im,0,0,$bg); //添加背景颜色
$str = $this->adminname;
//$str = '信呼开发团队'; //改成你要的文字去掉注释
$black = imagecolorallocate($im,220,220,220);
if(file_exists($font)){
imagettftext($im, 14,45, 20, $w-10,$black, $font, $str);
}else{
imagestring($im,5,5, $w-50,$this->adminuser,$black);
}
imagepng($im);
imagedestroy($im);
}
}

View File

@@ -0,0 +1,153 @@
<?php
class indexClassAction extends apiAction
{
public function indexAction()
{
$this->showreturn('','error', 203);
}
/**
* 手机app读取
*/
public function indexinitAction()
{
$dbs = m('reim');
$ntime = floatval($this->post('ntime'));
$uid = $this->adminid;
$arr['loaddt'] = $this->now;
$arr['splittime'] = (int)($ntime/1000-time());
$arr['reimarr'] = $dbs->gethistory($uid);
$this->showreturn($arr);
}
/**
* app首页接口截止
*/
public function indexappAction()
{
$dbs = m('reim');
$ntime = floatval($this->post('ntime'));
$uid = $this->adminid;
$agent = $dbs->getappagent($uid);
$arr['loaddt'] = $this->now;
$arr['splittime'] = (int)($ntime/1000-time());
$arr['reimarr'] = $dbs->gethistory($uid);
$arr['agentarr'] = $agent['rows'];
$arr['agentstotal'] = $agent['stotal'];
$arr['maxupsize'] = c('upfile')->getmaxzhao();//最大上传大小M
$arr['appversion'] = $this->get('appversion');
$arr['xinhuver'] = VERSION;
$arr['wsconfig'] = $dbs->getreims();
$this->showreturn($arr);
}
public function lunxunAction()
{
$uid = $this->adminid;
$loaddt = $this->post('loaddt');
//$reimarr = m('reim')->getwdarr($uid, $loaddt);
$reimarr = m('reim')->gethistory($uid, $loaddt);
$arr['reimarr'] = $reimarr;
$arr['loaddt'] = $this->now;
m('login')->uplastdt();
$this->showreturn($arr);
}
//应用获取数据
public function getyydataAction()
{
$num = $this->post('num');
$event = $this->post('event');
$page = (int)$this->post('page');
$rows = m('agent:'.$num.'')->getdata($this->adminid, $num, $event, $page);
$this->showreturn($rows);
}
public function yyoptmenuAction()
{
$num = $this->post('modenum');
$sm = $this->post('sm');
$optid = (int)$this->post('optmenuid');
$zt = (int)$this->post('statusvalue');
$mid = (int)$this->post('mid');
$msg = m('flow')->opt('optmenu', $num, $mid, $optid, $zt, $sm);
if($msg != 'ok')$this->showreturn('', $msg, 201);
$this->showreturn('');
}
public function changetxAction()
{
$apptx = (int)$this->post('apptx');
m('admin')->update("`apptx`='$apptx'", $this->adminid);
$this->showreturn('');
}
public function checkewmAction()
{
$randkey = $this->get('randkey');
$lx = (int)$this->get('lx');
$val = $this->adminid;
$lxarr = array('已取消','已确认');
if($lx==0)$val='-1';
c('cache')->set($randkey,$val,60);
$this->showreturn($lxarr[$lx]);
}
/**
* 切换公司
*/
public function changecompanyAction()
{
$id = (int)$this->get('id');
$db = m('admin');
$db->update('comid='.$id.'', '`id`='.$this->adminid.'');
$db->getcompanyinfo();
return returnsuccess();
}
public function getcompanyAction()
{
$carr = m('admin')->getcompanyinfo($this->adminid);
$this->showreturn($carr);
}
/**
* 华为设置客户端token
*/
public function updateTokenIpAction()
{
$hwtoken = $this->get('hwtoken');
$pushtoken = $this->get('pushtoken');
$ispush = (int)$this->get('ispush','0');
$uarr['ispush'] = $ispush;
$uarr['pushtoken'] = $pushtoken;
$uarr['moddt'] = $this->now;
if(!isempt($hwtoken))$uarr['ip'] = $hwtoken;
m('login')->update($uarr, "`token`='$this->admintoken'");
if($ispush==1)m('reim')->sendpush($this->adminid, 'all', array(
'type' => 'onoffline',
'online' => 2
));
return returnsuccess();
}
public function addlogAction()
{
$tit = $this->post('title');
$cont = $this->post('cont');
$web = $this->post('web');
$level = (int)$this->post('level','0');
m('log')->addlogs($tit, $cont,$level, array(
'web' => $web,
));
return returnsuccess();
}
public function sgstrs()
{
}
}

View File

@@ -0,0 +1,322 @@
<?php
class indexreimClassAction extends apiAction
{
/**
* PC客户端首页读取
*/
public function indexinitAction()
{
$viewobj = m('view');
$dbs = m('reim');
$dba = m('admin');
$gtype = $this->rock->get('gtype');
$udarr = m('dept')->getdeptuserdata();
$userarr = $udarr['uarr'];
$deptarr = $udarr['darr'];
$grouparr = $dbs->getgroup($this->adminid);
$agentarr = $dbs->getagent($this->adminid);
$historyarr = $dbs->gethistory($this->adminid);
$modearr = array();
if(isempt($gtype)){
$applyarr = m('mode')->getmoderows($this->adminid,'and islu=1');
foreach($applyarr as $k=>$rs){
if(!$viewobj->isadd($rs, $this->adminid))continue;
$modearr[]=array('type'=>$rs['type'],'num'=>$rs['num'],'name'=>$rs['name']);
}
}
$arr['deptjson'] = json_encode($deptarr);
$arr['userjson'] = json_encode($userarr);
$arr['groupjson'] = json_encode($grouparr);
$arr['agentjson'] = json_encode($agentarr);
$arr['historyjson'] = json_encode($historyarr);
$arr['modearr'] = $modearr;
$arr['config'] = $dbs->getreims();
$arr['loaddt'] = $this->now;
$arr['ip'] = $this->ip;
$arr['editpass'] = $dba->iseditpass($this->adminid);
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
$arr['onlinearr'] = $this->onlinearr();
$arr['outunum'] = $this->option->getval('outunum'.$this->adminid.'');
$arr['outgroupopen']= $this->option->getval('outgroupopen'.$this->adminid.'');
if(getconfig('systype')=='demo'){
$arr['outgroupopen'] = 'close';
$arr['outunum'] = 'y4rwlnabc';
}
$this->rock->savesession(array('homestyle' => 'rock'));
return returnsuccess($arr);
}
//在线情况读取
private function onlinearr()
{
$time = date('Y-m-d H:i:s', time()-6*60);
$rows = m('login')->getall("`online`=1 and ((`ispush`=1) or (`cfrom`='reim' and moddt>='$time'))",'uid,ispush,web,cfrom');
$onlinearr = array();
foreach($rows as $k=>$rs){
$uid = $rs['uid'];
if(!isset($onlinearr[$uid]))$onlinearr[$uid]=array('uid'=>$uid,'reim'=>0,'mobile'=>0,'web'=>'');
if($rs['cfrom']=='reim')$onlinearr[$uid]['reim'] = 1;
if($rs['ispush']=='1'){
$onlinearr[$uid]['mobile'] = 1;
$onlinearr[$uid]['web'] = $rs['web'];
}
}
return $onlinearr;
}
/**
* REIM的初始化
*/
public function reiminitAction()
{
$dbs = m('reim');
$dba = m('admin');
$udarr = m('dept')->getdeptuserdata();
$userarr = $udarr['uarr'];
$deptarr = $udarr['darr'];
$grouparr = $dbs->getgroup($this->adminid);
$historyarr = $dbs->gethistory($this->adminid);
$agentarr = $dbs->getagent($this->adminid);
$arr['deptjson'] = json_encode($deptarr);
$arr['userjson'] = json_encode($userarr);
$arr['groupjson'] = json_encode($grouparr);
$arr['historyjson'] = json_encode($historyarr);
$arr['agentjson'] = json_encode($agentarr);
$arr['config'] = $dbs->getreims();
$arr['loaddt'] = $this->now;
$arr['ip'] = $this->ip;
$arr['editpass'] = $dba->iseditpass($this->adminid);
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
$this->showreturn($arr);
}
/**
* 会话列表记录
*/
public function gethistoryAction()
{
$arr = m('reim')->gethistory($this->adminid);
$this->showreturn($arr);
}
/**
* 最新app读取通信地址
*/
public function reimconfigAction()
{
$arr['config'] = m('reim')->getreims();
$type = $this->option->getval('reimservertype','0');
$appwx = $this->option->getval('reimappwxsystem','0');
if($type=='0' || $appwx=='0'){//非nodejs版本就不要
$arr['config']['wsurl'] = '';
$arr['config']['recid'] = '';
}
$this->showreturn($arr);
}
/**
* 手机网页版读取最新webapp的
*/
public function mwebinitAction()
{
$dbs = m('reim');
$dba = m('admin');
$agentarr = $dbs->getappagent($this->adminid);
$historyarr = $dbs->gethistory($this->adminid);
$arr['agentjson'] = json_encode($agentarr['rows']);
$arr['historyjson'] = json_encode($historyarr);
$arr['loaddt'] = $this->now;
$arr['loadtime'] = time();
if($historyarr)$arr['loadtime'] = strtotime($historyarr[0]['optdt']);
$arr['editpass'] = $dba->iseditpass($this->adminid);
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
//读取app首页显示图片从公告和新闻上读取
$arr['myhomenum'] = '';
if($this->isshowshouye('appsy_yyshow'))$arr['myhomenum'] = $this->option->getval('yinghomeshow_'.$this->adminid.'');//我常用的
$silderarr = array();
if($this->isshowshouye('appsy_ggshow')){
$sildergong = m('flow')->initflow('gong')->getflowrows($this->adminid, 'my', 5, " and `appxs`=1");
foreach($sildergong as $k=>$rs){
if(isempt($rs['fengmian']))continue;
$silderarr[] = array(
'src' => $this->rock->gethttppath($rs['fengmian']),
'title' => $rs['title'],
'url' => 'task.php?a=x&num=gong&mid='.$rs['id'].''
);
}
}
if($this->isshowshouye('appsy_xwshow','否')){
$sildernews = m('flow')->initflow('news')->getflowrows($this->adminid, 'my', 5, " and `appxs`=1");
foreach($sildernews as $k=>$rs){
if(isempt($rs['fengmian']))continue;
$silderarr[] = array(
'src' => $this->rock->gethttppath($rs['fengmian']),
'title' => $rs['title'],
'url' => 'task.php?a=x&num=news&mid='.$rs['id'].''
);
}
}
$arr['silderarr'] = $silderarr;
$arr['outunum'] = $this->option->getval('outunum'.$this->adminid.'');
$arr['outgroupopen'] = $this->option->getval('outgroupopen'.$this->adminid.'');
$arr['tonghuabo'] = getconfig('video_bool') ? '1' : '2';//是否开启音视频
$this->showreturn($arr);
}
private function isshowshouye($lx, $mr='是')
{
$val = $this->option->getval($lx);
if(isempt($val))$val=$mr;
return $val=='是';
}
public function ldataAction()
{
$loaddt = $this->rock->jm->base64decode($this->post('loaddt'));
if($loaddt && !c('check')->isdatetime($loaddt))$loaddt='';
$type = $this->post('type','history');
$dbs = m('reim');
$json = array();
if($type=='history')$json = $dbs->gethistory($this->adminid, $loaddt);
if($type=='group')$json = $dbs->getgroup($this->adminid);
if($type=='dept')$json = m('dept')->getdata();
if($type=='user')$json = m('admin')->getuser();
if($type=='agent')$json = $dbs->getagent($this->adminid);
if($type=='config')$json = m('reim')->getreims();
$arr['json'] = json_encode($json);
$arr['loaddt'] = $this->now;
$arr['ip'] = $this->ip;
$arr['type'] = $type;
$this->showreturn($arr);
}
public function indexupgetAction()
{
$historyarr = m('reim')->gethistory($this->adminid);
$arr['historyjson'] = json_encode($historyarr);
$this->showreturn($arr);
}
public function changewxtxAction()
{
$tx = (int)$this->post('tx','1');
m('admin')->update('wxtx='.$tx.'', $this->adminid);
$this->showreturn('');
}
public function showmyinfoAction()
{
$dbs = m('admin');
$arr = $dbs->getone($this->adminid,'`id`,`deptallname`,`ranking`,`email`,`tel`,`apptx`,`face`,`name`,`user`,`mobile`');
if(!$arr)$this->showreturn('','not user', 201);
$arr['face'] = $dbs->getface($arr['face']);
$arr['admintoken'] = $this->admintoken;
$arr['companyinfo'] = $dbs->getcompanyinfo($this->adminid, 1);
$arr['companymode'] = ISMORECOM;
if(m('reim')->installwx(3)){
$bdwx = m('wouser')->getone('`uid`='.$this->adminid.'','nickname,headimgurl');
$arr['bdwx'] = $bdwx;
}
$this->showreturn($arr);
}
public function wxbdjcAction()
{
m('wouser')->update('`uid`=0','`uid`='.$this->adminid.'');
$this->showreturn('');
}
//同步微信上头像
public function tongbufaceAction()
{
$reim = m('reim');
if($reim->installwx(1)){
$barr = m('weixinqy:user')->anayface($this->userrs['user'], true);
if($barr['errcode'] != 0)$this->showreturn('',$barr['msg'],202);
$this->showreturn($barr);
}else{
$this->showreturn('','没部署企业微信',201);
}
}
public function loadinfoAction()
{
$type = $this->get('type');
$receid = $this->get('receid');
$arr = array();
if($type=='user'){
$arr = m('admin')->getuser(0, $receid);
}
$this->showreturn($arr);
}
//判断是否有最新历史信息
public function loadhitAction()
{
$time = $this->get('time');
$arr['loadtime'] = $time;
$optdt = date('Y-m-d H:i:s', $time);
$arr['total'] = 0;
$historyarr = m('reim')->gethistory($this->adminid, $optdt);
$arr['rows'] = $historyarr;
if($historyarr)$arr['loadtime'] = strtotime($historyarr[0]['optdt']);
$this->showreturn($arr);
}
//设置常应用
public function shecyyAction()
{
$yynum = $this->get('yynum');
$myyyid= $this->option->getval('yinghomeshow_'.$this->adminid.'');
$yarrs = array();
$iscy = 0;
if(isempt($myyyid)){
$yarrs[]= $yynum;
$iscy = 1;
}else{
$yarrs = explode(',', $myyyid);
if(in_array($yynum, $yarrs)){
$iscy = 0;
foreach($yarrs as $k1=>$v1)if($v1==$yynum)unset($yarrs[$k1]);
}else{
$iscy = 1;
$yarrs[]= $yynum;
}
}
$myyyid = join(',', $yarrs);
$this->option->setval('yinghomeshow_'.$this->adminid.'', $myyyid);
$msg = '已设置首页显示';
if($iscy==0)$msg = '已取消首页显示';
$this->showreturn(array(
'iscy' => $iscy,
'msg' => $msg,
));
}
public function openoutqunAction()
{
$isop = $this->get('isop');
$this->option->setval('outgroupopen'.$this->adminid.'', $isop);
return returnsuccess();
}
}

View File

@@ -0,0 +1,54 @@
<?php
class kaoqinClassAction extends apiAction
{
public function adddkjlAction()
{
$mac = $this->post('mac');
$ip = $this->post('ip');
$msg = m('kaoqin')->adddkjl($this->adminid,0,'',$ip,$mac);
if($msg!='')$this->showreturn('', $msg, 201);
$this->showreturn($this->now);
}
public function getshangAction()
{
$kq = m('kaoqin');
$dt = $this->rock->date;
$sbarr = $kq->getsbanay($this->adminid, $dt);
$dkarr = $kq->getdkjl($this->adminid, $dt);
$barr['sbarr'] = $sbarr;
$barr['dkarr'] = $dkarr;
$this->showreturn($barr);
}
public function getpaibAction()
{
$barr = array();
$month = $this->get('month');
$uid = $this->get('uid', $this->adminid);
$maxjg = c('date')->getmaxdt($month);
$kqobj = m('kaoqin');
$ztarr = array();
for($i=1;$i<=$maxjg;$i++){
$oi = ($i<10) ? '0'.$i.'' : $i;
$dt = $month.'-'.$oi;
$zt = '';
$iswork = $kqobj->isworkdt($uid, $dt);
if($iswork==1){
$zt = $kqobj->getdistid($uid, $dt);
if(!in_array($zt, $ztarr))$ztarr[] = $zt;
}
$barr[$dt] = $zt;
}
$abc = '其中:';
if($ztarr){
$rows = m('kqsjgz')->getall('id in('.join(',', $ztarr).')');
foreach($rows as $k=>$rs)$abc.='['.$rs['id'].']'.$rs['name'].';';
}
$barr['abc'] = $abc;
$this->showreturn($barr);
}
}

View File

@@ -0,0 +1,271 @@
<?php
class loginClassAction extends apiAction
{
public function checkAction()
{
$adminuser = str_replace(' ','',$this->rock->jm->base64decode($this->post('user')));
$adminpass = $this->rock->jm->base64decode($this->post('pass'));
$arr = m('login')->start($adminuser, $adminpass);
if(is_array($arr)){
if(isset($arr['mobile'])){
$this->showreturn($arr, $arr['msg'], 205);
}
$arrs = array(
'uid' => $arr['uid'],
'name' => $arr['name'],
'user' => $arr['user'],
'ranking' => $arr['ranking'],
'deptname' => $arr['deptname'],
'deptallname' => $arr['deptallname'],
'face' => $arr['face'],
'apptx' => $arr['apptx'],
'loginyzm' => (int)getconfig('loginyzm','0'),
'token' => $arr['token'],
'iskq' => (int)m('userinfo')->getmou('iskq', $arr['uid']), //判断是否需要考勤
'title' => getconfig('apptitle'),
'weblogo' => getconfig('weblogo')
);
$uid = $arr['uid'];
$name = $arr['name'];
$user = $arr['user'];
$token = $arr['token'];
m('login')->setsession($uid, $name, $token, $user);
$this->showreturn($arrs);
}else{
$this->showreturn('', $arr, 201);
}
}
public function loginexitAction()
{
m('login')->exitlogin('', $this->token);
$this->showreturn('');
}
/**
* app登录页面初始化
*/
public function appinitAction()
{
$arrs = array(
'loginyzm' => (int)getconfig('loginyzm','0'),
'title' => getconfig('apptitle'),
'apptheme' => getconfig('apptheme'),
'titleall' => TITLE,
'regtype' => getconfig('regtype','0'), //是否可注册1,可注册
);
$this->showreturn($arrs);
}
/**
* 下载图片
*/
public function downimgAction()
{
$paths= $this->getvals('path');
$path = str_replace(URL, '', $paths);
$obj = c('upfile');
$str = '';
$ext = $obj->getext($path);
if($obj->isimg($ext) && file_exists($path)){
$str = base64_encode(file_get_contents($path));
}
$this->showreturn(array(
'result' => $str,
'path' => $paths
));
}
/**
* 下载图片新
*/
public function downimgnewAction()
{
$paths= urldecode($this->get('path'));
$path = str_replace(URL, '', $paths);
$obj = c('upfile');
$str = '';
$ext = $obj->getext($path);
if($obj->isimg($ext) && (file_exists($path) || substr($path,0,4)=='http')){
$str = base64_encode(file_get_contents($path));
}
$this->showreturn(array(
'result' => $str,
'path' => $paths
));
}
/**
* 读取可上传最大M
*/
public function getmaxupAction()
{
$maxup = c('upfile')->getmaxzhao();
$this->showreturn(array(
'maxup' => $maxup
));
}
/**
* 钉钉jssdk签名
*/
public function ddsignAction()
{
$bo = m('dingding:signjssdk');
$corpId = $bo->readwxset();
$agentid= $this->post('agentid');
if(isempt($agentid))$agentid = $this->rock->session('wxqyagentid');
if(isempt($corpId) || isempt($agentid)){
$arr['corpId'] = '';
}else{
$url = $this->getvals('url');
$arr = $bo->getsignsdk($url);
$arr['agentId'] = $agentid;
}
$this->showreturn($arr);
}
/**
* 获取钉钉企业Id
*/
public function ddqiyeidAction()
{
$this->showreturn(array(
'qiyeid' => $this->option->getval('dingding_qiyeid')
));
}
/**
* 钉钉获取登录
*/
public function dingcheckAction()
{
$code = $this->post('code');
$barr = m('dingding:user')->getuserjssdk($code);
if($barr['errcode']!=0){
$this->showreturn('', $barr['msg'], 201);
}else{
$this->showreturn($barr);
}
}
//初始化验证
public function initsetAction()
{
$call = $this->get('callback');
$barr['title'] = getconfig('reimtitle','REIM');
$barr['stype'] = 'new';
$barr['version']= VERSION;
echo ''.$call.'('.json_encode($barr).')';
}
public function inauthAction()
{
$call = $this->get('callback');
$barr['host'] = HOST;
echo ''.$call.'('.json_encode($barr).')';
}
public function getewmAction()
{
$randkey = $this->get('randkey');
if(isempt($randkey))return;
$dfrom = $this->get('dfrom');
$key = md5($randkey);
c('cache')->set($key,'-2',70);
header("Content-type:image/png");
$url = ''.getconfig('outurl', URL).'?m=logn&d=we&randkey='.$key.'&dfrom='.$dfrom.'';
if(COMPANYNUM)$url.='&dwnum='.COMPANYNUM.'';
$img = c('qrcode')->show($url);
echo $img;
}
public function checkewmAction()
{
$randkey = $this->get('randkey');
$key = md5($randkey);
$val = c('cache')->get($key);
$data['val'] = $val;
if(isempt($randkey))$this->showreturn($data);
if($val>'0'){
$dbs = m('admin');
$urs = $dbs->getone("`id`='$val' and `status`=1",'`id`,`name`,`user`,`face`,`pass`');
if(!$urs){
$val = '-1';
}else{
c('cache')->set('login'.$urs['user'].'', $urs['id'], 60);
$data['user'] = $urs['user'];
$data['face'] = $dbs->getface($urs['face']);
$data['pass'] = md5($urs['pass']);
c('cache')->del($key);
}
}
$data['val'] = $val;
$this->showreturn($data);
}
/**
* 创建二维码
*/
public function ewmAction()
{
header("Content-type:image/png");
$url = $this->jm->base64decode($this->get('url'));
if(substr($url,0,4)!='http')$url =''.$this->rock->getouturl().''.$url.'';
$img = c('qrcode')->show($url);
echo $img;
}
/**
* 安卓检查是否有app更新
*/
public function appupdateAction()
{
$nowver = getconfig('app_version');//app的版本
$ver = $this->get('ver');
$barr['success'] = false;
$path = getconfig('app_verpath','images/app.apk');//app文件版本
if(!isempt($nowver) && file_exists($path) && $ver<$nowver){
$barr['success'] = true;
$barr['version'] = $nowver;
$barr['size'] = '3.2M';
$barr['updateurl'] = ''.URL.''.$path.'';
$barr['explain'] = getconfig('app_verremark','完善推送功能');
}
echo json_encode($barr);
}
/**
* reim平台快捷登录到oa
*/
public function reimplatloginAction()
{
return m('reimplat:oauth')->login();
}
/**
* 验证小程序地址
*/
public function yzxcyAction()
{
$openid = $this->get('openid');
$mobile = $this->get('mobile');
if(!$openid || !$mobile)return returnerror('err');
$mobile = $this->jm->base64decode($mobile);
$where = "`mobile`='$mobile'";
if(m('admin')->rows($where)==0 && m('customer')->rows($where)==0 )return retuenerror('此手机号没在我们系统登记过');
$na = getconfig('titleout');
if(!$na)$na = TITLE;
return returnsuccess(array(
'name' => $na,
'key' => md5(getconfig('openkey')),
'logo' => 'images/logo.png'
));
}
}

View File

@@ -0,0 +1,372 @@
<?php
class reimClassAction extends apiAction
{
/**
* 获取聊天记录
*/
public function getrecordAction()
{
$uid = $this->adminid;
$type = $this->post('type');
$gid = (int)$this->post('gid');
$minid = (int)$this->post('minid');
$lastdt = (int)$this->post('lastdt');
$lastdts = '';
if($lastdt>0)$lastdts = date('Y-m-d H:i:s', $lastdt);
$arr = m('reim')->getrecord($type, $uid, $gid, $minid, $lastdts);
$this->showreturn($arr);
}
/**
* 获取会话的信息
*/
public function getreceinforAction()
{
$uid = $this->adminid;
$type = $this->post('type');
$gid = (int)$this->post('gid');
$reimdb = m('reim');
$arr['receinfor'] = $reimdb->getreceinfor($type, $gid);
$reimdb->setallyd($type, $uid, $gid);
$this->showreturn($arr);
}
/**
* 发消息
*/
public function sendinforAction()
{
$uid = $this->adminid;
$type = $this->post('type');
$gid = (int)$this->post('gid');
$lx = 0;
if($this->cfrom=='reim')$lx=1;
if($type=='group'){
$tos = m('im_groupuser')->rows("`gid`='$gid' and `uid`='$uid'");
if($tos==0)$this->showreturn('','您不在此会话中,不允许发送', 201);
}
$cont = $this->post('cont');
$cont = $this->jm->base64decode($cont);
$cont = str_replace('<br>','[BR]', $cont);
$cont = str_replace(array('<','>'),array('&lt;','&gt;'), $cont);
$cont = $this->jm->base64encode(str_replace('[BR]','<br>',$cont));
$arr = m('reim')->sendinfor($type, $uid, $gid, array(
'optdt' => $this->now,
'cont' => $cont,
'fileid'=> (int)$this->post('fileid')
), $lx);
$arr['sendname'] = $this->adminname;
$this->showreturn($arr);
}
/**
* 标识已读
*/
public function yiduAction()
{
$id = $this->post('id');
m('reim')->setyd($id, $this->adminid);
$this->showreturn($id);
}
//将会话标识已读
public function yiduallAction()
{
$type = $this->post('type');
$gid = (int)$this->post('gid');
m('reim')->setallyd($type, $this->adminid, $gid);
$this->showreturn('');
}
/**
* 创建讨论组
*/
public function createtaolunAction()
{
$name = $this->post('title');
$explain= $this->post('content');
$receid = $this->post('receid');
if($name==''||$receid=='')$this->showreturn('','not data',201);
$arr = m('reim')->creategroup($name, $receid.','.$this->adminid, 1, $explain);
$this->showreturn($arr);
}
/**
* 获取会话上人员
*/
public function getgroupuserAction()
{
$gid = (int)$this->post('gid');
$type = $this->post('type');
$arr = m('reim')->getgroupuser($gid, $type);
$this->showreturn($arr);
}
/**
* 下载聊天记录
*/
public function downrecordAction()
{
$minid = floatval($this->post('minid','999999999'));
$maxid = floatval($this->post('maxid','0'));
$arr = m('reim')->downrecord($this->adminid, $maxid, $minid);
$this->showreturn($arr);
}
/**
* 删除历史会话
*/
public function delhistoryAction()
{
$gid = (int)$this->post('gid');
$type = $this->post('type');
$arr = m('reim')->delhistory($type,$gid,$this->adminid);
$this->showreturn('');
}
//邀请人员
public function yaoqinguidAction()
{
$gid = (int)$this->post('gid');
$val = $this->post('val');
$ids = m('reim')->adduserchat($gid, $val, true);
$msg = 'success'.$ids.'';
$this->showreturn($msg);
}
//修改会话名称
public function editnameAction()
{
$gid = (int)$this->post('gid');
$val = $this->post('val');
if(isempt($val))return returnerror('不能为空');
m('reim')->editname($gid, $val);
$this->showreturn('');
}
//邀请人员
public function yaoqingnameAction()
{
$gid = (int)$this->post('gid');
$val = $this->post('val');
if(isempt($val))return returnerror('不能为空');
$urs = m('admin')->geturs($val);
if(!$urs)return returnerror('“'.$val.'”不存在');
$uids = ''.$urs['id'].'';
$ids = m('reim')->adduserchat($gid, $uids, true);
$msg = 'success'.$ids.'';
$this->showreturn('ok');
}
//退出讨论组
public function exitgroupAction()
{
$aid = (int)$this->post('aid');
if($aid==0)$aid = $this->adminid;
$gid = (int)$this->post('gid');
m('reim')->exitchat($gid, $aid);
$this->showreturn('success');
}
public function createlunAction()
{
$val = $this->getvals('val');
$isadd = m('view')->isadd('huihua', $this->adminid);
if(!$isadd)return returnerror('无权限创建会话');
m('reim')->createchat($val, $this->adminid,$this->adminid, $this->adminname,'', true);
$this->showreturn('success');
}
//清除历史记录
public function clearrecordAction()
{
$gid = (int)$this->post('gid');
$type = $this->post('type');
$ids = c('check')->onlynumber($this->post('ids'));
$day = (int)$this->post('day');
$arr = m('reim')->clearrecord($type,$gid,$this->adminid, $ids, $day);
$this->showreturn('');
}
//上传头像
public function changefaceAction()
{
$fid = (int)$this->post('id');
$uid = $this->adminid;
$face = m('admin')->changeface($uid, $fid);
if(!$face)$this->showreturn('','fail changeface',201);
$this->showreturn($face);
}
//下载文件
public function downfileAction()
{
$id = (int)$this->post('id');
m('file')->download($id);
}
//修改会话头像
public function editfaceAction()
{
$gid = (int)$this->get('gid');
$fileid = (int)$this->get('fileid');
if($gid<=0)return returnerror('error');
m('reim')->editface($gid, $fileid);
$this->showreturn('');
}
/**
* 文件转发发送给对应人员
*/
public function forwardAction()
{
$fid = (int)$this->post('fileid');
$tuid= $this->post('tuid');
$msg = m('reim')->forward($tuid, 'user', $this->post('cont'), $fid);
if($msg!='ok')$this->showreturn('', $msg, 201);
$this->showreturn('');
}
/**
* 消息撤回
*/
public function chehuimessAction()
{
$gid = (int)$this->post('gid');
$type = $this->post('type');
$ids = (int)$this->post('ids');
$barr = m('reim')->chehuimess($type, $gid, $ids);
if(is_array($barr))$this->showreturn($barr);
$this->showreturn('', $barr, 201);
}
public function saveoutunumAction()
{
$unum = $this->get('unum');
$num = 'outunum'.$this->adminid.'';
$this->option->setval($num, $unum);
return returnsuccess();
}
/**
* 收藏使用
*/
public function savestarAction()
{
$content = $this->post('content');
$kev = $this->post('kev');
$id = (int)$this->post('id','0');
$num = 'reimstar_'.$this->adminid.'';
$this->option->setval($num,'收藏消息');
$pid = $this->option->getpids($num);
$snum = ''.$num.'_'.$kev.'';
$sid = $this->option->getpids($snum);
if($sid>0)$id = $sid;
$uarr = array(
'value' => $content,
'pid' => $pid,
'num' => $snum,
'optdt' => $this->now,
'optid' => $this->adminid,
);
if($id==0){
$id = $this->option->insert($uarr);
}else{
$this->option->update($uarr, $id);
}
return returnsuccess(array(
'id' => $id
));
}
public function getstarAction()
{
$num = 'reimstar_'.$this->adminid.'';
$pid = $this->option->getpids($num);
$data = $this->option->getall('`pid`='.$pid.'','id,value','optdt desc');
return returnsuccess($data);
}
public function delstarAction()
{
$id = (int)$this->get('id');
$this->option->delete('`id`='.$id.' and `optid`='.$this->adminid.'');
return returnsuccess();
}
public function rockkefuAction()
{
$barr = c('rockkefu')->getdata('openkefu','exists', array(
'user' => $this->userrs['user']
));
$msg = 'err';
if($barr['success'])$msg='ok';
return returnsuccess($msg);
}
/**
* 读取消息情况
*/
public function getxqkkdAction()
{
$barr = array();
$id = (int)$this->get('id');
$mrs = m('im_mess')->getone($id);
$type = $mrs['type'];
$receuid = $mrs['receuid'];
$recearr = explode(',', $receuid);
//$barr['mrs'] = $mrs;
$yiduids = '';
$widuids = '';
if($type=='user'){
if($mrs['zt']==1){
$yiduids = $mrs['receid'];
}else{
$widuids = $mrs['receid'];
}
}else{
$rows = m('im_messzt')->getall('mid='.$id.'');
foreach($rows as $k=>$rs)$widuids.=','.$rs['uid'].'';
if($widuids){
$widuids = substr($widuids, 1);
$widuar = explode(',', $widuids);
foreach($recearr as $sid)if(!in_array($sid, $widuar))$yiduids.=','.$sid.'';
if($yiduids)$yiduids = substr($yiduids, 1);
}else{
$yiduids = $receuid;
}
}
$ydarr = $wdarr = array();
$dbs = m('admin');
if($yiduids){
$rows = $dbs->getall('`id` in('.$yiduids.')','name,face,id','sort asc');
foreach($rows as $k=>$rs){
$ydarr[] = array(
'name' => $rs['name'],
'id' => $rs['id'],
'face' => $dbs->getface($rs['face']),
);
}
}
if($widuids){
$rows = $dbs->getall('`id` in('.$widuids.')','name,face,id','sort asc');
foreach($rows as $k=>$rs){
$wdarr[] = array(
'name' => $rs['name'],
'id' => $rs['id'],
'face' => $dbs->getface($rs['face']),
);
}
}
$barr['ydarr'] = $ydarr;
$barr['wdarr'] = $wdarr;
return returnsuccess($barr);
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* 作者:信呼开发团队(雨中磐石)
* 官网http://www.rockoa.com
* 软件信呼OA
* REIM即使通信平台回调
*/
class reimplatClassAction extends apiAction{
public function initAction()
{
$this->display= false;
}
//平台上通知过来的数据
public function indexAction()
{
return 'success'; //这个用不到就直接返回了
$body = $this->getpostdata();
if(!$body)return;
$db = m('reimplat:dept');
$key = $db->gethkey();
$bodystr = $this->jm->strunlook($body, $key);
if(!$bodystr)return;
$data = json_decode($bodystr, true);
$msgtype = arrvalue($data,'msgtype');
$msgevent= arrvalue($data,'msgevent');
//用户状态改变停用
if($msgtype=='subscribe'){
$user = arrvalue($data, 'user');
$zt = '0';
if($msgevent=='yes')$zt = '1';
if($msgevent=='stop')$zt = '2';
$db->update('`status`='.$zt.'',"`user`='$user'");
}
//修改手机号
if($msgtype=='editmobile'){
$user = arrvalue($data, 'user');
$mobile = arrvalue($data, 'mobile');
$where = "`user`='$user'";
$upstr = "`mobile`='$mobile'";
$db->update($upstr, $where);
$dbs = m('admin');
$dbs->update($upstr,$where);
$uid = $dbs->getmou('id',$where);
m('userinfo')->update($upstr,"`id`='$uid'");
}
//修改密码
if($msgtype=='editpass'){
$user = arrvalue($data, 'user');
$pass = arrvalue($data, 'pass');
if($pass && $user){
$where = "`user`='$user'";
$mima = md5($pass);
m('admin')->update("`pass`='$mima',`editpass`=`editpass`+1", $where);
}
}
}
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* 【文档】记事接口
* createname雨中磐石
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2016-08-12
*/
class scheduleClassAction extends apiAction
{
public function getlistAction()
{
$startdt = $this->post('startdt');
$enddt = $this->post('enddt');
$arr = m('schedule')->getlistdata($this->adminid, $startdt, $enddt);
$this->showreturn($arr);
}
}

View File

@@ -0,0 +1,167 @@
<?php
class tonghuaClassAction extends apiAction
{
/**
* 通话初始化
*/
public function thinitAction()
{
if(!getconfig('video_bool'))return returnerror('系统未开启音视频');
$id = (int)$this->get('id');
$type = (int)$this->get('type');
if($id==$this->adminid)return returnerror('不能和自己通话');
$nowtime = strtotime($this->now);
//判断用户有没有在线
$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;
if($ondats){
if($ondats['pc']==$id)$online = true;
if($ondats['app']==$id)$online = true;
}
if(!$online){
$to = m('login')->rows('`uid`='.$id.' and `online`=1 and `ispush`=1');
if($to==0)return returnerror('对方不在线,无法通话');
}
$barr = c('xinhuapi')->getdata('tonghua','thinit', array('faid'=>$this->adminid,'nowtime'=>$nowtime,'toid'=>$id,'type'=>$type));
if(!$barr['success'])return $barr;
$data = $barr['data'];
$key = $data['channel'];
c('cache')->set($key, $data, 60);
//保存自己通话里面
m('im_tonghua')->insert(array(
'uid' => $this->adminid,
'faid' => $this->adminid,
'channel' =>$data['channel'],
'type' =>$data['type'],
'joinids' =>$id,
'adddt' =>$this->now,
));
//异步发送
c('rockqueue')->push('tonghua,call', array('key' => $key,'cishu'=>1));
return $barr;
}
/**
* 取消呼叫
*/
public function cancelAction()
{
$channel = $this->get('channel');
$state = (int)$this->get('state','3');
m('im_tonghua')->update('`state`='.$state.'',"`channel`='$channel'");
$barr = c('rockqueue')->push('tonghua,cancel', array('key' => $channel));
if(!$barr['success'])return $barr;
return returnsuccess();
}
/**
* 接电话了(1同意2拒绝,3取消4接受者已打开页面5呼叫超过30秒无人接听)
*/
public function jieAction()
{
$channel = $this->get('channel');
$state = (int)$this->get('state','2');
$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;
}
return returnsuccess(array(
'satype' => $satype
));
}
/**
* 接通
*/
public function jietongAction()
{
$channel = $this->get('channel');
$barr = c('xinhuapi')->getdata('tonghua','jietong', array('uid'=>$this->adminid,'channel'=>$channel));
if($barr['success']){
$bars = $this->jieAction();
if(!$bars['success'])return $bars;
$datas= $bars['data'];
foreach($datas as $k=>$v)$barr['data'][$k] = $v;
}
return $barr;
}
/**
* 结束通话
*/
public function jiesuAction()
{
$nowtime = strtotime($this->now);
$channel = $this->get('channel');
$toid = (int)$this->get('toid');
c('rockqueue')->push('tonghua,jiesu', array('uid'=>$this->adminid,'toid'=>$toid,'nowtime'=>$nowtime,'channel'=>$channel));
m('im_tonghua')->update("`enddt`='$this->now',`jieid`='$this->adminid'","`channel`='$channel'");
return returnsuccess();
}
/**
* 接受者打开了界面
*/
public function receopenAction()
{
$channel = $this->get('channel');
$where = "`channel`='$channel'";
$dbs = m('im_tonghua');
$dbs->update('`state`=4', $where);
$thrs = $dbs->getone($where);
$sytime = time()-strtotime($thrs['adddt']);
return returnsuccess(array(
'sytime' => $sytime
));
}
/**
* 时时读取状态
*/
public function stateAction()
{
$channel = $this->get('channel');
$onrs = m('im_tonghua')->getone("`channel`='$channel'");
$tayar = array('','tongyi','jujue','cancel','wait','cancel');
return returnsuccess(array(
'state' => arrvalue($tayar, $onrs['state'])
));
}
/**
* 判断通话是不是结束
*/
public function statethAction()
{
$channel = $this->get('channel');
$onrs = m('im_tonghua')->getone("`channel`='$channel'");
$state = 'wu';
if($onrs && !isempt($onrs['enddt']))$state = 'jiesu';
return returnsuccess(array(
'state' => $state
));
}
}

View File

@@ -0,0 +1,526 @@
<?php
class uploadClassAction extends apiAction
{
/**
* 上传文件
*/
public function upfileAction()
{
if(!$_FILES)exit('sorry!');
$upimg = c('upfile');
$maxsize= (int)$this->get('maxsize', $upimg->getmaxzhao());//上传最大M
$uptypes= '*';
$updir = $this->get('updir');
if(isempt($updir)){
$updir=date('Y-m');
}else{
$updir=str_replace(array(' ','.'),'', trim($updir));
$updir=str_replace('{month}',date('Y-m'), $updir);
$updir=str_replace('{Year}',date('Y'), $updir);
$updir=str_replace(array('{','}'),'', $updir);
$updir=str_replace(',','|', $updir);
}
$upimg->initupfile($uptypes, ''.UPDIR.'|'.$updir.'', $maxsize);
$upses = $upimg->up('file');
if(!is_array($upses))exit($upses);
$arr = c('down')->uploadback($upses);
$arr['autoup'] = getconfig('qcloudCos_autoup') ? 1 : 0; //是否上传其他平台
$this->returnjson($arr);
}
/**
* 这个是用来在线编辑文档上传的
*/
public function upfilevbAction()
{
$fileid = (int)$this->get('fileid','0');
if($fileid==0)exit('fileid=0');
$data = $this->getpostdata();
if(isempt($data))return '没有数据';
$fileext= $this->get('fileext');
$uptype = '|doc|docx|xls|xlsx|ppt|pptx|';
if(!contain($uptype,'|'.$fileext.'|'))$fileext='doc';
$fileobj = m('file');
$frs = $fileobj->getone($fileid); //记录
if(!$frs)exit('文件记录不存在了');
$frs['oldfilepath'] = $frs['filepath'];
$filename = $frs['filename'];
if(!contain($filename, '.'.$fileext.'')){
$filename = str_replace(array('.doc','.xls','.ppt'), '.'.$fileext.'', $filename);
}
$filepath = ''.UPDIR.'/'.date('Y-m').'/'.date('d_His').''.rand(10,99).'.'.$fileext.'';
$this->rock->createtxt($filepath, base64_decode($data));
$filesize = filesize($filepath);
$filesizecn = $this->rock->formatsize($filesize);
//更新文件
$fileobj->update(array(
'filename' => $filename,
'filepath' => $filepath,
'filenum' => '',
'filesize' => $filesize,
'filesizecn' => $filesizecn,
'fileext' => $fileext,
'pdfpath' => '',
),$fileid);
c('cache')->del('filetopdf'.$fileid.'');
//【弃用】发队列自动上传到信呼文件平台
if(getconfig('autoup_toxinhudoc')){
//c('rockqueue')->sendfile($fileid);
}
//上传到腾讯存储
if(getconfig('qcloudCos_autoup')){
c('rockqueue')->sendfile($fileid);
}
//告诉上传人说编辑了他的附件
$mknums = arrvalue($frs,'mknum');
if(!isempt($mknums) && $frs['mid']>0){
$mid = $frs['mid'];
$mknumsa = explode('|', $mknums);
$modenum = $mknumsa[0];
if(isset($mknumsa[1]))$mid = $mknumsa[1];
$flow = m('flow')->initflow($modenum, $mid, false);
$ssid = $flow->addlog(array(
'name' => '在线编辑'
));
$ufrs = $frs;
$ufrs['filepath'] = $frs['oldfilepath'];
unset($ufrs['oldfilepath']);
unset($ufrs['id']);
$ufrs['mtype'] = 'flow_log';
$ufrs['mid'] = $ssid;
$ufrs['mknum'] = ''.$modenum.'|'.$mid.'';
$ufrs['filename'] = str_replace('.'.$ufrs['fileext'].'','(备份).'.$ufrs['fileext'].'', $ufrs['filename']);
$fileobj->insert($ufrs); //记录原来的文件
//不是我创建就告诉创建人
if($this->adminid<>$frs['optid'])
$flow->push($frs['optid'],'', ''.$this->adminname.'在线编辑文件“'.$frs['filename'].'”', '文件在线编辑');
$flow->floweditoffice($frs, $ufrs);
}else if($this->adminid<>$frs['optid']){ //不知道关联哪个模块
$flow = m('flow')->initflow('word');
$flow->push($frs['optid'],'文档', ''.$this->adminname.'在线编辑文件“'.$frs['filename'].'”', '文件在线编辑',0, array(
'wxurl' => ''
));
}
$frs['filesize'] = $filesize;
$fkey = $this->createtempurl($frs);
return 'ok,'.$fkey.'';
}
/**
* 上传时初始化看是不是存在文件
*/
public function initfileAction()
{
$filesize = c('check')->onlynumber($this->post('filesize'));
$fileext = $this->post('fileext');
$filename = $this->getvals('filename');
$where = "`fileext`='$fileext' and `filesize`='$filesize'";
if(!isempt($filename))$where.=" and `filename`='$filename'";
$frs = m('file')->getone($where,'*','`id` desc');
$bo = false;
if($frs){
$filepath = $frs['filepath'];
if(!isempt($filepath) && file_exists($filepath))$bo=true;
}
if($bo){
$this->showreturn(json_encode($frs));
}else{
$this->showreturn('','not found', 201);
}
}
public function upfileappAction()
{
if(!$_FILES)$this->showreturn('', '禁止访问', 201);
$upimg = c('upfile');
$maxsize= (int)$this->get('maxsize', $upimg->getmaxzhao());//上传最大M
$uptypes= '*';
$upimg->initupfile($uptypes, ''.UPDIR.'|reimchat|'.date('Y-m').'', $maxsize);
$upses = $upimg->up('file');
if(!is_array($upses))$this->showreturn('', $upses, 202);
$arr = c('down')->uploadback($upses);
$this->showreturn($arr);
}
public function upcontAction()
{
$cont = $this->post('content');
if(isempt($cont))exit('sorry not cont');
$cont = str_replace(' ','', $cont);
$cont = $this->rock->jm->base64decode($cont);
$arr = c('down')->createimage($cont,'png','截图');
$this->returnjson($arr);
}
public function getfileAjax()
{
$cont = '';
$path = ''.UPDIR.'/uptxt'.$this->adminid.'.txt';
if(file_exists($path)){
@$cont = file_get_contents($path);
}
$data = array();
if($cont!=''){
$arr = json_decode($cont, true);
$msg = $arr['msg'];
$data = $arr['data'];
@unlink($path);
}else{
$msg = 'sorry,not infor!';
}
$this->showreturn($data, $msg);
}
public function getfileAction()
{
$fileid = (int)$this->post('fileid',0);
$rs = m('file')->getone($fileid);
$this->showreturn($rs);
}
public function downAction()
{
$id = (int)$this->jm->gettoken('id');
m('file')->show($id);
}
//记录预览记录
public function logsAction()
{
$fileid = (int)$this->post('fileid',0);
$type = (int)$this->post('type',0);
m('file')->addlogs($fileid, $type);
}
/**
* 发送编辑权限
*/
public function rockofficeeditAction()
{
$fileid = (int)$this->get('id');
$lx = (int)$this->get('lx');
$frs = m('file')->getone($fileid);
if(!$frs)return returnerror('文件不存在了');
$filepath = $frs['filepath'];
$filepathout = $frs['filepathout'];
if(substr($filepath,0,4)!='http' && !file_exists($filepath)){
if(isempt($filepathout)){
return returnerror('文件不存在了1');
}else{
$filepath = $filepathout;
}
}
$uptype = '|doc|docx|xls|xlsx|ppt|pptx|';
if(!contain($uptype,'|'.$frs['fileext'].'|'))return returnerror('不是文档类型无法在线编辑');
$filename = $frs['filename'];
$utes = 'edit';
if($lx==1){
$filename = '(只读)'.$filename.'';
$utes = 'yulan';
}
$arr = array();
$arr[0] = URL;
$arr[1] = $filename;
$arr[2] = $this->createtempurl($frs);
$arr[3] = $this->rock->gethttppath($filepath); //下载地址
$arr[4] = $fileid;
$arr[5] = $this->adminid;
$arr[6] = $this->token;
$arr[7] = $utes;
$arr[8] = $frs['fileext'];
$str = '';
foreach($arr as $s1)$str.=','.$s1.'';
return returnsuccess(substr($str,1));
}
/**
* 获取预览和下载地址
*/
public function fileinfoAction()
{
$fileid = (int)$this->get('id');
$type = (int)$this->get('type'); //0预览,1下载,2编辑
$ismobile = (int)$this->get('ismobile'); //是否手机端
return $this->fileinfoShow($fileid, $type, $ismobile);
}
public function fileinfoShow($fileid, $type, $ismobile)
{
$fobj = m('file');
$frs = $fobj->getone($fileid);
$this->frs = $frs;
if(!$frs)return returnerror('文件不存在了');
$filenum= $frs['filenum'];
$fileext = $frs['fileext'];
$filename = $frs['filename'];
$filepath = $frs['filepath'];
$filepathout = arrvalue($frs, 'filepathout');
$data = array();
$loadyuan = false;
$data['url'] = '';
$data['fileext']= $fileext;
//预览
if($type==0){
if(!$fobj->isview($fileext))
return returnerror('此'.$fileext.'类型文件不支持在线预览');
}
//从文件上传中心最新
if(!isempt($filenum)){
$dbs = m('admin');
$barr = c('rockfile')->getdata('upload','fileinfo', array(
'fnum' => $filenum,
'lx' => $type,
'sysuid' => $this->adminid,
'ismobile' => $ismobile,
'sysname' => $this->rock->jm->base64encode($this->adminname),
'sysface' => $this->rock->jm->base64encode($dbs->getface($dbs->getmou('face',$this->adminid))),
));
if(!$barr['success']){
return $barr;
}else{
$loadyuan = true;
$da = $barr['data'];
$data['url'] = $da['url'];
if($da['isimg'] && $type==0)$data['url'] = $da['imgurl'];
}
}
$this->loadyuan = $loadyuan;
//存自己服务器的
if(!$loadyuan){
if(substr($filepath,0,4)!='http' && isempt($filepathout) && !file_exists($filepath))return returnerror('文件不存在了1');
if(c('upfile')->isimg($fileext)){
$data['url'] = m('admin')->getface($filepath);
}
//下载
if($type==1){
$url = 'api.php?m=upload&id='.$fileid.'&a=down';
if($this->rock->web=='wxbro')$url.= '&adminid='.$this->adminid.'&token='.$this->admintoken.'';
$data['url'] = $url;
}
//编辑
if($type==2){
if(getconfig('officebj')=='1'){
$data['fileext']='rockedit';
$data['url'] = 'index.php?m=public&a=fileedit&id='.$fileid.'';
}else{
if($ismobile==1)return returnerror('移动端不支持在线编辑');
$data['fileext']='rockoffice';
$data['url'] = $this->rock->gethttppath($filepath);
}
}
}
$data['filename'] = $filename;
$url = arrvalue($data, 'url');
if($url==''){
$url = 'index.php?m=public&a=fileviewer&id='.$fileid.'';
}
//用本地插件编辑和预览
if($data['fileext']=='rockoffice'){
$utes = 'edit';
if($type==0){
$filename = '(只读)'.$filename.'';
$utes = 'yulan';
}
$arr = array();
$arr[0] = URL;
$arr[1] = $filename;
$arr[2] = $this->createtempurl($frs);
$arr[3] = $data['url']; //下载地址
$arr[4] = $fileid;
$arr[5] = $this->adminid;
$arr[6] = $this->token;
$arr[7] = $utes;
$arr[8] = $fileext;
$str = '';
foreach($arr as $s1)$str.=','.$s1.'';
$url = substr($str, 1);
}
$data['url'] = $url;
$data['type'] = $type;
$data['id'] = $fileid;
$data['isview'] = $fobj->isview($fileext); //是否可直接预览
return returnsuccess($data);
}
//生成唯一文件名键值
private function createtempurl($frs)
{
$str = ''.md5(URL).'_'.$frs['filesize'].'_'.$frs['id'].'.'.$frs['fileext'].'';
return $str;
}
/**
* app上获取下载地址
*/
public function appgetfileAction()
{
$id = (int)$this->post('id',0);
$barr = $this->fileinfoShow($id, 1, 1);
if(!$barr['success'])return $barr;
$frs = $this->frs;
$frs['filetype'] = m('file')->getmime($frs['fileext']);
$frs['downurl'] = $barr['data']['url'].'&cfrom=app';
if(!$this->loadyuan){
$frs['downurl']= '';
if(substr($frs['filepath'],0,4)=='http'){
$frs['downurl'] = $frs['filepath'];
}else{
if(!file_exists($frs['filepath']) && arrvalue($frs,'filepathout'))$frs['downurl'] = $frs['filepathout'];
}
}
return returnsuccess($frs);
}
/**
* 编辑时验证
*/
public function sendeditAction()
{
$id = (int)$this->get('id',0);
$otype = (int)$this->get('otype',0);
return c('rockedit')->sendedit($id, $this->admintoken, $otype);
}
/**
* 获取文件信息
*/
public function afileinfoAction()
{
$allfid = c('check')->onlynumber($this->get('allfid'));
$filearr= array();
if($allfid){
$fobj = m('file');
$frows = $fobj->getall('`id` in('.$allfid.')','filename,id,filesizecn,fileext,optname,thumbpath,thumbplat');
foreach($frows as $k1=>$rs1){
$rs1['thumbpath'] = $fobj->getthumbpath($rs1);
$filearr['f'.$rs1['id'].''] = $rs1;
}
}
return $filearr;
}
/**
* 获取文件(写入到内容里)
*/
public function filedaoAction()
{
$allfid = c('check')->onlynumber($this->get('fileid'));
$filearr= array();
$str = '';
if($allfid){
$fobj = m('file');
$frows = $fobj->getall('`id` in('.$allfid.')');
$urla = getconfig('outurl', URL);
foreach($frows as $k1=>$rs1){
$str.='<br>';
$url = ''.$urla.''.$rs1['filepath'].'';
if($sst = arrvalue($rs1,'filepathout'))$url = $sst;
$flx = $rs1['fileext'];
if(!contain($fobj->fileall,','.$flx.','))$flx='wz';
$str1 = '';
$imurl = ''.URL.'web/images/fileicons/'.$flx.'.gif';
$thumbpath = $fobj->getthumbpath($rs1);
if($fobj->isimg($flx) && !isempt($thumbpath))$imurl = $thumbpath;
$str.='<img src="'.$imurl.'" align="absmiddle" height=20 width=20> <a target="_blank" href="'.$url.'">'.$rs1['filename'].'</a>('.$rs1['filesizecn'].')';
}
}
return $str;
}
/**
* 获取模版文件
*/
public function getmfileAction()
{
$data = array();
$fenlei = $this->jm->base64decode($this->get('fenlei'));
$where = m('admin')->getjoinstr('a.`receid`', $this->adminid, 1);
$sql = 'select a.`name`,a.`wtype`,b.`filepath`,b.`id` from `[Q]wordxie` a left join `[Q]file` b on a.`fileid`=b.`id` where a.`fenlei`=\''.$fenlei.'\' and a.`isgk`=1 and ('.$where.')';
$rows = $this->db->getall($sql);
foreach($rows as $k=>$rs){
$data[] = array(
'value' => $rs['id'],
'name' => $rs['name'],
'subname' => $rs['wtype'],
);
}
return $data;
}
public function getmfilvAction()
{
$fileid = (int)$this->get('fileid','0');
$frs = m('file')->getone($fileid);
if(!$frs)return returnerror('不存在');
$lujing = $frs['filepathout'];
if(isempt($lujing)){
$lujing = $frs['filepath'];
if(substr($lujing,0,4)!='http' && !file_exists($lujing))return returnerror('文件不存在了');
}
$fileext = $frs['fileext'];
$fname = $this->jm->base64decode($this->get('fname'));
$fname = (isempt($fname)) ? $frs['filename'] : ''.$fname.'.'.$fileext.'';
$filepath = ''.UPDIR.'/'.date('Y-m').'/'.date('d').'_rocktpl'.rand(1000,9999).'_'.$fileid.'.'.$fileext.'';
$this->rock->createtxt($filepath, file_get_contents($lujing));
$uarr = array(
'filename' => $fname,
'fileext' => $fileext,
'filepath' => $filepath,
'filesize' => filesize($filepath),
'filesizecn' => $this->rock->formatsize(filesize($filepath)),
'optid' => $this->adminid,
'optname' => $this->adminname,
'adddt' => $this->rock->now,
'ip' => $this->rock->ip,
'web' => $this->rock->web,
);
$uarr['id'] = m('file')->insert($uarr);
return returnsuccess($uarr);
}
}

View File

@@ -0,0 +1,47 @@
<?php
class userClassAction extends apiAction
{
public function editpassAction()
{
if(getconfig('systype')=='demo')$this->showreturn('演示上不要修改');
$id = $this->adminid;
$oldpass = $this->post('passoldPost');
$pasword = $this->post('passwordPost');
$msg = '';
if($this->isempt($pasword))$msg ='新密码不能为空';
if($msg == ''){
$oldpassa = $this->db->getmou($this->T('admin'),"`pass`","`id`='$id'");
if($oldpassa != md5($oldpass))$msg ='旧密码不正确';
if($msg==''){
if($oldpassa == md5($pasword))$msg ='新旧密码不能相同';
}
}
if($msg == ''){
if(!$this->db->record($this->T('admin'), "`pass`='".md5($pasword)."',`editpass`=`editpass`+1", "`id`='$id'"))$msg = $this->db->error();
}
if($msg==''){
$this->showreturn('success');
}else{
$this->showreturn('',$msg, 201);
}
}
//修改头像
public function editfaceAction()
{
$fid = (int)$this->post('fid');
$dbs = m('admin');
$face= $dbs->changeface($this->adminid, $fid);
if($face)$face = $dbs->getface($face);
$this->showreturn($face);
}
//设置极光推送的regid
public function setjpushidAction()
{
$id = $this->get('id');
m('login')->update("`ip`='$id'", "`token`='$this->token' and `uid`='$this->adminid'");
$this->showreturn('ok');
}
}

View File

@@ -0,0 +1,88 @@
<?php
//保存打卡记录等
class weixinClassAction extends apiAction{
/**
* 获取jssdk签名
*/
public function getsignAction()
{
$num = 'weixin_corpid';
$isqywx = false;
$appId = $this->option->getval($num);
if(isempt($appId) || $this->rock->isqywx){
$isqywx = true;
$num = 'weixinqy_corpid';
}
if(isempt($this->option->getval($num))){
$arr['appId'] = '';
}else{
$url = $this->getvals('url');
if($isqywx){
$agentid = $this->rock->post('agentid', $this->getsession('wxqyagentid'));
$arr = m('weixinqy:signjssdk')->getsignsdk($url, $agentid);
}else{
$arr = m('weixin:signjssdk')->getsignsdk($url);
}
}
$this->showreturn($arr);
}
public function addlocationAction()
{
$fileid = (int)$this->post('fileid','0');
$ispz = (int)$this->post('ispz','0');
$imgpath = m('file')->getmou('filepath', $fileid);
$now = $this->rock->now;
$uid = $this->adminid;
$comid = m('admin')->getcompanyid($uid);
$type = (int)$this->post('type');
if($type==1 && $ispz==1 && isempt($imgpath))return returnerror('请先拍照才能打卡');
$arr['location_x'] = $this->post('location_x');
$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['explain'] = $this->getvals('sm');
$arr['optdt'] = $now;
$arr['uid'] = $uid;
$arr['comid'] = $comid;
$arr['imgpath'] = $imgpath;
m('location')->insert($arr);
if($type==1){
$dkdt = $now;
$ip = $this->rock->ip;
$this->db->record('[Q]kqdkjl',array(
'dkdt' => $dkdt,
'uid' => $uid,
'optdt' => $now,
'imgpath' => $imgpath,
'address' => $arr['label'],
'comid' => $comid,
'lat'=> $arr['location_x'],
'lng'=> $arr['location_y'],
'accuracy'=> $arr['precision'],
'explain'=> $arr['explain'],
'ip' => $ip,
'type' => 2
));
$dt = substr($dkdt, 0, 10);
m('kaoqin')->kqanay($uid, $dt);
}
$this->showreturn(array('now'=>$now));
}
/**
* 获取媒体文件
*/
public function getmediaAction()
{
$media_id = $this->post('media_id');
$type = $this->post('type');
$barr = m('weixinqy:media')->downmedia($media_id, $type);
if($barr['errcode']!=0)return returnerror($barr['msg']);
return returnsuccess($barr);
}
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* 【文档】应用的接口
* createname雨中磐石
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2017-08-08
*/
class worcClassAction extends apiAction
{
public function getdataAction()
{
$barr = m('word')->getdata();
$this->showreturn($barr);
}
}

View File

@@ -0,0 +1,87 @@
<?php
/**
* 【文档】应用的接口
* createname雨中磐石
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2016-08-08
*/
class wordClassAction extends apiAction
{
//获取数据
public function getdataAction()
{
$barr = m('word')->getdata();
$this->showreturn($barr);
}
//保存文件
public function savefileAction()
{
m('word')->savefile();
$frs = m('file')->getone($this->post('sid'));
$this->showreturn($frs);
}
//创建文件夹
public function createfolderAction()
{
$cqid = $this->post('cqid');
$typeid = (int)$this->post('typeid','0');
$name = $this->post('name');
$arr = m('word')->createfolder($name, $cqid, $typeid);
$this->showreturn($arr);
}
//从命名
public function renameAction()
{
$id = (int)$this->post('id');
$name = $this->getvals('name');
$type = $this->post('type');
m('word')->update("`name`='$name'", $id);
$this->showreturn('');
}
//删除
public function delfileAction()
{
$id = (int)$this->post('id');
$barr = m('word')->delword($id);
if(!$barr['success']){
$this->showreturn('',$barr['msg'],201);
}else{
$this->showreturn('');
}
}
//共享
public function shatefileAction()
{
m('word')->sharefile();
$this->showreturn('');
}
public function movegetAction()
{
return m('word')->getworcfolder();
}
public function movefileAction()
{
$barr = m('word')->movefile();
if(!$barr['success']){
$this->showreturn('',$barr['msg'],201);
}else{
$this->showreturn('');
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* 微信公众号接口
* 来源信呼开发团队www.rockoa.com
* 禁止抄袭盗版
*/
class wxgzhClassAction extends apiAction{
public function getsignAction()
{
$bo = m('wxgzh:signjssdk');
$appid = $bo->readwxset();
if(isempt($appid)){
$arr['appId'] = '';
}else{
$url = $this->getvals('url');
$arr = $bo->getsignsdk($url);
}
$this->showreturn($arr);
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* 获取验证码接口
*/
class yanzmClassAction extends apiAction
{
public function initAction()
{
$this->display= false;
}
/**
* 获取验证码的
*/
public function indexAction()
{
$mobile = $this->rock->jm->uncrypt($this->post('mobile'));
if(!c('check')->ismobile($mobile))return returnerror('手机号格式有误');
$device = $this->post('device');
if(isempt($device))return returnerror('无效访问');
return c('xinhuapi')->getvercode($mobile, $device);
}
/**
* 登录时候
*/
public function gloginAction()
{
$mobile = $this->post('mobile');
if(isempt($mobile))return returnerror('手机号不能为空');
if($this->rock->isjm($mobile))$mobile = $this->jm->uncrypt($mobile);
if(!c('check')->ismobile($mobile))return returnerror('手机号格式有误');
$device = $this->post('device');
if(isempt($device))return returnerror('无效访问');
//判断是否有注册
if(m('admin')->rows("`mobile`='$mobile' and `status`=1")==0)return returnerror('此手机号不存在/已停用');
return c('xinhuapi')->getvercode($mobile, $device);
}
}

View File

@@ -0,0 +1,25 @@
<?php
class yygongClassAction extends apiAction
{
public function saveAction()
{
$data['title'] = $this->post('title');
$data['content'] = $this->post('content');
$data['typename'] = $this->post('typename');
$data['receid'] = $this->post('receid');
$data['recename'] = $this->post('recename');
$data['url'] = $this->post('url');
$data['optdt'] = $this->now;
$data['optid'] = $this->adminid;
$data['optname'] = $this->adminname;
foreach($data as $k=>$v){
if($k=='receid')break;
if($this->isempt($v))$this->showreturn('', '['.$k.']不能为空', 201);
}
$mid = m('infor')->insert($data);
m('flow')->submit('gong', $mid, '发布');
$this->showreturn('');
}
}

View File

@@ -0,0 +1,29 @@
<?php
class yymeetClassAction extends apiAction
{
public function saveAction()
{
$data['title'] = $this->post('title');
$data['hyname'] = $this->post('hyname');
$data['startdt'] = $this->post('startdt');
$data['enddt'] = $this->post('enddt');
$data['joinid'] = $this->post('joinid');
$data['joinname'] = $this->post('joinname');
$data['explain'] = $this->post('explain');
$data['optdt'] = $this->now;
$data['optid'] = $this->adminid;
$data['optname'] = $this->adminname;
$data['status'] = 1;
$data['type'] = 0;
$data['applydt'] = $this->date;
foreach($data as $k=>$v){
if($k=='explain')break;
if($this->isempt($v))$this->showreturn('', '['.$k.']不能为空', 201);
}
$mid = m('meet')->insert($data);
m('flow')->submit('meet', $mid, '预定');
$this->showreturn('');
}
}

View File

@@ -0,0 +1,186 @@
<?php
class modeClassAction extends ActionNot
{
public function init123Action()
{
$aid = (int)$this->get('adminid');
$token = $this->get('token');
$aid = m('login')->autologin($aid, $token);
if($aid==0){
$this->mweblogin(1);
}
$this->getlogin(1);
}
public function initAction()
{
$this->mweblogin(0);
}
public function defaultAction()
{
$fn = $this->get('fn');
$title = $this->rock->jm->base64decode($this->get('title'));
if($title!='')$this->title = $title;
$path = P.'/task/mode/html/'.$fn.'.html';
if(!file_exists($path))exit('not found '.$fn.'');
$this->displayfile = $path;
}
//移动端页面详情
public function xAction()
{
$num = $this->get('modenum');
if($num=='')$num=$this->get('num');
$mid = (int)$this->get('mid');
if($num=='' || $mid==0)exit('无效请求');
$arr = m('flow')->getdatalog($num, $mid, 1);
$pagetitle = $arr['title'];
$this->title = $arr['title'];
if($pagetitle=='')$pagetitle = $arr['modename'];
$this->smartydata['arr'] = $arr;
$spagepath = P.'/flow/page/viewpage_'.$num.'_1.html';
if(!file_exists($spagepath))$spagepath = P.'/flow/page/viewpage_'.$num.'.html';
if(!file_exists($spagepath)){
$spagepath = '';
}
$this->smartydata['spagepath'] = $spagepath;
$this->smartydata['pagetitle'] = $pagetitle;
$inputjspath = P.'/flow/input/inputjs/mode_'.$num.'.js';
if(!file_exists($inputjspath)){
$inputjspath = '';
}
$this->smartydata['inputjspath'] = $inputjspath;
$this->assign('inputobj', c('input'));
$jswxsdk = '0';
if($this->rock->web=='wxbro' && !isempt($this->option->getval('weixinqy_corpid')))$jswxsdk='1';
$this->assign('jswxsdk', $jswxsdk);
}
//pc端页面详情
public function pAction()
{
$num = $this->get('modenum');
if($num=='')$num=$this->get('num');
$mid = (int)$this->get('mid');
if($num=='' || $mid==0)exit('无效请求');
$stype = $this->get('stype');
$arr = m('flow')->getdatalog($num, $mid, 0);
$pagetitle = $arr['title'];
$this->title = $arr['title'];
if($pagetitle=='')$pagetitle = $arr['modename'];
$this->smartydata['arr'] = $arr;
$spagepath = P.'/flow/page/viewpage_'.$num.'_0.html';
if(!file_exists($spagepath))$spagepath = P.'/flow/page/viewpage_'.$num.'.html';
if(!file_exists($spagepath)){
$spagepath = '';
}
$this->smartydata['spagepath'] = $spagepath;
$this->smartydata['pagetitle'] = $pagetitle;
$this->assign('stype', $stype);
if($stype=='word'){
m('file')->fileheader($arr['modename'].'.doc');
}
$this->smartydata['bordercolor'] = getconfig('bcolorxiang', '#888888');
$inputjspath = P.'/flow/input/inputjs/mode_'.$num.'.js';
if(!file_exists($inputjspath)){
$inputjspath = '';
}
$this->smartydata['inputjspath'] = $inputjspath;
$this->smartydata['xiangwidth'] = $this->option->getval('xiangwidth', 700);
$issetprint = file_exists(''.P.'/flow/page/view_'.$num.'_2.html');
if(COMPANYNUM && !$issetprint)$issetprint = file_exists(''.P.'/flow/page/view_'.$num.'_'.COMPANYNUM.'_2.html');
$this->smartydata['issetprint'] = $issetprint;
$this->assign('inputobj', c('input'));
}
//下载
public function downAction()
{
$this->display = false;
$id = (int)$this->jm->gettoken('id');
m('file')->show($id);
}
//打印的
public function tAction()
{
$num = $this->get('modenum');
if($num=='')$num=$this->get('num');
$mid = (int)$this->get('mid');
if($num=='' || $mid==0)exit('无效请求');
$stype = $this->get('stype');
$path = ''.P.'/flow/page/view_'.$num.'_2.html';
if(!file_exists($path))return '没有设置打印模版';
$arr = m('flow')->initflow($num, $mid)->getdatalog(0, 2);
$pagetitle = $arr['title'];
$this->title = $arr['title'];
if($pagetitle=='')$pagetitle = $arr['modename'];
$this->smartydata['arr'] = $arr;
$spagepath = P.'/flow/page/viewpage_'.$num.'_2.html';
if(!file_exists($spagepath))$spagepath = P.'/flow/page/viewpage_'.$num.'.html';
if(!file_exists($spagepath)){
$spagepath = '';
}
$this->smartydata['spagepath'] = $spagepath;
$this->smartydata['pagetitle'] = $pagetitle;
$this->assign('stype', $stype);
if($stype=='word'){
m('file')->fileheader($arr['modename'].'.doc');
}
$this->smartydata['xiangwidth'] = $this->option->getval('xiangwidth', 700);
}
//导出页面
public function eAction()
{
$num = $this->get('num');
$event = $this->get('event');
$stype = $this->get('stype');
$arr = m('flow')->printexecl($num, $event);
$this->title = $arr['moders']['name'];
$urlstr = '?a=e&num='.$num.'&event='.$event.'';
$this->assign('arr', $arr);
$this->assign('urlstr', $urlstr);
$this->assign('stype', $stype);
if($stype!=''){
$filename = $this->title;
header('Content-type:application/vnd.ms-excel');
header('Content-disposition:attachment;filename='.iconv("utf-8","gb2312",$filename).'.'.$stype.'');
}
}
//邮件上打开详情
public function aAction()
{
$num = $this->get('num');
$mid = $this->get('mid');
$act = 'p';
if($this->rock->ismobile())$act='x';
$url = 'task.php?a='.$act.'&num='.$num.'&mid='.$mid.'';
$this->rock->location($url);
}
}

View File

@@ -0,0 +1,658 @@
var isedit = 1,qmimgstr='',isxiang=1,alldata={},data={};
function othercheck(){}
//函数触发
function oninputblur(name,zb,obj){};
function initbody(){
js.inittabs();
$('body').click(function(){
$('.menullss').hide();
});
$('body').keydown(c.onkeydown);
$('#showmenu').click(function(){
$('.menullss').toggle();
return false;
});
$('.menullss li').click(function(){
c.mencc(this);
});
if(document.myform && form('fileid')){
if(typeof(FormData)=='function'){
f.fileobj = $.rockupload({
autoup:false,
fileview:'filedivview',
allsuccess:function(){
check(1);
}
});
}else{
$('#filedivview').parent().html('<font color="#888888">当前浏览器不支持上传</font>');
}
//初始化微信jssdk
if(js.jssdkinit){
js.jssdkinit();
js.jssdkcall=function(bo){
if(bo)c.initRecord();//可以录音
}
}
}
js.tanstyle=1;
if(document.myform && get('modelujs')){
js.importjs('webmain/flow/input/inputjs/input_two.js?'+Math.random()+'', function(){
for(var oi in inputtwo)c[oi]=inputtwo[oi];
if(typeof(initbodys)=='function')initbodys();
c.initinput();
//检查是否有编辑器
var hobj = $("span[fieldstype='htmlediter']");
if(hobj.length>0)js.importjs('mode/kindeditor/kindeditor-min.js', function(){
for(var i=0;i<hobj.length;i++)c.htmlediter($(hobj[i]).attr('fieidscheck'));
});
});
}
if(receiptrs){
var s = '<div style="position:fixed;top:40%;right:5px;padding:10px;border-radius:4px;z-index:5px;background:#555555;color:white" id="receiptrsdiv"><div>此单据需要回执确认<br>请将页面拉到最后</div><div style="margin-top:5px"><input type="button" onclick="c.receiptque()" value="回执确认" class="webbtn btn-danger"></div></div>';
$('body').append(s);
}
$('#contentshow img[onclick=""]').click(function(){c.showviews(this)});
c.addwater();
}
function showchayue(opt, st){
alert('总查阅:'+st+'次\n最后查阅'+opt+'');
}
function geturlact(act,cns){
var url=js.getajaxurl(act,'mode_'+modenum+'|input','flow',cns);
return url;
}
var f={
change:function(o1){
f.fileobj.change(o1);
}
};
//拨打电话
function callPhone(o1){
if(appobj1('callPhone',$(o1).text())){
return false;
}else{
return true;
}
}
//选择人员前处理
js.changeuser_before=function(na){
if(na=='sys_nextcoursename'){
var fw = '',o = form('sys_nextcourseid');
if(o){
var o1= o.options[o.selectedIndex];
fw = $(o1).attr('changerange');
return {'changerange':fw};
}
}
return c.changeuser_before(na);
}
//提交处理
function check(lx){
var sm = form('check_explain')?form('check_explain').value:'';
var da = {'sm':sm,'tuiid':'0','fileid':'','mid':mid,'modenum':modenum,'zt':_getaolvw('check_status'),'qmimgstr':qmimgstr};
if(form('fileid'))da.fileid=form('fileid').value;
if(form('check_tuiid'))da.tuiid=form('check_tuiid').value;
var smlx = form('check_smlx').value,wjlx=form('check_wjlx').value,cslx=0;
if(form('bzcslx'))cslx = form('bzcslx').value;
js.setmsg();
if(da.zt==''){
js.setmsg('请选择处理动作');
return;
}
if(((smlx=='0' && da.zt=='2') || (smlx=='1')) && isempt(da.sm)){
js.setmsg('此动作必须填写说明');
return;
}
if($('#filedivview').html()=='' && ((wjlx=='1') || (wjlx=='2' && da.zt=='1') )){
js.setmsg('此动作必须选择上传相关文件');
return;
}
var isqm = form('isqianming').value;
var qbp = true;
if(form('zhuanbanname')){
da.zyname = form('zhuanbanname').value;
da.zynameid = form('zhuanbannameid').value;
}
if(form('bzchaosongname')){
da.csname = form('bzchaosongname').value;
da.csnameid = form('bzchaosongnameid').value;
}
if(cslx==2 && da.zt=='1' && !da.csnameid){
js.setmsg('此动作必须选择抄送');return;
}
//手写签名判断
if(isqm=='1' && qmimgstr=='')qbp=false;
if(isqm=='2' && da.zt=='1' && qmimgstr=='')qbp=false;
if(isqm=='3' && da.zt=='2' && qmimgstr=='')qbp=false;
if(!qbp && !da.zynameid){js.setmsg('此动作必须手写签名');return;}
if(form('nextnameid') && da.zt=='1' && !da.zynameid){
da.nextname = form('nextname').value;
da.nextnameid = form('nextnameid').value;
if(da.nextnameid==''){
js.setmsg('请选择下一步处理人');return;
}
}
//自由流程处理的
if(da.zt=='1' && form('sys_nextcourseid') && !da.zynameid){
da.sys_nextcourseid = form('sys_nextcourseid').value;
da.sys_nextcoursename = form('sys_nextcoursename').value;
da.sys_nextcoursenameid = form('sys_nextcoursenameid').value;
if(da.sys_nextcourseid==''){
js.setmsg('请选择下步处理步骤');
return;
}
if(da.sys_nextcourseid>0 && da.sys_nextcoursenameid=='' && c.changenextbool){
js.setmsg('请选择下步处理人');
return;
}
}
//加签
if(da.zt=='25' || da.zt=='26'){
if(!form('sys_yushenname')){
js.setmsg('无效使用加签');
return;
}
da.sys_yushenname = form('sys_yushenname').value;
da.sys_yushennameid = form('sys_yushenname_id').value;
da.sys_yushennamezt = form('sys_yushennamezt').value;
if(da.sys_yushennameid==''){
js.setmsg('请选择加签处理人');
return;
}
}
if(!da.zynameid && da.zt!='2' && da.zt!='25' && da.zt!='26'){
var fobj=$('span[fieidscheck]'),i,fid,flx,fiad,val,isbt;
var subdat = js.getformdata();
for(i=0;i<fobj.length;i++){
fiad = $(fobj[i]);
fid = fiad.attr('fieidscheck');
isbt = fiad.attr('isbt');
val = subdat[fid];
if(c.editorobj[fid])val=c.editorobj[fid].html();
da['cfields_'+fid]=val;
if(val=='' && isbt=='1'){js.setmsg(''+fiad.text()+'不能为空');return;}
}
}
var ostr=othercheck(da);
if(typeof(ostr)=='string'&&ostr!=''){js.setmsg(ostr);return;}
if(typeof(ostr)=='object')for(var csa in ostr)da[csa]=ostr[csa];
js.setmsg('处理中...');
var o1 = get('check_btn');
o1.disabled = true;
if(lx==0 && f.fileobj && f.fileobj.start()){
return js.setmsg('上传相关文件中...');//有上传相关文件
}
var url = c.gurl('check');
js.ajax(url,da,function(a){
if(a.success){
js.setmsg(a.data,'green');
if(da.zt=='26'){
js.alert('后加签成功,请继续审批','', function(){
js.reload();
});
}else{
c.callback(a.data);
if(get('autocheckbox'))if(get('autocheckbox').checked)c.close();
}
}else{
js.setmsg(a.msg);
o1.disabled = false;
}
},'post,json',function(estr){
js.setmsg('处理失败:'+estr+'');o1.disabled = false;
});
}
function _getaolvw(na){
var v = '',i,o=$("input[name='"+na+"']");
for(i=0;i<o.length;i++)if(o[i].checked)v=o[i].value;
return v;
}
/**
* nae记录名称
* zt状态名称
* ztid 状态id
* ztcol 状态颜色
* ocan 其他参数
* las 说明字段Id默认other_explain
*/
function _submitother(nae,zt,ztid,ztcol,ocan,las){
if(!las)las='other_explain';
if(!nae||!get(las)){js.setmsg('sorry;不允许操作','','msgview_spage');return;}
var sm=$('#'+las+'').val();
if(!ztcol)ztcol='';
if(!zt)zt='';if(!ocan)ocan={};
if(!ztid){js.setmsg('没有选择状态','','msgview_spage');return;}
if(!sm){js.setmsg('没有输入备注/说明','','msgview_spage');return;}
var da = js.apply({'name':nae,'mid':mid,'modenum':modenum,'ztcolor':ztcol,'zt':zt,'ztid':ztid,'sm':sm},ocan);
js.setmsg('处理中...','','msgview_spage');
js.ajax(c.gurl('addlog'),da,function(s){
js.setmsg('处理成功','green', 'msgview_spage');
$('#spage_btn').hide();
},'post',function(s){
js.setmsg(s,'','msgview_spage');
});
return false;
}
var c={
callback:function(cs,cbo){
var nowli= js.getoption('nowListener');
if(nowli)js.sendevent('reload',nowli);
if(ismobile==1 && js.msgok)js.msgok(cs, function(){js.back()},1);
var calb = js.request('callback');
if(!calb)return;
try{parent[calb](cs);}catch(e){}
try{opener[calb](cs);}catch(e){}
try{parent.js.tanclose('openinput');}catch(e){}
if(cbo)this.close();
},
changeuser_before:function(){},
gurl:function(a){
var url=js.getajaxurl(a,'flowopt','flow');
return url;
},
editorobj:{},
showtx:function(msg){
js.setmsg(msg);
if(ismobile==1)js.msg('msg', msg);
},
close:function(){
var ofrom = js.request('ofrom');
if(ofrom=='deskclient'){
js.cliendsend('closenowtabs');
}else{
window.close();
try{parent.js.tanclose('winiframe');}catch(e){}
}
},
other:function(nae,las){
_submitother(nae,'','1','',las);
},
others:function(nae,zt,ztid,ztcol,ocan,las){
_submitother(nae,zt,ztid,ztcol,ocan,las);
},
mencc:function(o1){
var lx=$(o1).attr('lx');
if(lx=='2')c.delss();
if(lx=='3')c.close();
if(lx=='4')location.reload();
if(lx=='0')c.clickprint(false);
if(lx=='6')c.clickprint(true);
if(lx=='5')c.daochuword();
if(lx=='7')c.savetoimg();
if(lx=='10')c.savetopdf();
if(lx=='8')js.location('?a=t&num='+modenum+'&mid='+mid+'');
if(lx=='9')js.location('?a=p&num='+modenum+'&mid='+mid+'');
if(lx=='1'){
var url='index.php?a=lu&m=input&d=flow&num='+modenum+'&mid='+mid+'';
js.location(url);
}
},
clickprint:function(bo){
c.hideoth();
if(bo){
$('#recordss').remove();
$('#checktablediv').remove();
$('#recordsss').remove();
}
window.print();
},
savetoimg:function(){
this.hideoth();
js.loading();
js.importjs('js/html2canvas.js', function(){
html2canvas($('#maindiv'),{
onrendered: function(canvas){
var imgbase64 = canvas.toDataURL().split(',')[1];
c.showviews({src:canvas.toDataURL()});
js.unloading();
}
});
});
},
savetopdf:function(){
this.hideoth();
js.loading();
js.importjs('js/html2canvas.js', function(){
html2canvas($('#maindiv'),{
onrendered: function(canvas){
var imgbase64 = canvas.toDataURL().split(',')[1];
js.ajax(c.gurl('savetopdf'),{imgbase64:imgbase64},function(ret){
js.unloading();
if(!ret.success){
js.msgerror(ret.msg);
}else{
js.msgok('导出成功');
}
},'post,json');
}
});
});
},
daochuword:function(){
var url='task.php?a='+js.request('a')+'&num='+modenum+'&mid='+mid+'&stype=word';
js.location(url);
},
hideoth:function(){
$('.menulls').hide();
$('.menullss').hide();
$('#pinglunview').hide();
$('a[temp]').remove();
},
delss:function(){
js.confirm('删除将不能恢复,确定要<font color=red>删除</font>吗?',function(lx){
if(lx=='yes')c.delsss();
});
},
delsss:function(){
var da = {'mid':mid,'modenum':modenum,'sm':''};
js.ajax(c.gurl('delflow'),da,function(a){
js.msg('success','单据已删除,3秒后自动关闭页面,<a href="javascript:;" onclick="c.close()">[关闭]</a>');
c.callback();
setTimeout('c.close()',3000);
},'post');
},
onkeydown:function(e){
var code = e.keyCode;
if(code==27){
c.close();
return false;
}
if(e.altKey){
if(code == 67){
c.close();
return false;
}
}
},
changeshow:function(lx){
$('#showrecord'+lx+'').toggle();
},
loacdis:false,
showviews:function(o1){
this.loadicons();
$.imgview({'url':o1.src,'ismobile':ismobile==1});
},
loadicons:function(){
if(!this.loacdis){
$('body').append('<link rel="stylesheet" type="text/css" href="web/res/fontawesome/css/font-awesome.min.css">');
this.loacdis= true;
}
},
showfilestr:function(d){
var flx = js.filelxext(d.fileext);
var s = '<img src="web/images/fileicons/'+flx+'.gif" align="absmiddle" height=16 width=16> <a href="javascript:;" onclick="js.downshow('+d.id+')">'+d.filename+'</a> ('+d.filesizecn+')';
return s;
},
//撤回操作
chehui:function(){
js.prompt('确定撤回吗?','要撤回上一步处理结果说明(选填)',function(jg,txt){
if(jg=='yes')c.chehuito(txt);
});
},
chehuito:function(sm){
js.msg('wait','撤回中...');
js.ajax(c.gurl('chehui'),{'mid':mid,'modenum':modenum,'sm':sm},function(a){
if(a.success){
js.msg('success', '撤回成功');
location.reload();
}else{
js.msg('msg', a.msg);
}
},'post,json',function(s){
js.msg('msg','操作失败');
});
},
//预览文件
downshow:function(id, ext,pts, fnun){
this.loadicons();
if(!isempt(fnun)){
js.fileopt(id,0);
}else{
js.yulanfile(id, ext,pts,'','','xq');
}
return false;
},
changecheck_status:function(o1){
var zt = _getaolvw('check_status');
if(zt=='2'){
$('#tuihuidiv').show();
}else{
$('#tuihuidiv').hide();
}
if(zt=='1'){
$('#zhuangdiv').show();
$('#nextxuandiv').show();
if(get('sys_nextcoursediv0')){
$('#sys_nextcoursediv0').show();
}
}else{
$('#zhuangdiv').hide();
$('#nextxuandiv').hide();
if(get('sys_nextcoursediv0')){
form('sys_nextcourseid').value='';
js.changeclear('changesys_nextcoursename');
$('#sys_nextcoursediv0').hide();
$('#sys_nextcoursediv1').hide();
}
}
if(zt=='25' || zt=='26'){
$('#sys_yushennamediv').show();
$('#sys_yushennamediv1').show();
}else{
$('#sys_yushennamediv').hide();
$('#sys_yushennamediv1').hide();
}
},
changenextbool:true,
changenextcourse:function(o,lx){
var o1= o.options[o.selectedIndex];
var clx = $(o1).attr('checktype');
this.changenextbool=true;
js.changeclear('changesys_nextcoursename');
if(o.value>0){
if(lx==3 || (lx==4 && clx=='change')){
$('#sys_nextcoursediv1').show();
}else{
$('#sys_nextcoursediv1').hide();
this.changenextbool=false;
}
}else{
$('#sys_nextcoursediv1').hide();
}
},
//手写签名
qianming:function(o1){
this.qianmingbo=false;
js.tanbody('qianming','请在空白区域写上你的姓名',300,200,{
html:'<div data-width="280" data-height="120" data-border="1px dashed #cccccc" data-line-color="#000000" data-auto-fit="true" id="qianmingdiv" style="margin:10px;height:120px;cursor:default"></div>',
btn:[{text:'确定签名'},{text:'重写'}]
});
$('#qianmingdiv').jqSignature().on('jq.signature.changed', function() {
c.qianmingbo=true;
});
if(ismobile==1)get('qianmingdiv').addEventListener('touchmove',function(e){
e.preventDefault();
},false);
$('#qianming_btn0').click(function(){
c.qianmingok();
});
$('#qianming_btn1').click(function(){
$('#imgqianming').remove();
$('#qianmingdiv').jqSignature('clearCanvas');
c.qianmingbo = false;
qmimgstr = '';
});
},
qianmingok:function(){
if(!this.qianmingbo)return;
$('#imgqianming').remove();
var dataUrl = $('#qianmingdiv').jqSignature('getDataURL');
var s = '<br><img id="imgqianming" src="'+dataUrl+'" height="90">';
qmimgstr = dataUrl;
$('#qianmingshow').append(s);
js.tanclose('qianming');
},
qianyin:function(){
js.msg('wait','引入中...');
js.ajax(c.gurl('qianyin'),{},function(a){
if(a.success){
js.msg('success', '引入成功');
$('#imgqianming').remove();
var dataUrl = a.data;
var s = '<br><img id="imgqianming" src="'+dataUrl+'" height="90">';
qmimgstr = dataUrl;
$('#qianmingshow').append(s);
}else{
js.msg('msg', a.msg);
}
},'get,json',function(s){
js.msg('msg','操作失败');
});
},
optmenu:function(o1){
var o = $(o1);
var issm = o.attr('issm'),optmenuid = o.attr('optmenuid');
var smts = (issm=='1') ? '(必填)' : '(选填)';
var d = {'modenum':modenum,'mid':mid,'name':o1.value,'issm':issm,'optmenuid':optmenuid};
js.prompt(d.name,'请输入['+d.name+']说明'+smts+'',function(jg,text){
if(jg=='yes'){
if(!text && d.issm==1){
js.msg('msg','没有输入['+d.name+']说明');
return true;
}else{
o1.disabled=true;
o1.style.background='#888888';
c.optmenusubmit(d, text);
}
}
});
},
optmenusubmit:function(d,sm){
d.sm = sm;
js.msg('wait','处理中...');
js.ajax(js.getajaxurl('yyoptmenu','flowopt','flow'),d,function(ret){
if(ret.code==200){
js.msg('success','处理成功');
}else{
js.msg('msg',ret.msg);
}
},'post,json');
},
inputblur:function(o1,zb){
var nae = o1.name;
oninputblur(nae,zb,o1);
},
getselobj:function(fv){
var o = form(fv);
if(!o)return;
var o1= o.options[o.selectedIndex];
return o1;
},
getseltext:function(fv){
var o1 = this.getselobj(fv);
if(!o1)return '';
return o1.text;
},
getselattr:function(fv,art){
var o1 = this.getselobj(fv);
if(!o1)return '';
return $(o1).attr(art);
},
//评论
pinglun:function(o1){
js.setmsg('','','pinglun_spage');
var sm = get('pinglun_explain').value;
if(!sm){js.setmsg('请输入评论内容','','pinglun_spage');return;}
js.setmsg('提交中...','','pinglun_spage');
js.ajax(c.gurl('pinglun'),{'sm':sm,'name':'评论','mid':mid,'modenum':modenum},function(s){
var msg = '提交评论成功';
js.setmsg(msg,'green','pinglun_spage');
js.msgok(msg);
get('pinglun_explain').disabled=true;
$(o1).remove();
},'post',function(s){
js.setmsg(s,'','pinglun_spage');
});
return false;
},
//回执确认
receiptque:function(){
$('#receiptrsdiv').remove();
js.prompt('回执确认','确认说明(选填)', function(jg,txt){
if(jg=='yes'){
c.receiptqueok(txt);
}
});
},
receiptqueok:function(sm){
js.msg('wait','回执确认确认提交中...');
var da = {'mid':mid,'modenum':modenum,'sm':sm,'receiptid':receiptrs.id};
js.ajax(c.gurl('receiptcheck'),da,function(a){
js.msg('success','回执确认提交成功');
},'post');
},
initRecord:function(){
$('#filedivviewfile').prepend('<input onclick="js.wxRecord.startLuyin(this)" type="button" class="webbtn" style="padding:5px 8px;border-radius:5px" value="录音">&nbsp;');
js.wxRecord.success=function(ret){
f.fileobj.fileallarr.push(ret);
var str='<div style="padding:3px;font-size:14px;border-bottom:1px #dddddd solid">录音:'+ret.filename+'('+ret.filesizecn+')</div>';
$('#filedivview').append(str);
}
},
showeditcont:function(optdt,uid){
js.tanbody('editcont','修改记录',(ismobile==1) ? winWb()-10 : 600,300, {
html:'<div style="height:300px;overflow:auto"><div id="editcontview" class="wrap" style="padding:5px">'+js.getmsg('加载中...')+'</div></div>'
});
js.ajax(c.gurl('editcont'),{optdt:optdt,uid:uid,mid:mid,modenum:modenum},function(ret){
$('#editcontview').html(ret);
},'get');
},
addwater:function(){
if(typeof(watertype)!='string' || watertype!='1')return;
var dizs = 'api.php?m=file&a=shuiyin';
if(get('maindiv')){
get('maindiv').style.background='url('+dizs+') white';
}else{
get('contentshow').style.background='url('+dizs+') white';
}
},
//审核表单中可重写的方法录入js写用到
onselectdata:{},
onselectdataall:function(){},
changeuser_before:function(){},
onselectdatabefore:function(){},
htmlediteritems:function(){},
uploadback:function(){},
uploadfileibefore:function(){},
onselectmap:function(){}
};

View File

@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
<title><?=$da['title']?></title>
<style>
a{TEXT-DECORATION:none;}
a:hover{TEXT-DECORATION:underline;}
body{font-size:14px;padding:0px;margin:0px}
.table td{border:1pt #000000 solid;text-align:center;padding:5px;font-size:12px}
.table tr:nth-child(even){background-color: #f5f5f5;}
.table tr:hover{background-color: #D5EDE8;}
.menulls{position:absolute;left:1px;top:10px}
.a{background-color:#888888;font-size:12px;color:#ffffff;padding:5px;margin-left:5px}
</style>
</head>
<body style="padding:5px 10px;">
<?php if($stype==''){?>
<div class="menulls" id="show">
<a href="javascript:;" onclick="wb('xls')" class="a" >另存Excel</a>
<a href="javascript:;" onclick="wb('doc')" class="a" >另存Word</a>
<a href="javascript:;" onclick="wb('print')" class="a" >打印...</a>
</div>
<script>
function wb(lx){
if(lx=='xls'||lx=='doc'){
var url = '<?=$urlstr?>&stype='+lx+'';
location.href=url;
return;
}
document.getElementById('show').style.display='none';
window.print();
}
</script>
<?php }?>
<table class="table" width="100%" border="0" style="border-collapse:collapse;" width="100%" cellspacing="0" cellpadding="0">
<tr style="background:none"><td colspan="<?=$arr['cell']?>" style="font-size:18px;padding:10px;border:none"><b><?=$da['title']?></b></td></tr>
<tr>
<td width="30">序号</td>
<?php
foreach($arr['fields'] as $k=>$v){
echo '<td>'.$v.'</td>';
}
$cell= $arr['cell'];
$bel = (int)ceil($cell*0.5)-1;
?>
</tr>
<?php
foreach($arr['rows'] as $k=>$rs){
$s = '<tr>';
$s.='<td>'.($k+1).'</td>';
foreach($arr['fields'] as $k1=>$v1){
$sty= '';
if($k1=='explain'||$k1=='content')$sty=' style="text-align:left"';
if(isset($rs[''.$k1.'_style']))$sty=' style="'.$rs[''.$k1.'_style'].'"';
$s.='<td'.$sty.'>';
$val = '';
if(isset($rs[$k1]))$val = $rs[$k1];
if($k1=='explain')$val = str_replace("\n",'<br>', $val);
$s.=''.$val.'';
$s.='</td>';
}
$s.='</tr>';
echo $s;
}
?>
<tr style="background:none">
<td style="border:0px;text-align:left;padding-left:0px" colspan="<?=$bel?>">共记录<?=$arr['count']?></td>
<td style="border:0px;text-align:right;padding-right:0px" colspan="<?=($cell-$bel)?>">操作人:<?=$da['adminname']?>,时间:<?=date('Y年m月d日 H:i:s')?></td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,434 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
<title><?=$da['pagetitle']?></title>
<link rel="shortcut icon" href="favicon.ico" />
<?php
$maincolor = getconfig('apptheme','#1389D3');
if($stype==''){
$jqurl = 'js/jquery.js';
if(arrvalue($da['arr']['flowinfor'],'ischeck')==1)$jqurl='web/res/js/jquery.1.9.1.min.js';
?>
<link rel="stylesheet" type="text/css" href="<?=$da['p']?>/css/css.css">
<script type="text/javascript" src="<?=$jqurl?>"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/base64-min.js"></script>
<script type="text/javascript" src="<?=$da['p']?>/task/mode/modeview.js?<?=$da['logintime']?>"></script>
<script type="text/javascript" src="web/res/js/jquery-imgview.js"></script>
<script type="text/javascript" src="mode/plugin/jquery-rockmodels.js"></script>
<script>
var mid = '<?=$da['arr']['mid']?>',adminname='<?=$da['adminname']?>',modenum='<?=$da['arr']['modenum']?>',ismobile=0,receiptrs=<?=json_encode($da['arr']['receiptrs'])?>,isinput=0,maincolor='<?=$maincolor?>',watertype='<?=getconfig('watertype')?>';
</script>
<?php
}
$cheikbo = false;
?>
<style>
<?php
$maincolora= c('image')->colorTorgb($maincolor);
$maincolors= ''.$maincolora[0].','.$maincolora[1].','.$maincolora[2].'';
echo 'body{--main-color:'.$maincolor.'}';
//$da['bordercolor'] = 'rgba('.$maincolors.',0.2)';
?>
.stitle{padding:5px;border-bottom:1px #cccccc solid;font-size:14px;}
.ydullist{display:inline-block;width:100%;}
.ydullist li{float:left;width:10%;text-align:center;padding:5px 0px;font-size:12px;display:block;line-height:25px;padding-top:10px}
.ydullist li:active{ background-color:#eeeeee}
.ydullist li img,.faces{height:30px;width:30px;border-radius:15px}
.ydullist li span{font-size:12px;color:#888888;}
.faces{margin-right:10px}
.ptitle{text-align:center;font-size:20px;padding-top:15px;padding-bottom:10px;width:450px}
.tabled2 td{padding:5px;border:1px #e5e5e5 solid;text-align:center}
td.tdys1{border:1px #e5e5e5 solid;text-align:center;padding:0px 5px}
.createtable{width:90%}
.menulls{position:absolute;left:1px;top:10px}
.menullss{position:absolute;left:1px;top:32px; background-color:white; border:1px #cccccc solid;border-bottom:0px;display:none}
.menullss ul{list-style-type:none}
.menullss li{padding:5px 10px;border-bottom:1px #dddddd solid;cursor:pointer}
.menullss li:hover{ background-color:#f1f1f1}
.pcont{line-height:27px;}
.pcont p{text-indent:2em;margin:10px 0px}
li p{text-indent:0em !important;}
.pcont a{color:blue}
.status{position: absolute;right:20px;top:10px;display:}
.ke-zeroborder{border-spacing: 0;border-collapse: collapse;}
.ys0{border:1px <?=$da['bordercolor']?> solid}
.ys1{padding:5px 5px; border:1px <?=$da['bordercolor']?> solid;color:#555555;}
.ys2{padding:5px 5px; border:1px <?=$da['bordercolor']?> solid;}
.datesss{background:url(mode/icons/date.png) no-repeat right;cursor:pointer;width:50%}
.inputs{width:95%}
.statustext{position: absolute;right:40px;top:10px;width:80px;height:80px;overflow:hidden; border:3px red solid;border-radius:50%;font-size:20px;text-align:center;line-height:80px;color:red;transform:rotate(-45deg);-o-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);filter:progid:DXImagetransform.Microsoft.Matrix(M11=0.707,M12=-0.707,M21=0.707,M22=0.707,SizingMethod='auto expand');}
.tableblack .ys0,.tableblack .ys1,.tableblack .ys2{border:1px #000000 solid;color:#000000;}
.btn-danger{background-color:#d9534f;}
.printtable td,.printborder{border:1px #000000 solid}
.printtable td{padding:0px 3px}
.notitle{display:none}
#contentshow img{max-width:100%}
<?php
if($stype!=''){
?>
*{font-size:14px}
.tabled2 td{border-color:#000000}
<?php }?>
</style>
</head>
<body style="background:white">
<div align="center">
<div style="width:<?=$da['xiangwidth']?>px;position:relative;background:white" id="maindiv" align="left">
<?php if($stype==''){?>
<div class="menulls"><input id="showmenu" style="background-color:#888888;font-size:12px;border-radius:5px" class="webbtn" value="操作V" type="button"></div>
<div class="menullss"><ul><li lx="0">打印全部...</li><li lx="6">只打印内容...</li>
<?php
if($da['issetprint'])echo '<li lx="8">根据模版打印</li>';
echo '<li lx="5">另存为word...</li>';
if(file_exists('js/html2canvas.js')){
echo '<li lx="7">另存为图片...</li>';
//echo '<li lx="10">另存为PDF...</li>';
}
if($da['arr']['isedit']==1)echo '<li lx="1">编辑</li>';
if($da['arr']['isdel']==1)echo '<li lx="2">删除...</li>';
?>
<li lx="3">关闭</li>
<li lx="4">刷新</li>
</ul>
</div>
<?php }?>
<?php
//显示状态
if($da['arr']['isflow']>0 && $stype==''){
echo '<div class="statustext" onclick="$(this).remove()" style="color:'.$da['arr']['statuscolor'].';border-color:'.$da['arr']['statuscolor'].'">'.$da['arr']['statustext'].'</div>';
}
$contview = $da['arr']['contview'];
if(!isempt($da['title']) && !isset($da['arr']['notitle']) && !contain($contview, 'notitle')){
echo '<div align="center"><div class="ptitle">'.$da['title'].'</div></div>';
}
?>
<div class="padding10 pcont" align="left" id="contentshow">
<?php
if($stype!='')$contview=str_replace('cccccc','000000', $contview);
echo $contview;
?>
</div>
<?php
if($da['arr']['optmenu']){
$opsts = '<div class="padding10" align="center">';
foreach($da['arr']['optmenu'] as $pt1=>$ptrs){
if($pt1>0)$opsts.='&nbsp;&nbsp;';
$opsts.='<input onclick="c.optmenu(this)" class="webbtn radius5" optmenuid="'.$ptrs['optmenuid'].'" issm="'.$ptrs['issm'].'" style="background:'.$ptrs['color'].'" value="'.$ptrs['name'].'" type="button">';
}
$opsts.= '</div>';
echo $opsts;
}
?>
<div class="padding10">
<?php
//显示其他页面
if($da['spagepath']!='' && $stype==''){
include_once($da['spagepath']);
}
//是否开评论了
if($da['arr']['isplview']=='1' && $stype==''){
?>
<div align="center" id="pinglunview" style="padding-top:5px">
<table border="0" width="80%" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><div align="right" style="padding-right:10px"><font color=red>*</font> 评论</div></td>
<td ><div align="left"><textarea class="inputs" id="pinglun_explain" style="width:95%;height:60px;border-radius:5px" placeholder="请输入评论内容"></textarea></div></td>
</tr>
<tr>
<td ></td>
<td>
<div style="padding:20px 0px">
<a class="webbtn" style="border-radius:5px" onclick="c.pinglun(this)" href="javascript:;">提交评论</a>
&nbsp;<span id="pinglun_spage"></span>
</div>
</td>
</tr>
</table>
</div>
<?php
}
$logarr = $da['arr']['logarr'];
if($logarr && $da['arr']['isgbjl']==0){
?>
<div id="recordss">
<div class="stitle zhu" onclick="c.changeshow(0)" style="cursor:pointer">处理记录(<?=count($logarr)?>)
<?php if($stype==''){?>
<img align="absmiddle" height="16" width="16" src="images/xiangyou1.png"> <a temp="clo" href="javascript:;" onclick="$('#recordss').remove();">×</a>
<?php }?>
</div>
<div id="showrecord0" style="display:none">
<table border="0" class="tabled2" style="border-collapse:collapse;" width="100%" cellspacing="0" cellpadding="0">
<tr bgcolor="#E1F4F0">
<td>序号</td>
<td>动作</td>
<td>处理人</td>
<td>状态</td>
<td>说明</td>
<td>时间</td>
</tr>
<?php
foreach($logarr as $k=>$rs){
?>
<tr >
<td><?=$k+1?></td>
<td><?=$rs['actname']?></td>
<td><?=$rs['name']?></td>
<td style="color:<?=$rs['color']?>"><?=$rs['statusname']?></td>
<td><div align="left"><?=$rs['explain']?></div></td>
<td><?=$rs['optdt']?></td>
</tr>
<?php }?>
</table>
</div>
<div class="blank10"></div>
</div>
<?php }
if($da['arr']['isflow']>0 && $stype==''){
$flowinfor = $da['arr']['flowinfor'];
?>
<div id="checktablediv">
<div align="center" style="padding-bottom:5px"><b>审核处理</b> <a temp="clo" href="javascript:;" onclick="$('#checktablediv').remove();">×</a></div>
<div align="center">
<form name="myform" autocomplete="off">
<table border="0" width="90%" class="tabled1" style="border-collapse:collapse;" cellspacing="0" cellpadding="0">
<tr height="40" bgcolor="#E1F4F0">
<td width="130" class="tdys1"><div align="right" style="color:#555555">状态</div></td>
<td class="tdys1"><div align="left"><?=$flowinfor['nstatustext']?></div></td>
</tr>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">处理流程</div></td>
<td class="tdys1"><div align="left" style="padding:5px 0px"><?=$flowinfor['flowcoursestr']?></div></td>
</tr>
<?php
//判断是否可撤回
if($da['arr']['ischehui']>0){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">撤回</div></td>
<td class="tdys1"><div align="left"><input class="webbtn" onclick="c.chehui(this)" value="撤回上步我的处理" type="button"></div></td>
</tr>
<?php
}
//判断是否可审核
if($flowinfor['ischeck']==1){
$cheikbo = true;
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">当前处理</div></td>
<td class="tdys1"><div align="left"><?=$flowinfor['nowcourse']['name']?>(<?=$flowinfor['nowcourse']['nowcheckname']?>)</div></td>
</tr>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555"><font color=red>*</font>处理动作</div></td>
<td class="tdys1"><div align="left">
<?php
$s = '';
$tuiname = '';
foreach($flowinfor['courseact'] as $k=>$act){
if($k>0 && $act[0])$s.='<label><input name="check_status" onclick="c.changecheck_status(this)" type="radio" value="'.$k.'">'.$act[0].'</label> &nbsp; ';
if($k==2)$tuiname = $act[0];
}
echo $s;
?>
</div></td>
</tr>
<?php
?>
<?php
//是否可抄送
if($flowinfor['ischao']==1 || $flowinfor['ischao']==2){
?>
<tr>
<td class="tdys1"><div align="right" style="color:#555555">抄送</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<input name="bzcslx" type="hidden" value="<?=$flowinfor['ischao']?>">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择了抄送对应人" class="inputs" style="width:98%" id="bzchaosongname" readonly type="text" name="bzchaosongname"><input name="bzchaosongnameid" id="bzchaosongname_id" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('bzchaosongname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('bzchaosongname','changeusercheck','',{changerange:'<?=$flowinfor['ischaofwid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php
}
?>
<input type="hidden" id="isqianming" value="<?=$flowinfor['nowcourse']['isqm']?>">
<?php
//需要签名才显示
if((int)$flowinfor['nowcourse']['isqm']>0){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">手写签名</div></td>
<td class="tdys1"><div id="qianmingshow" style="padding:5px 0px" align="left"><input type="button" onclick="c.qianming(this)" style="padding:2px" value="写签名">&nbsp;&nbsp;<input type="button" onclick="c.qianyin(this)" style="padding:2px" value="引用签名"></div></td>
</tr>
<?php
}
//不通过退回是
if($tuiname != '' && $da['arr']['isflow']!=3){
?>
<tr style="display:none" id="tuihuidiv">
<td class="tdys1"><div align="right" style="color:#555555"><font color=red>*</font><?=$tuiname?>退回</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<select class="inputs" name="check_tuiid" style="width:200px"><option value="0">退回到提交人</option>
<?php
if($flowinfor['tuicourse']){
$tstr = '<optgroup label="退回到步骤">';
foreach($flowinfor['tuicourse'] as $k=>$trs){
$tstr.='<option value="'.$trs['id'].'">'.$trs['name'].'('.$trs['checkname'].')</option>';
}
$tstr.='</optgroup>';
echo $tstr;
}
?>
</select>
</div></td>
</tr>
<?php
}
foreach($flowinfor['checkfields'] as $chef=>$chefv){
if($chefv['showinpus']==1){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555"><?php if($chefv['isbt']=='1')echo '<font color=red>*</font>';?><span isbt="<?=$chefv['isbt']?>" fieidscheck="<?=$chef?>" fieldstype="<?=$chefv['fieldstype']?>"><?=$chefv['name']?></span></div></td>
<td class="tdys1"><div align="left"><?=$chefv['inputstr']?></div></td>
</tr>
<?php
}else if($chefv['showinpus']==2){
echo '<tr style="display:none"><td><span isbt="'.$chefv['isbt'].'" fieidscheck="'.$chef.'">'.$chefv['name'].'</span></td><td>'.$chefv['inputstr'].'</td></tr>';
}}
//是否可转办显示
if($flowinfor['iszhuanban']>0){
?>
<tr style="display:none" id="zhuangdiv">
<td class="tdys1"><div align="right" style="color:#555555">转给</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择了就会转办给对应人" class="inputs" style="width:98%" id="zhuanbanname" readonly type="text" name="zhuanbanname"><input name="zhuanbannameid" id="zhuanbanname_id" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('zhuanbanname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('zhuanbanname','changeuser<?=$flowinfor['zbrangelx']?>','',{changerange:'<?=$flowinfor['zbrangeid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php
}
if($flowinfor['ischange']==1){
?>
<tr style="display:none" id="nextxuandiv">
<td class="tdys1"><div align="right" style="color:#555555"><font color=red>*</font>下一步处理人</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择下一步[<?=$flowinfor['nextcourse']['name']?>]处理人" class="inputs" style="width:98%" id="nextname" readonly type="text" value="<?=$flowinfor['nextcourse']['checkname']?>" name="nextname"><input name="nextnameid" id="nextname_id" value="<?=$flowinfor['nextcourse']['checkid']?>" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('nextname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('nextname','changeusercheck','选择下一步处理人',{changerange:'<?=$flowinfor['nextcourse']['checktypeid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php }
$smlx = (int)$flowinfor['nowcourse']['smlx'];
$wjlx = (int)$flowinfor['nowcourse']['wjlx'];
echo '<tr style="display:none"><td><input name="check_smlx" value="'.$smlx.'"><input name="check_wjlx" value="'.$wjlx.'"></td></tr>';
if($smlx!=3){
?>
<tr>
<td class="tdys1"><div align="right" style="color:#555555"><?php if($smlx==1)echo '<font color=red>*</font>';?>说明</div></td>
<td class="tdys1" style="padding:5px"><div align="left"><textarea class="textarea" name="check_explain" style="width:95%;height:60px"></textarea></div></td>
</tr>
<?php
}
if($wjlx!=3){
?>
<tr>
<td class="tdys1" nowrap><div align="right" style="color:#555555"><?php if($wjlx==1)echo '<font color=red>*</font>';?>相关文件</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<input name="fileid" type="hidden">
<div id="filedivview" style="height:60px;overflow:auto;width:96%" class="inputs"></div>
<div><input style="width:150px" onchange="f.change(this)" type="file"></div>
</div></td>
</tr>
<?php
}
?>
<tr>
<td class="tdys1">&nbsp;</td>
<td class="tdys1" style="padding:5px"><div align="left"><input class="webbtn" onclick="check(0)" id="check_btn" style="border-radius:5px;padding:8px 20px;" value="提交处理" type="button">&nbsp;<span id="msgview"></span>&nbsp; &nbsp; <label style="color:#888888"><input id="autocheckbox" checked type="checkbox">处理完自动关闭</label></div></td>
</tr>
<?php }?>
</table>
</form>
</div>
<div class="blank10"></div>
</div>
<?php }
if($stype=='' && $da['arr']['isgbcy']==0){
?>
<div id="recordsss">
<div class="stitle zhu"><span onclick="location.reload()">查阅记录</span> <a temp="clo" href="javascript:;" onclick="$('#recordsss').remove();">×</a></div>
<div><ul class="ydullist"><?php
foreach($da['arr']['readarr'] as $k=>$rs){
echo '<li title="共查阅'.$rs['stotal'].'次&#13;最后查阅'.$rs['optdt'].'" ><img src="'.$rs['face'].'" align="absmiddle"><br><span>'.$rs['name'].'</span></li>';
}
?></ul></div>
</div>
<?php
if($da['arr']['readunarr']){
?>
<div class="blank10"></div>
<div id="recordssswd">
<div class="stitle zhu"><span>未查阅人员</span> <a temp="clo" href="javascript:;" onclick="$('#recordssswd').remove();">×</a></div>
<div><ul class="ydullist"><?php
foreach($da['arr']['readunarr'] as $k=>$rs){
if($k>=30)break;//最多显示30人
echo '<li ><img src="'.$rs['face'].'" align="absmiddle"><br><span>'.$rs['name'].'</span></li>';
}
?></ul></div>
</div>
<?php }}?>
</div>
</div>
</div>
<?php
if($stype=='' && $cheikbo){
?>
<script type="text/javascript" src="web/res/js/jquery-changeuser.js"></script>
<link rel="stylesheet" type="text/css" href="mode/plugin/css/jquery-rockdatepicker.css"/>
<script type="text/javascript" src="mode/plugin/jquery-rockdatepicker.js"></script>
<script type="text/javascript" src="mode/plugin/jquery-signature.js"></script>
<script type="text/javascript" src="web/res/js/jquery-rockupload.js"></script>
<?php
if($flowinfor['checkfields'] && $da['inputjspath']!='')echo '<script type="text/javascript" id="modelujs" src="'.$da['inputjspath'].'"></script>';
}?>
</body>
</html>

View File

@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
<title><?=$da['pagetitle']?></title>
<link rel="shortcut icon" href="favicon.ico" />
<?php
if($stype==''){
?>
<link rel="stylesheet" type="text/css" href="<?=$da['p']?>/css/css.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/base64-min.js"></script>
<script type="text/javascript" src="<?=$da['p']?>/task/mode/modeview.js?<?=$da['logintime']?>"></script>
<script type="text/javascript" src="web/res/js/jquery-imgview.js"></script>
<script type="text/javascript" src="mode/plugin/jquery-rockmodels.js"></script>
<script>
var mid = '<?=$da['arr']['mid']?>',modenum='<?=$da['arr']['modenum']?>',ismobile=0,receiptrs=<?=json_encode($da['arr']['receiptrs'])?>,isinput=0;
</script>
<?php
}
$cheikbo = false;
?>
<style>
<?php
$maincolor = getconfig('apptheme','#1389D3');
$maincolora= c('image')->colorTorgb($maincolor);
$maincolors= ''.$maincolora[0].','.$maincolora[1].','.$maincolora[2].'';
echo 'body{--main-color:'.$maincolor.';}';
?>
.stitle{padding:5px;border-bottom:1px #dddddd solid;font-size:14px;}
.ydullist{display:inline-block;width:100%;}
.ydullist li{float:left;width:10%;text-align:center;padding:5px 0px;font-size:12px;display:block;line-height:25px;padding-top:10px}
.ydullist li:active{ background-color:#eeeeee}
.ydullist li img,.faces{height:30px;width:30px;border-radius:15px}
.ydullist li span{font-size:12px;color:#888888;}
.faces{margin-right:10px}
.ptitle{text-align:center;font-size:20px;padding-top:15px;padding-bottom:10px;}
.tabled2 td{padding:5px;border:1px #e5e5e5 solid;text-align:center}
td.tdys1{border:1px #e5e5e5 solid;text-align:center;padding:0px 5px}
.createtable{width:90%}
.menulls{position:absolute;left:1px;top:10px}
.menullss{position:absolute;left:1px;top:32px; background-color:white; border:1px #cccccc solid;border-bottom:0px;display:none}
.menullss li{padding:5px 10px;border-bottom:1px #dddddd solid;cursor:pointer}
.menullss li:hover{ background-color:#f1f1f1}
.pcont{line-height:27px;}
.pcont p{text-indent:2em;margin:10px 0px}
.pcont a{color:blue}
.status{position: absolute;right:20px;top:10px;display:}
.ke-zeroborder{border-spacing: 0;border-collapse: collapse;}
.ys0{border:1px #000000 solid}
.ys1{padding:5px 5px; border:1px #000000 solid;color:#000000;}
.ys2{padding:5px 5px; border:1px #000000 solid;}
.datesss{background:url(mode/icons/date.png) no-repeat right;cursor:pointer;width:50%}
.inputs{width:95%}
.statustext{position: absolute;right:40px;top:10px;width:80px;height:80px;overflow:hidden; border:3px red solid;border-radius:50%;font-size:20px;text-align:center;line-height:80px;color:red;transform:rotate(-45deg);-o-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);filter:progid:DXImagetransform.Microsoft.Matrix(M11=0.707,M12=-0.707,M21=0.707,M22=0.707,SizingMethod='auto expand');}
.tableblack .ys0,.tableblack .ys1,.tableblack .ys2{border:1px #000000 solid;color:#000000;}
.btn-danger{background-color:#d9534f;}
.printtable td,.printborder{border:1px #000000 solid}
.printtable td{padding:0px 3px}
.notitle{display:none}
<?php
if($stype!=''){
?>
*{font-size:14px}
.tabled2 td{border-color:#000000}
<?php }?>
</style>
</head>
<body style="background:white">
<div align="center">
<div style="width:<?=$da['xiangwidth']?>px;position:relative;background:white" class="noprint" id="maindiv" align="left">
<?php if($stype==''){?>
<div class="menulls"><input id="showmenu" style="background-color:#888888;font-size:12px;border-radius:5px" class="webbtn" value="操作V" type="button"></div>
<div class="menullss"><ul><li lx="0">打印全部...</li>
<li lx="9">回到详情页</li>
<li lx="5">另存为word...</li>
<li lx="7">另存为图片...</li>
<li lx="3">关闭</li>
<li lx="4">刷新</li>
</ul>
</div>
<?php }?>
<?php
//显示状态
if($da['arr']['isflow']>0 && $stype==''){
//echo '<div class="statustext" onclick="$(this).remove()" style="color:'.$da['arr']['statuscolor'].';border-color:'.$da['arr']['statuscolor'].'">'.$da['arr']['statustext'].'</div>';
}
$contview = $da['arr']['contview'];
if(!isempt($da['title']) && !isset($da['arr']['notitle']) && !contain($contview, 'notitle')){
echo '<div align="center"><div class="ptitle">'.$da['title'].'</div></div>';
}
?>
<div class="padding10 pcont" align="left">
<?php
if($stype!='')$contview=str_replace('cccccc','000000', $contview);
echo $contview;
?>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,392 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
<title><?=$da['pagetitle']?></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="webmain/css/cssm.css">
<link rel="stylesheet" type="text/css" href="webmain/css/rui.css">
<script type="text/javascript" src="web/res/js/jquery.1.9.1.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/base64-min.js"></script>
<?php
if($jswxsdk=='1')echo '<script type="text/javascript" src="js/jswxsdk.js"></script>'.chr(10).'';
?>
<script type="text/javascript" src="<?=$da['p']?>/task/mode/modeview.js?<?=$da['logintime']?>"></script>
<script type="text/javascript" src="web/res/js/jquery-imgview.js"></script>
<script type="text/javascript" src="mode/plugin/jquery-rockmodels.js"></script>
<script>
var mid = '<?=$da['arr']['mid']?>',adminname='<?=$da['adminname']?>',adminid='<?=$da['adminid']?>',admintoken='',modenum='<?=$da['arr']['modenum']?>',ismobile=1,receiptrs=<?=json_encode($da['arr']['receiptrs'])?>,isinput=0,watertype='<?=getconfig('watertype')?>';
js.changeuser=function(na,lx,tit, cans){
var can = {
'changetype':lx,
'titlebool':get('header_title'),
'idobj':get(na+'_id'),
'nameobj':get(na),
'onselect':function(sna,sid){
js.changeuser_after(this.formname,this,sna,sid);
}
};
var formname = get(na).name;
var bcar = js.changeuser_before(formname),i;
for(i in cans)can[i]=cans[i];
if(typeof(bcar)=='string' && bcar){js.msg('msg', bcar);return;}
if(typeof(bcar)=='object')for(i in bcar)can[i]=bcar[i];
can.formname = formname;
$('body').chnageuser(can);
}
function initApp(){
js.setapptitle('详情');
}
</script>
<style>
<?php
$maincolor = getconfig('apptheme','#1389D3');
$maincolora= c('image')->colorTorgb($maincolor);
$maincolors= ''.$maincolora[0].','.$maincolora[1].','.$maincolora[2].'';
echo 'body{--main-color:'.$maincolor.';}';
?>
.stitle{padding:10px;border-bottom:0.5px #dddddd solid;font-size:16px;}
.ydullist{display:inline-block;width:100%;}
.ydullist li{float:left;width:16.6%;text-align:center;padding:5px 0px;font-size:12px;display:block;line-height:25px;padding-top:10px}
.ydullist li:active{ background-color:#eeeeee}
.ydullist li img,.faces{height:30px;width:30px;border-radius:50%}
.ydullist li span{font-size:12px;color:#888888;}
.pinglun td{padding:10px 0px}
.pinglun .dt,.pinglun .act{font-size:12px;color:#888888;padding-top:5px}
.pinglun .name{color:#555555}
.pinglun tr{border-bottom: 1px solid #eeeeee;}
.pinglun .sm{padding-top:8px;font-size:14px}
.faces{margin-right:10px}
.createtable{width:98%}
.status{position: absolute;left:5px;top:5px;display:}
td.tdys1{border:0.5px #e5e5e5 solid;text-align:center;padding:0px 5px}
.divinput{padding:0px}
.datesss{background:url(mode/icons/date.png) no-repeat right;cursor:pointer;}
.statustext{position: absolute;right:5px;top:5px;width:60px;height:60px;overflow:hidden; border:2px red solid;border-radius:50%;font-size:16px;text-align:center;line-height:60px;color:red;transform:rotate(-45deg);-o-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);}
.btn-danger{background-color:#d9534f;}
#contentshow img{max-width:100%}
</style>
</head>
<body <?php if($da['arr']['isdefaultview']==0) echo 'style="background:white"';?>>
<?php
$cheikbo = false;
if($showheader==1)echo '<div class="header" style="padding-top:'.$cenghei.'px" id="header_title"><span onclick="js.back()" class="header-back"></span>'.$da['title'].'</div><div style="height:'.($cenghei+50).'px;overflow:hidden"></div>';
if($da['arr']['isdefaultview']==1)echo '<div onclick="c.changeshow(0)" class="r-subtitle">&nbsp;&nbsp;'.$da['arr']['modename'].'</div>';
?>
<div id="contentshow" class="padding10<?php if($da['arr']['isdefaultview']==1) echo ' r-border-t';?>" style="position:relative; background:white">
<?php
if($da['arr']['isflow']>0){
echo '<div class="statustext" style="color:'.$da['arr']['statuscolor'].';border-color:'.$da['arr']['statuscolor'].'">'.$da['arr']['statustext'].'</div>';
}
echo $da['arr']['contview']
?>
</div>
<div class="r-border-t"></div>
<?php
if($da['arr']['optmenu']){
$opsts = '<div class="padding10" align="center">';
foreach($da['arr']['optmenu'] as $pt1=>$ptrs){
if($pt1>0)$opsts.='&nbsp;&nbsp;';
$opsts.='<input onclick="c.optmenu(this)" class="webbtn radius5" optmenuid="'.$ptrs['optmenuid'].'" issm="'.$ptrs['issm'].'" style="background:'.$ptrs['color'].'" value="'.$ptrs['name'].'" type="button">';
}
$opsts.= '</div>';
echo $opsts;
}
//显示其他页面
if($da['spagepath']!=''){
include_once($da['spagepath']);
}
//是否开评论了
if($da['arr']['isplview']=='1'){
?>
<div class="r-subtitle">&nbsp;&nbsp;评论</div>
<div class="r-border-t" style="background:white" >
<div align="left" class="padding10">
<div align="left"><textarea class="inputs" id="pinglun_explain" style="width:98%;height:60px" placeholder="请输入评论内容"></textarea></div>
<div style="padding-top:5px">
<button class="webbtn" style="border-radius:5px" onclick="c.pinglun(this)" id="check_btn" type="button">
提交评论</button>
&nbsp;<span id="pinglun_spage"></span>
</div>
</div>
</div>
<div class="r-border-t"></div>
<?php
}
?>
<div>
<?php
if($da['arr']['isflow']>0 && $da['arr']['status'] != '1'){
$flowinfor = $da['arr']['flowinfor'];
?>
<div class="r-subtitle">&nbsp;&nbsp;流程信息</div>
<div class="r-border-t" style="background:white" >
<div class="padding10" align="center">
<form name="myform" autocomplete="off">
<table border="0" width="100%" class="tabled1" style="border-collapse:collapse;" cellspacing="0" cellpadding="0">
<tr height="40" bgcolor="#E1F4F0">
<td class="tdys1"><div align="right" style="color:#555555">状态</div></td>
<td class="tdys1"><div align="left"><?=$flowinfor['nstatustext']?></div></td>
</tr>
<tr height="40">
<td class="tdys1" nowrap><div align="right" style="color:#555555">处理流程</div></td>
<td class="tdys1"><div align="left" style="padding:5px 0px"><?=$flowinfor['flowcoursestr']?></div></td>
</tr>
<?php
//判断是否可撤回
if($da['arr']['ischehui']>0){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">撤回</div></td>
<td class="tdys1" style="padding:5px"><div align="left"><input class="webbtn" onclick="c.chehui(this)" value="撤回上步我的处理" type="button"></div></td>
</tr>
<?php
}
if($flowinfor['ischeck']==1){
$cheikbo = true;
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">当前处理</div></td>
<td class="tdys1"><div align="left"><?=$flowinfor['nowcourse']['name']?>(<?=$flowinfor['nowcourse']['nowcheckname']?>)</div></td>
</tr>
<tr height="40">
<td class="tdys1" nowrap><div align="right" style="color:#555555"><font color=red>*</font>处理动作</div></td>
<td class="tdys1"><div align="left">
<?php
$s = '';
$tuiname = '';
foreach($flowinfor['courseact'] as $k=>$act){
if($k>0 && $act[0])$s.='<label><input name="check_status" onclick="c.changecheck_status(this)" type="radio" value="'.$k.'">'.$act[0].'</label> &nbsp; ';
if($k==2)$tuiname = $act[0];
}
echo $s;
?>
</div></td>
</tr>
<?php
?>
<?php
//是否可抄送
if($flowinfor['ischao']==1 || $flowinfor['ischao']==2){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">抄送</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<input name="bzcslx" type="hidden" value="<?=$flowinfor['ischao']?>">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择了抄送对应人" class="inputs" style="width:98%" id="bzchaosongname" readonly type="text" name="bzchaosongname"><input name="bzchaosongnameid" id="bzchaosongname_id" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('bzchaosongname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('bzchaosongname','changeusercheck','',{changerange:'<?=$flowinfor['ischaofwid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php
}
?>
<input type="hidden" id="isqianming" value="<?=$flowinfor['nowcourse']['isqm']?>">
<?php
//需要签名才显示
if((int)$flowinfor['nowcourse']['isqm']>0){
?>
<tr height="40">
<td class="tdys1"><div align="right" style="color:#555555">手写签名</div></td>
<td class="tdys1"><div id="qianmingshow" style="padding:5px 0px" align="left"><input type="button" onclick="c.qianming(this)" style="padding:2px" value="写签名">&nbsp;&nbsp;<input type="button" onclick="c.qianyin(this)" style="padding:2px" value="引用签名"></div></td>
</tr>
<?php
}
//不通过退回是
if($tuiname != '' && $da['arr']['isflow']!=3){
?>
<tr style="display:none" id="tuihuidiv" height="40">
<td class="tdys1" nowrap><div align="right" style="color:#555555"><font color=red>*</font><?=$tuiname?>退回</div></td>
<td class="tdys1"><div align="left">
<select class="inputb" name="check_tuiid" style="width:99%"><option value="0">退回到提交人</option>
<?php
if($flowinfor['tuicourse']){
$tstr = '<optgroup label="退回到步骤">';
foreach($flowinfor['tuicourse'] as $k=>$trs){
$tstr.='<option value="'.$trs['id'].'">'.$trs['name'].'('.$trs['checkname'].')</option>';
}
$tstr.='</optgroup>';
echo $tstr;
}
?>
</select>
</div></td>
</tr>
<?php
}
foreach($flowinfor['checkfields'] as $chef=>$chefv){
if($chefv['showinpus']==1){
?>
<tr>
<td class="tdys1"><div align="right" style="color:#555555"><?php if($chefv['isbt']=='1')echo '<font color=red>*</font>';?><span isbt="<?=$chefv['isbt']?>" fieidscheck="<?=$chef?>" fieldstype="<?=$chefv['fieldstype']?>"><?=$chefv['name']?></span></div></td>
<td class="tdys1" style="padding:5px;" ><div align="left"><?=$chefv['inputstr']?></div></td>
</tr>
<?php
}else if($chefv['showinpus']==2){
echo '<tr style="display:none"><td><span isbt="'.$chefv['isbt'].'" fieidscheck="'.$chef.'">'.$chefv['name'].'</span></td><td>'.$chefv['inputstr'].'</td></tr>';
}}
//是否可转办显示
if($flowinfor['iszhuanban']>0){
?>
<tr style="display:none" id="zhuangdiv">
<td class="tdys1"><div align="right" style="color:#555555">转给</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择了就会转办给对应人" class="inputs" style="width:98%" id="zhuanbanname" readonly type="text" name="zhuanbanname"><input name="zhuanbannameid" id="zhuanbanname_id" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('zhuanbanname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('zhuanbanname','changeuser<?=$flowinfor['zbrangelx']?>','',{changerange:'<?=$flowinfor['zbrangeid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php
}
if($flowinfor['ischange']==1){
?>
<tr style="display:none" id="nextxuandiv">
<td class="tdys1"><div align="right" style="color:#555555"><font color=red>*</font>下一步处理人</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<table width="98%" cellpadding="0" border="0"><tr><td width="100%"><input placeholder="选择下一步[<?=$flowinfor['nextcourse']['name']?>]处理人" class="inputs" style="width:98%" id="nextname" readonly type="text" value="<?=$flowinfor['nextcourse']['checkname']?>" name="nextname"><input name="nextnameid" id="nextname_id" value="<?=$flowinfor['nextcourse']['checkid']?>" type="hidden"></td><td nowrap><a href="javascript:;" onclick="js.changeclear('nextname')" class="webbtn">×</a><a href="javascript:;" onclick="js.changeuser('nextname','changeusercheck','',{changerange:'<?=$flowinfor['nextcourse']['checktypeid']?>'})" class="webbtn">选择</a></td></tr></table>
</div></td>
</tr>
<?php }
$smlx = (int)$flowinfor['nowcourse']['smlx'];
$wjlx = (int)$flowinfor['nowcourse']['wjlx'];
echo '<tr style="display:none"><td><input name="check_smlx" value="'.$smlx.'"><input name="check_wjlx" value="'.$wjlx.'"></td></tr>';
if($smlx!=3){
?>
<tr>
<td class="tdys1"><div align="right" style="color:#555555"><?php if($smlx==1)echo '<font color=red>*</font>';?>说明</div></td>
<td class="tdys1" style="padding:5px"><div align="left"><textarea class="inputb" name="check_explain" style="width:95%;height:60px;"></textarea></div></td>
</tr>
<?php
}
if($wjlx!=3){
?>
<tr>
<td class="tdys1" nowrap><div align="right" style="color:#555555"><?php if($wjlx==1)echo '<font color=red>*</font>';?>相关文件</div></td>
<td class="tdys1" style="padding:5px"><div align="left">
<input name="fileid" type="hidden">
<div id="filedivview" style="height:60px;overflow:auto;width:96%" class="inputb"></div>
<div id="filedivviewfile"><input style="width:150px" onchange="f.change(this)" type="file"></div>
</div></td>
</tr>
<?php
}
?>
<tr>
<td class="tdys1" colspan="2" style="padding:10px 5px"><div align="center"><button class="webbtn" style="width:95%;border-radius:5px" onclick="check(0)" id="check_btn" type="button">提交处理</button><br><span id="msgview"></span></div></td>
</tr>
<?php }?>
</table>
</form>
</div>
</div>
<div class="r-border-t"></div>
<?php
}
$logarr = $da['arr']['logarr'];
if($logarr && $da['arr']['isgbjl']==0){
$logcount= count($logarr);
?>
<div onclick="c.changeshow(0)" class="r-subtitle">&nbsp;&nbsp;处理记录(<?=$logcount?>) <img align="absmiddle" height="16" width="16" src="images/xiangyou1.png"> </div>
<div id="showrecord0" class="pinglun r-border-t" style="background:white;display:none">
<table width="100%">
<?php
foreach($logarr as $k=>$rs){
$atrs = ($logcount==$k+1) ? 'style="border:none"':'';
$s = '<tr '.$atrs.' valign="top">';
$s.= '<td align="right" width="50"><img src="'.$rs['face'].'" class="faces"></td>';
$s.= '<td>';
$s.= '<div class="name">'.$rs['name'].'<span class="act">['.$rs['actname'].']</span><font color="'.$rs['color'].'">'.$rs['statusname'].'</font><span class="dt">('.$rs['optdt'].')</span></div>';
if(!isempt($rs['explain']))$s.= '<div class="sm">'.$rs['explain'].'</div>';
$s.= '</td>';
$s.= '</tr>';
echo $s;
}
?>
</table>
</div>
<div class="r-border-t"></div>
<?php
}
//是否关闭查阅记录
if($da['arr']['isgbcy']==0){
?>
<div onclick="location.reload()" class="r-subtitle">&nbsp;&nbsp;查阅记录(<?=count($da['arr']['readarr'])?>)</div>
<div class="r-border-t" style="background:white"><ul class="ydullist"><?php
foreach($da['arr']['readarr'] as $k=>$rs){
echo '<li onclick="showchayue(\''.$rs['optdt'].'\',\''.$rs['stotal'].'\')"><img src="'.$rs['face'].'" align="absmiddle"><br><span>'.$rs['name'].'</span></li>';
}
?></ul></div>
<div class="r-border-t"></div>
<?php
if($da['arr']['readunarr']){
?>
<div onclick="location.reload()" class="r-subtitle">&nbsp;&nbsp;未查阅人员(<?=count($da['arr']['readunarr'])?>)</div>
<div class="r-border-t" style="background:white"><ul class="ydullist"><?php
foreach($da['arr']['readunarr'] as $k=>$rs){
if($k>=30)break;//最多显示30人
echo '<li ><img src="'.$rs['face'].'" align="absmiddle"><br><span>'.$rs['name'].'</span></li>';
}
?></ul></div>
<div class="r-border-t"></div>
<?php
}}
?>
</div>
<?php
if($cheikbo){
?>
<script type="text/javascript" src="web/res/js/jquery-changeuser.js"></script>
<link rel="stylesheet" type="text/css" href="mode/plugin/css/jquery-rockdatepicker.css"/>
<script type="text/javascript" src="mode/plugin/jquery-rockdatepicker.js"></script>
<script type="text/javascript" src="mode/plugin/jquery-signature.js"></script>
<script type="text/javascript" src="web/res/js/jquery-rockupload.js"></script>
<?php
if($flowinfor['checkfields'] && $da['inputjspath']!='')echo '<script type="text/javascript" id="modelujs" src="'.$da['inputjspath'].'"></script>';
}?>
</body>
</html>

View File

@@ -0,0 +1,84 @@
<?php
/**
* 对外开发接口文件
* createname信呼
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2016-11-01
* explain返回200为正常
* post需开启always_populate_raw_post_data = On
*/
class openapiAction extends ActionNot
{
private $openkey = '';
public $postdata= '';
//是否验证openkey
protected $keycheck= true;
public function initAction()
{
$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($openkey != md5($this->openkey))$this->showreturn('', 'openkey not access', 201);
}
$this->getpostdata();
}
public function getpostdata()
{
if(isset($GLOBALS['HTTP_RAW_POST_DATA']))$this->postdata = $GLOBALS['HTTP_RAW_POST_DATA'];
if($this->postdata=='')$this->postdata = trim(file_get_contents('php://input'));
}
public function getvals($nae, $dev='')
{
$sv = $this->rock->jm->base64decode($this->post($nae));
if($this->isempt($sv))$sv=$dev;
return $sv;
}
/**
* 获取提交的数据
*/
public function getpostarr()
{
$str = $this->postdata;
if(isempt($str))return false;
$arr = json_decode($str, true);
return $arr;
}
/**
* 根据关键字获取用户
*/
public function getuserid($id, $sur=true)
{
if(isempt($id))return 0;
$where = "`user`='$id'";
$check = c('check');
if($check->iscnmobile($id)){
$where = "`mobile`='$id'";
}elseif($check->isemail($id)){
$where = "`email`='$id'";
}elseif($check->isincn($id)){
$where = "`name`='$id'";
}elseif($check->isnumber($id)){
$where = "`id`='$id'";
}
$urs = $this->db->getall("select `id`,`name` from `[Q]admin` where $where and `status`=1");
if($this->db->count!=1)return 0;
$urs = $urs[0];
$uid = (int)$urs['id'];
if($sur){
$this->adminid = $uid;
$this->adminname = $urs['name'];
$this->rock->adminid = $uid; //用户Id
$this->rock->adminname = $urs['name'];
}
return $uid;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* 基本接口
* 请求地址如http://URL/api.php?m=openbase&openkey=openkey&a=方法名
*/
class openbaseClassAction extends openapiAction
{
/**
* 例子1新增模块单据如新增流程单据等
* 接口地址http://URL/api.php?m=openbase&openkey=openkey&a=querydata
*/
public function querydataAction()
{
$arr = $this->getpostarr();
if(!$arr)return returnerror('not data');
$modenum = $arr['basemodenum'];
$adminid = $arr['baseoptid']; //提交的用户
if(isempt($modenum))return returnerror('modenum is empty');
$uid = $this->getuserid($adminid);
if($uid==0)return returnerror('['.$adminid.']用户不存在');
$sm = arrvalue($arr,'baseexplain'); //说明
unset($arr['basemodenum']);
unset($arr['baseoptid']);
if($sm)unset($arr['baseexplain']);
//此方法在文件webmain/model/flowModel.php下的querydata方法。
$mid = m('flow')->querydata($modenum, $arr, $sm);
return returnsuccess(array(
'mid' => $mid,
));
}
/**
* 例子2推送消息到应用中
* 接口地址http://URL/api.php?m=openbase&openkey=openkey&a=pushtodo
*/
public function pushtodoAction()
{
$mid = null; //要推送单据ID
$modenum = 'daily'; //推送到哪个模块中,daily是工作日报模块
//1、初始化流程
$flow = m('flow')->initflow($modenum, $mid);
//2、调用推送方法调用webmain/model/flow/flow.php 下的push方法
$receid = '1'; //接收人ID,多个,分开如推送给全部人员写d1
$gname = ''; //推送到哪个应用下,为空,默认是跟当前模块名一样的应用。
$cont = '这是个推送的内容';
$title = '这是个标题'; //可以为空
$flow->push($receid, $gname, $cont, $title);
return '推送完成';
}
/**
* 例子3向单用户/会话发消息,聊天的。
*/
}

View File

@@ -0,0 +1,133 @@
<?php
/**
* 将数据上传到打卡记录表上
* 请求地址如http://127.0.0.1/api.php?m=opendkq&openkey=key
* 请求方式POST
* 提交过来数据[{"name":"姓名","dkdt":"2016-10-22 09:00:00"}]
*/
class opendkqClassAction extends openapiAction
{
public function indexAction()
{
//6 接口导入
$carr = $this->senddata(6);
$this->showreturn('成功导入'.$carr['oi'].'条数据');
}
//
private function senddata($type)
{
$str = $this->postdata;
if(isempt($str))$this->showreturn('', 'not data', 201);
$arr = json_decode($str, true);
$oi = 0;$uarr = array();$finarr = array();
$dtobj = c('date');$adb = m('admin');$db = m('kqdkjl');$uobj = m('userinfo');
$updt = '';
$cheobj = c('check');
$snarr = array();
if($type==9){
$snarr = $this->db->getarr('[Q]kqjsn','`pinpai`=1','`id`,`name`','num');
}
$datype = array('密码','指纹','刷卡');
if(is_array($arr))foreach($arr as $k=>$rs){
$name = isset($rs['name']) ? $rs['name'] : '';
$dkdt = isset($rs['dkdt']) ? $rs['dkdt'] : '';
$finge= isset($rs['finge']) ? $rs['finge'] : '';
$name = str_replace("'",'', $name);
$uid = 0;
$snid = 0;
$sntype = 1;
$comid = 0;
$explain = '';
if($type==9){
$sn = arrvalue($rs, 'sn');
if(!$sn)continue;
$snrs = arrvalue($snarr, $sn);
if(!$snrs)continue;
$snid = $snrs['id'];
$explain = '使用['.$snrs['name'].']打卡';
if(!isset($snrs['isgx'])){
m('kqjsn')->update("`lastdt`='$this->now'", $snid);
$snarr[$sn]['isgx'] = 'a';
}
}
if(!isempt($name) && !isempt($dkdt)){
if(!$dtobj->isdate($dkdt))continue;
if($updt=='' || $dkdt>$updt)$updt = $dkdt;
if($type==9 && $finge){
if(isset($finarr[$finge])){
if($finarr[$finge]){
$uid = $finarr[$finge]['id'];
$comid = $finarr[$finge]['companyid'];
}
}else{
$uwher = "`finger`='$finge'";
$usobj = $uobj->getrows($uwher,'`id`,`companyid`');
if($usobj){
$uid = $usobj[0]['id'];
$comid = $usobj[0]['companyid'];
$finarr[$finge] = $usobj[0];
}else{
$finarr[$finge] = false;
}
}
}
if($uid==0){
if(isset($uarr[$name])){
if($uarr[$name]){
$uid = $uarr[$name]['id'];
$comid = $uarr[$name]['companyid'];
}
}else{
$uwher = "`name`='$name'";
if($cheobj->iscnmobile($name))$uwher = "`mobile`='$name'";
if($cheobj->isemail($name))$uwher = "`email`='$name'";
$usar = $adb->getrows($uwher,'`id`,`companyid`');
if($usar){
$uid = $usar[0]['id'];
$comid = $usar[0]['companyid'];
$uarr[$name] = $usar[0];
}else{
$uarr[$name] = false;
}
}
}
if($uid==0)continue;
if($comid==0)$comid = 1;
if($db->rows("`uid`='$uid' and `dkdt`='$dkdt'")>0)continue;
$oi++;
$db->insert(array(
'uid' => $uid,
'dkdt' => $dkdt,
'optdt' => $this->now,
'type' => $type,
'snid' => $snid,
'sntype'=> $sntype,
'explain'=> $explain,
'comid'=> $comid,
));
}
}
if($updt && $updt>$this->now)$updt=$this->now;
//$this->rock->debugs(array($uarr, $finarr),'daorudaka');
return array(
'oi' => $oi,
'updt' => $updt,
);
}
/**
* 中控考勤机导入
*/
public function zktimeAction()
{
//9中控
$carr = $this->senddata(9);
echo $carr['updt'];
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* 群英考勤机
* 请求地址如http://127.0.0.1/api.php?m=opendkq&openkey=key
*/
class openkqjClassAction extends openapiAction
{
private $snid = 0; //设备号ID
public function initAction()
{
$this->display= false;
$this->getpostdata();
}
public function indexAction()
{
echo 'ok';
}
//考勤机的使用
public function apiAction()
{
//print_r($_SERVER);
$path = arrvalue($GLOBALS,'_paths', $_SERVER['REQUEST_URI']);
if(isempt($path))return '';
$patha = explode('/', $path);
$acta = explode('?', $patha[count($patha)-1]);
$act = $acta[0];
$data = array();
$num = $this->get('sn'); //设备号
if(!$num)return 'notdata';
$dbs = m('kqjsn');
$snid = (int)$dbs->getmou('id',"`num`='$num'");
if($snid==0)$snid = $dbs->insert(array(
'num' => $num,
'optdt' => $this->rock->now,
'status' => 1
));
$this->snid = $snid;
//考勤机请求
if($act=='get'){
$data= m('kqjcmd')->getcmd($this->snid); //向考勤机发送命令
}
//推送来的
if($act=='post' && $this->postdata!=''){
$data= m('kqjcmd')->postdata($this->snid, $this->postdata);
}
//设备上获取服务器时间
if($act=='unixtime'){
$this->rock->debugs(json_encode($_GET),'unixtime');
$data['timezone'] = 'UTC';
$data['unixtime'] = time()-8*3600; //由于北京时间多8小时所有要减
$data['datetime'] = date('Y-m-d H:i:s', $data['unixtime']);
}
$barr['status'] = 1;
$barr['info'] = 'ok';
$barr['data'] = $data;
return $barr;
}
//推送过来的数据
//[{"id":"5056928","data":"return","return":[{"id":"0","result":"0"}]},{"id":"8993137","data":"return","return":[{"id":"0","result":"0"}]},{"id":"1275640","data":"return","return":[{"id":"0","result":"0"}]},{"id":"8085763","data":"return","return":[{"id":"0","result":"0"}]},{"id":"3896216","data":"return","return":[{"id":"0","result":"0"}]},{"id":"5036770","data":"return","return":[{"id":"0","result":"0"}]},{"id":"3554609","data":"return","return":[{"id":"0","result":"0"}]},{"id":"2144747","data":"return","return":[{"id":"0","result":"0"}]},{"id":"235805","data":"return","return":[{"id":"0","result":"0"}]},{"id":"186003","data":"return","return":[{"id":"0","result":"0"}]}]
}

View File

@@ -0,0 +1,95 @@
<?php
/**
* 电子合同小程序用的接口
*/
class openmodhetongClassAction extends openapiAction
{
/**
* 首页返回数据
*/
public function dataAction()
{
$mobile = $this->get('mobile');
$xcytype = $this->get('xcytype');
$openid = $this->get('openid');
$nickName = $this->jm->base64decode($this->get('nickName'));
$htdata = array();
$db = m('wxxcyus');
$uarr['mobile'] = $mobile;
$uarr['xcytype'] = $xcytype;
$uarr['openid'] = $openid;
$uarr['nickName'] = $nickName;
$uarr['province'] = $this->get('province');
$uarr['city'] = $this->get('city');
$uarr['gender'] = $this->get('gender');
$uarr['dingyue'] = $this->get('dingyue');
$uarr['avatarUrl'] = $this->jm->base64decode($this->get('avatarUrl'));
$where = "`openid`='$openid'";
if($db->rows($where)==0){
$uarr['adddt'] = $this->now;
$where='';
}else{
$uarr['optdt'] = $this->now;
}
$db->record($uarr, $where);
$custid = '0'; //客户id
$rows = m('customer')->getall("`mobile`='$mobile' and `status`=1",'id');
foreach($rows as $k=>$rs)$custid.=','.$rs['id'].'';
if($custid!='0'){
$htrows = m('custract')->getall('custid in('.$custid.')','custid,custname,id,startdt,enddt,signdt,type,money,num','id desc');
$dt = $this->rock->date;
foreach($htrows as $k=>$rs){
if($rs['startdt']>$dt){
$statustext='待生效';
$statuscolor='blue';
}else if($rs['startdt']<=$dt && $rs['enddt']>=$dt){
$statustext='生效中';
$statuscolor='green';
}else if($rs['enddt']<$dt){
$statustext='已过期';
$statuscolor='gray';
}
$htdata[] = array(
'id' => $rs['id'],
'name' => $rs['custname'],
'modenum' => 'custract',
'explain' => '金额:'.$rs['money'].',编号:'.$rs['num'].',有效期:'.$rs['startdt'].'→'.$rs['enddt'].'',
'statustext'=>$statustext,
'statuscolor'=>$statuscolor,
);
}
}
return returnsuccess(array(
'htdata' => $htdata,
));
}
/**
* 获取客户数据
*/
public function customerAction()
{
$mobile = $this->get('mobile');
$xcytype = $this->get('xcytype');
$openid = $this->get('openid');
$sql = "select a.id,a.name,a.unitname,b.name as yewuname from [Q]customer a left join [Q]admin b on a.uid=b.id where a.`mobile`='$mobile' and a.`status`=1";
$rows = $this->db->getall($sql);
$custdata = array();
foreach($rows as $k=>$rs){
$custdata[] = array(
'id' => $rs['id'],
'name' => $rs['name'],
'modenum' => 'customer',
'explain' => '业务员:'.$rs['yewuname'].'',
);
}
return returnsuccess(array(
'custdata' => $custdata,
));
}
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* sso登录
* 访问地址如http://demo.rockoa.com/api.php?m=opensso
*/
class openssoClassAction extends openapiAction
{
public function initAction()
{
$this->display= false;
}
public function indexAction()
{
$ssotoken = $this->get('ssotoken');
$lurl = urldecode($this->get('backurl')); //登录成功跳转地址urlencode
if(isempt($ssotoken))return '没有参数ssotoken';
$checkurl = getconfig('sso_checkurl'); //验证地址
$ssokey = getconfig('sso_key'); //验证key
if(isempt($checkurl))return '没有配置验证地址';
$jg = contain($checkurl,'?')?'&':'?';
$url = $checkurl.$jg.'ssotoken='.$ssotoken.'&ssokey='.$ssokey.'';
$user = c('curl')->getcurl($url); //要返回用户帐号/手机号
if(isempt($user))return '验证失败没有返回值';
//调用登录方法验证
$lobj = m('login');
$rand = md5(''.$this->rock->now.''.$user.'');
$lobj->setloginrand($rand);
$arr = $lobj->start($user, $rand, 'pc','SSO');
if(!is_array($arr)){
return $arr;
}else{
$uid = $arr['uid'];
$name = $arr['name'];
$user = $arr['user'];
$token = $arr['token'];
$lobj->setsession($uid, $name, $token, $user);
if(isempt($lurl)){
$lurl = 'index.php?m=index';
if($this->rock->ismobile())$lurl='index.php?d=we';
}
$this->rock->location($lurl);//跳转
return 'success';
}
}
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* 外部调用单据详情页
*/
class openxiangClassAction extends openapiAction
{
/**
* 详情
*/
public function dataAction()
{
$list['hetong'] = 'custract,customer'; //配置可读取模块
$num = $this->get('num');
$xcytype = $this->get('xcytype');
$mid = (int)$this->get('mid','0');
if(isempt($num) || !$xcytype || $mid==0)return returnerror('num isempt');
$kears = arrvalue($list, $xcytype);
if(!$kears)return returnerror('无效模块1');
if(!in_array($num,explode(',', $kears)))return returnerror('无效模块2');
$flow = m('flow')->initflow($num,$mid, false);
$barr['modename'] = $flow->modename;
$barr['btndata'] = array();
$barr['xiangdata']= array();
if(method_exists($flow,'openxiang')){
$lbarr = $flow->openxiang();
if(is_array($lbarr))foreach($lbarr as $k=>$v)$barr[$k]=$v;
}
return returnsuccess($barr);
}
/**
* 操作菜单
*/
public function optmenuAction()
{
$num = $this->get('num');
$xcytype = $this->get('xcytype');
$mid = (int)$this->get('mid','0');
$menuid = (int)$this->get('menuid','0');
$sm = $this->jm->base64decode($this->get('sm'));
if(isempt($num) || !$xcytype || $mid==0)return returnerror('num isempt');
$flow = m('flow')->initflow($num,$mid, false);
$msg = $flow->optmenu($menuid,1,$sm);
if($msg!='ok')return returnerror($msg);
return returnsuccess($msg);
}
/**
* 下载文件
*/
public function downurlAction()
{
$id = (int)$this->get('id','0');
$openid = $this->get('openid');
if(isempt($openid))return;
if(m('wxxcyus')->rows("`openid`='$openid'")==0)return;
m('file')->show($id, true);
}
/**
* 返回文件详情
*/
public function fileinfoAction()
{
$id = (int)$this->get('id','0');
$openid = $this->get('openid');
if(isempt($openid))return returnerror('无效openid1');
if(m('wxxcyus')->rows("`openid`='$openid'")==0)return returnerror('无效openid');
$frs = m('file')->getone($id,'id,filename,filesize,fileext,filepath,filepathout');
return returnsuccess($frs);
}
}

View File

@@ -0,0 +1,162 @@
<?php
/**
* 对接中控考勤机
* 请求地址如http://127.0.0.1/app/xinhu/api.php?m=openzktime&a=get
*/
class openzktimeClassAction extends openapiAction
{
private $snid = 0;
private $snrs;
private function getsnid()
{
$num = $this->get('sn'); //设备号
$snid = 0;
if(!isempt($num)){
$dbs = m('kqjsn');
$snid = (int)$dbs->getmou('id',"`num`='$num'");
if($snid==0)$snid = $dbs->insert(array(
'num' => $num,
'optdt' => $this->rock->now,
'status' => 1,
'pinpai' => '1'
));
$this->snid = $snid;
$this->snrs = $dbs->getone($snid);
}
return $snid;
}
public function testAction()
{
return 'oknew';
}
/**
* 考勤机定时请求命令
*/
public function getAction()
{
$snid = $this->getsnid();
if($snid==0)return 'notdata';
$data= m('kqjcmd')->getcmd($snid);
if($data){
$batr = array();
foreach($data as $k=>$bar){
if(!isset($bar['data']))$bar['data']='none';
$bar['atype'] = $bar['do'];
unset($bar['do']);
$batr[] = json_encode($bar, JSON_UNESCAPED_UNICODE);
}
$data = join('ROCKZK', $batr);
}
return $data;
}
/**
* 获取人员关系
*/
public function getuserAction()
{
$uarr = $this->db->getall('select a.`id`,a.`name`,b.`finger` from `[Q]admin` a left join `[Q]userinfo` b on a.`id`=b.`id` where a.`status`=1');
$batr = array();
foreach($uarr as $k=>$rs){
$cid = $rs['finger'];
if(isempt($cid))$cid=$rs['id'];
$batr[] = '0,'.$cid.','.$rs['name'].','.$rs['id'].'';
}
return join('ROCKZK', $batr);
}
/**
* 命令状态更新
*/
public function getcAction()
{
$this->getsnid();
$id = (int)$this->get('id','0');
if($id==0)return;
$status = (int)$this->get('status');
$cmds = m('kqjcmd');
$cmds->update(array(
'status'=>$status,
'cjtime'=>$this->rock->now
), $id);
$cmds->returnchuli($id, $this->snid);
}
/**
* 中控考勤机插件推送提交过来数据
*/
public function postAction()
{
$this->getsnid();
$atype = $this->get('atype');
$str = $this->postdata;
if(isempt($str))return 'not data';
$arr = json_decode($str, true);
$fenxiarr = array();
//打卡
if($atype=='daka'){
$db = m('kqdkjl');
$kqcmd = m('kqjcmd');
$kqcmd->getsninfo($this->snid);
$type = 9;
$oi = 0;
$ids = '';
foreach($arr as $k=>$rs){
$barr = $kqcmd->adddkjl($this->snid, $rs, $type, $db, 1);
$oi++;
foreach($barr as $k1=>$v1)$fenxiarr[$k1] = $v1;
$ids .= ','.$rs['id'].'';
}
//考勤分析
if($fenxiarr){
$kqobj = m('kaoqin');
foreach($fenxiarr as $keys=>$uid){
$keysa = explode('|', $keys);
$kqobj->kqanay($uid, $keysa[0]);
}
}
if($ids!='')$ids = substr($ids,1);
return array(
'msg' => 'upload add('.$oi.')record',
'ids' => $ids
);
}
//已存在用户Id
if($atype=='user'){
$uids = $arr['uids'];
m('kqjsn')->update(array(
'userids' => $uids
), $this->snid);
echo '上传用户id成功';
}
//上传设备信息
if($atype=='info'){
m('kqjsn')->update(array(
'usershu' => $arr['usershu'],
'fingerprintshu' => $arr['fingerprintshu'],
'clockinshu' => $arr['clockinshu'],
), $this->snid);
echo '上传设备信息成功';
}
//上传指纹模版
if($atype=='fingerprint'){
$kqjdb = m('kqjcmd');
foreach($arr as $k=>$rs){
$kqjdb->savefingerprint($this->snid, $rs['uid'], array($rs['fingerprint1'],$rs['fingerprint2']));
}
echo '上传指纹模版成功';
}
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 运行方式E:\php\php-5.4.14\php.exe E:\IIS\app\xinhu\task.php beifen
* url:http://demo.rockoa.com/task.php?m=beifen|runt
* url:http://127.0.0.1/app/xinhu/task.php?m=beifen|runt
*/
class beifenClassAction extends runtAction
{
//每天cli备份数据为sql文件的
public function defaultAction()
{
if(PHP_SAPI != 'cli') return 'plase cli run';
$alltabls = $this->db->getalltable();
$nobeifne = array(''.PREFIX.'log',''.PREFIX.'logintoken',''.PREFIX.'kqanay',''.PREFIX.'email_cont',''.PREFIX.'reads',''.PREFIX.'dailyfx',''.PREFIX.'todo',''.PREFIX.'city'); //不备份的表;
$data = array();
$strstr = "/*
备份时间:".$this->now."
*/
";
foreach($alltabls as $tabs){
if(in_array($tabs, $nobeifne))continue;
$strstr .= "DROP TABLE IF EXISTS `$tabs`;\n";
$sqla = $this->db->getall('show create table `'.$tabs.'`');
$strstr .= "".$sqla[0]['Create Table'].";\n";
$rows = $this->db->getall('select * from `'.$tabs.'`');
foreach($rows as $k=>$rs){
$vstr = '';
foreach($rs as $k1=>$v1){
if(!isempt($v1))$v1 = str_replace("\n",'\n', $v1);
$v1 = ($v1==null) ? 'null' : "'$v1'";
$vstr.=",$v1";
}
$strstr .= "INSERT INTO `$tabs` VALUES(".substr($vstr,1).");\n";
}
$strstr .= "\n";
}
$rnd = str_shuffle('abcedfghijk').rand(1000,9999);
$file = ''.DB_BASE.'_'.date('Y.m.d.H.i.s').'_'.$rnd.'.sql';
$filepath = ''.UPDIR.'/data/'.$file.'';
$this->rock->createtxt($filepath, $strstr);
//给管理员邮箱发邮件
m('email')->sendmail(''.TITLE.'数据库备份',''.TITLE.'数据库备份'.$this->rock->now.'', 1 , array(), 1, array(
'attachname'=> $file,
'attachpath'=> $filepath,
));
@unlink($filepath);
return 'success';
}
}

View File

@@ -0,0 +1,10 @@
<?php
class carmClassAction extends runtAction
{
//车辆提醒,每天运行
public function runAction()
{
return m('flow')->initflow('carms')->todocarms($this->runrs['todoid']);
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* 这个固定 文件名,方法名 参数
* php task.php cli,run -key=a -key2=b
*/
class cliClassAction extends runtAction
{
public function runAction()
{
echo 'Hello Xinhu Cli';
}
//测试队列用的
public function testAction()
{
$rand = $this->getparams('rand');
$this->option->setval('asyntest', $rand);
return 'success';
}
//http://192.168.1.104/app/xinhu/task.php?m=cli&a=urltest
public function urltestAction()
{
$id = $this->get('id');
$id2 = $this->get('id2');
echo $id2;
echo '------';
echo $id;
}
/**
* (异步用)REIM即时通讯平台应用提醒
*/
public function reimplatsendAction()
{
$body = $this->getparams('body');
if(!$body)return;
$cans = json_decode($this->jm->base64decode($body),true);
return m('reimplat:agent')->sendxiao($cans['touid'],$cans['agentname'],$cans['wxarr'],true);
}
}

View File

@@ -0,0 +1,19 @@
<?php
class crmClassAction extends runtAction
{
//每天运行
public function runAction()
{
//客户合同到期
m('flow')->initflow('custract')->custractdaoqi();
//自动放入公海
m('flow')->initflow('customer')->addgonghai();
//计划跟进提醒
if(m('mode')->iscun('custplan'))m('flow')->initflow('custplan')->plantodo();
return 'success';
}
}

View File

@@ -0,0 +1,22 @@
<?php
class dayClassAction extends runtAction
{
//每天运行一次
public function runAction()
{
if($this->moderock('work'))m('flow')->initflow('work')->tododay(); //任务到期提醒
if($this->moderock('daiban'))m('flow')->initflow('daiban')->tododay(); //流程待办处理提醒
if($this->moderock('meet'))m('flow')->initflow('meet')->createmeet(); //会议生成
return 'success';
}
//http://127.0.0.1/app/xinhu/task.php?m=day|runt&a=getitle
public function getitleAction()
{
return TITLE;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 要用计划任务运行的,建议半小时运行一次
* php task.php email
*/
class emailClassAction extends runtAction
{
/**
* 自动接收邮件必须用cli运行的哦
*/
public function defaultAction()
{
$rows = $this->db->getall("select b.`id`,b.`name`,b.`email` from `[Q]option` a left join `[Q]admin` b on a.`optid`=b.`id` where b.`status`=1 and a.`num` like 'email_recexin_%' and ifnull(a.`value`,'')<>''");
$cg = $sb = 0;
$tzid = '';
$estr = '';
foreach($rows as $k=>$rs){
if(isempt($rs['email']))continue; //没设置邮箱
$uid = $rs['id'];
$this->rock->adminid = $uid;
$this->rock->adminname = '系统';
$barr = m('emailm')->receemail($uid);
if(is_array($barr)){
$cg+=$barr['count'];
if($barr['count']>0)$tzid.=','.$uid.'';
}else{
$estr.=''.$uid.'.'.$barr.';';
$sb++;
}
}
if($estr!='')m('log')->addlogs('收邮件', $estr, 2);
//发通知
if($tzid!=''){
$flow = m('flow')->initflow('emailm');
$flow->push(substr($tzid,1),'','有未读的新邮件,现在是'.$this->rock->now.',请进入邮件应用查看详情。','新邮件提醒', 0, array(
'wxurl' => $flow->getwxurl()
));
}
return 'success('.$cg.'),fail('.$sb.')';
}
/**
* curl异步发邮件
* php task.php email,anaysend -id=1 -stype=1
*/
public function anaysendAction()
{
$id = (int)$this->getparams('id','0');
$stype = (int)$this->getparams('stype','0');
$msg = m('email')->sendemailcont($id,$stype);
if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
return $msg;
}
}

View File

@@ -0,0 +1,23 @@
<?php
class flowClassAction extends runtAction
{
public function pipeiAction()
{
m('flow')->repipei();
return 'success';
}
//文件同步到上传中心
public function uptofileAction()
{
$fileid = (int)$this->getparams('fileid','0');
return c('rockfile')->uploadfile($fileid);
}
//上传中心同步删除
public function uptodeleteAction()
{
$filenum = $this->getparams('filenum');
return c('rockfile')->filedel($filenum);
}
}

View File

@@ -0,0 +1,113 @@
<?php
class hrClassAction extends runtAction
{
/*
* 员工合同到期提醒/人事每天调动运行
*/
public function httodoAction()
{
m('hr')->hrrun(); //人事每天调动/离职等运行
//员工合同到期提醒
$flow = m('flow')->initflow('userract');
$flow->updatestate();
$dtobj = c('date');
$dt = $this->rock->date;
$dt30 = $dtobj->adddate($dt,'d',35);
$rows = m('userract')->getall("state=1 and `enddt`<='$dt30'",'id,enddt,httype,name,uname');
$str = '';
foreach($rows as $k=>$rs){
$jg = $dtobj->datediff('d', $dt, $rs['enddt']);
if($jg==30 || $jg<=7){
$str.='人员['.$rs['uname'].']的【'.$rs['httype'].'.'.$rs['name'].'】将在'.$jg.'天后的'.$rs['enddt'].'到期;';
}
}
if($str != ''){
$this->todoarr = array(
'modenum' => 'userract',
'agentname' => '员工合同',
'title' => '员工合同到期提醒',
'cont' => $str,
);
}
//生日提醒
m('flow')->initflow('userinfo')->birthdaytodo();
//自动从考核项目中添加
m('flow')->initflow('hrcheck')->hrkaohemrun();
//个人资料完善提醒
return 'success';
}
//转正的
private function updatepositive($timess)
{
$db = m('hrpositive');
$rows = $db->getall("`status`=1 and `isover`=0",'`id`,`uid`,`entrydt`,`syenddt`,`positivedt`');
foreach($rows as $k=>$rs){
if(strtotime($rs['positivedt']) <= $timess){
$bo = m('userinfo')->update(array(
'state' => '1',
'syenddt' => $rs['syenddt'],
'positivedt' => $rs['positivedt'],
), $rs['uid']);
if($bo)$db->update("`isover`=1", $rs['id']);
}
}
}
//离职的
private function updatehrredund($timess)
{
$db = m('hrredund');
$rows = $db->getall("`status`=1 and `isover`=0",'`id`,`uid`,`quitdt`');
$timess = $timess - 24*3600;//昨天
foreach($rows as $k=>$rs){
if(strtotime($rs['quitdt']) <= $timess){
$bo = m('userinfo')->update(array(
'state' => '5',
'quitdt' => $rs['quitdt']
), $rs['uid']);
m('admin')->update(array(
'quitdt' => $rs['quitdt']
), $rs['uid']);
if($bo)$db->update("`isover`=1", $rs['id']);
}
}
}
//调动的
private function updatehrtransfer($timess)
{
$db = m('hrtransfer');
$mdb = m('admin');
$rows = $db->getall("`status`=1 and `isover`=0",'`id`,`uid`,`effectivedt`,`newdeptid`,`tranuid`,`newdeptname`,`newranking`');
$uids = '0';
foreach($rows as $k=>$rs){
if(strtotime($rs['effectivedt']) <= $timess){
$uid = $rs['tranuid'];
$bo = $mdb->update(array(
'deptid' => $rs['newdeptid'],
'deptname' => $rs['newdeptname'],
'ranking' => $rs['newranking'],
), $uid);
if($bo){
$db->update("`isover`=1", $rs['id']);
$uids.=','.$uid;
}
}
}
if($uids != '0')$mdb->updateinfo("and `id` in($uids)");
}
}

View File

@@ -0,0 +1,87 @@
<?php
class kaoqinClassAction extends runtAction
{
/**
* 定时任务发送昨天考勤异常的啊
*/
public function todoAction()
{
$dt = date('Y-m-d', time()-3600*20);//昨天
$sql = "SELECT a.uid FROM `[Q]kqanay` a left join `[Q]userinfo` b on a.uid=b.id where a.dt='$dt' and b.iskq=1 and a.state<>'正常' and a.states is null and a.iswork=1 group by a.uid;";
$rows = $this->db->getall($sql);
$ids = '';
foreach($rows as $k=>$rs){
$ids .=','.$rs['uid'].'';
}
if($ids!=''){
$flow = m('flow')->initflow('leavehr');
$flow->push(substr($ids, 1),'考勤','昨天['.$dt.']的你考勤存在异常,此消息仅供参考!','考勤异常提醒');
}
return 'success';
}
public function anayAction()
{
$dt = date('Y-m-d', time()-3600*20);//昨天
m('kaoqin')->kqanayalldt($dt);
return 'success';
}
//每月分析上月
public function lmanayAction()
{
$month = c('date')->adddate($this->rock->date, 'm', -1,'Y-m');
m('kaoqin')->kqanayall($month);
return 'success';
}
//分析工作日报统计
public function dailyfxAction()
{
$dt = c('date')->adddate($this->rock->date, 'd', -1);
$flow = m('flow')->initflow('daily');
$flow->dailyanay(0, $dt);
$flow->dailytodo($dt); //未写日报通知
return 'success';
}
public function dayAction()
{
m('flow:leave')->autoaddleave(); //年假自动添加
return 'success';
}
//定时从企业微信/钉钉上获取打卡记录一般30分钟获取一次
public function getdkAction()
{
$h = (int)date('H');
if($h>=2 && $h<=6)return '凌晨2-6点暂停读取';
$reimbo = m('reim');
$uids = '';//全部
$dt1 = '';
$dt2 = '';
$msg = 'success';
if($reimbo->installwx(1)){
$barr = m('weixinqy:daka')->getrecord($uids, $dt1, $dt2, 1);
//加入异步
if($uids=='' && $barr['errcode']==0 && $barr['maxpage']>1){
for($i=1;$i<=$barr['maxpage'];$i++){
if($i>1)$reimbo->asynurl('asynrun','wxdkjl', array(
'dt1' => $dt1,
'dt2' => $dt2,
'page' => $i
));
}
}
if($barr['errcode']!=0)$msg .= ',企业微信('.$barr['msg'].')';
}
//钉钉
if($reimbo->installwx(2)){
$barr = m('dingding:daka')->getrecord($uids, $dt1, $dt2);
if($barr['errcode']!=0)$msg .= ',钉钉('.$barr['msg'].')';
}
return $msg;
}
}

View File

@@ -0,0 +1,33 @@
<?php
class minute5ClassAction extends runtAction
{
public function runAction()
{
$time = time();
$time1 = $time;
$time2 = $time1+5*60;
$time3 = $time1-5*60;
$this->startdt = date('Y-m-d H:i:s', $time1);
$this->enddt = date('Y-m-d H:i:s', $time2);
$this->enddtss = date('Y-m-d H:i:s', $time3);
$this->scheduletodo();
m('flowbill')->autocheck(); //自动审批作废
m('reim')->chatpushtowx($this->enddtss); //REIM消息
return 'success';
}
private function scheduletodo()
{
$to = m('mode')->rows("`num`='schedule' and `status`=1");
if($to==1)m('schedule')->gettododata();//日程
$to = m('mode')->rows("`num`='remind' and `status`=1");
if($to==1)m('remind')->todorun();//单据
$to = m('mode')->rows("`num`='meet' and `status`=1");
if($to==1)m('flow')->initflow('meet')->meettodo(); //会议提醒的
}
}

View File

@@ -0,0 +1,127 @@
<?php
/**
* 文件同步上传到腾讯云存储/阿里云oss两个都配置只上传到腾讯云存储。
*
*/
class qcloudCosClassAction extends runtAction
{
/**
* 发送上传文件
* php task.php qcloudCos,run -fileid=1
* http://你地址/task.php?m=qcloudCos|runt&a=run&fileid=文件id
*/
public function runAction()
{
if(!getconfig('qcloudCos_SecretKey') && !getconfig('alioss_keysecret'))return '未配置存储';
$fileid = (int)$this->getparams('fileid','0'); //文件ID
if($fileid<=0)return 'error fileid';
$frs = m('file')->getone($fileid);
if(!$frs)return 'filers not found';
$filepath = $frs['filepath'];
if(substr($filepath, 0, 4)=='http')return 'filepath is httppath';
$nfilepath = '';
if(substr($filepath,-6)=='uptemp'){
$aupath = ROOT_PATH.'/'.$filepath;
$nfilepath = str_replace('.uptemp','.'.$frs['fileext'].'', $filepath);
$content = file_get_contents($aupath);
$this->rock->createtxt($nfilepath, base64_decode($content));
unlink($aupath);
$filepath = $nfilepath;
}
$msg = $this->sendpath($filepath, $frs, 'filepathout');
if($nfilepath && file_exists($nfilepath))unlink($nfilepath);
if($msg)return $msg;
$thumbpath = $frs['thumbpath'];
if(!isempt($thumbpath)){
$msg = $this->sendpath($thumbpath, $frs, 'thumbplat');
if($msg)return $msg;
}
return 'success';
}
private function sendpath($filepath, $frs, $fields)
{
$path = ROOT_PATH.'/'.$filepath;
if(!file_exists($path))return 'filepath['.$fields.'] not exists';
if(getconfig('qcloudCos_autoup')){
$res = c('qcloudCos')->upload($path,'', $filepath);
}else{
if(getconfig('alioss_autoup')){
$res = c('alioss')->uploadFile($filepath);
if(!$res['success'])$res['message'] = $res['msg'];
}
}
if($res['code']==0){
$data = $res['data'];
$bo = m('file')->update("`$fields`='".$res['url']."'", $frs['id']);
if($bo)@unlink($path);//删除文件
if(PHP_SAPI != 'cli')print_r($res);
}else{
return $res['code'].'.'.$res['message'];
}
}
/**
* 下载文件,预览用到
* php task.php qcloudCos,down -fileid=1
*/
public function downAction()
{
$fileid = (int)$this->getparams('fileid','0'); //文件ID
if($fileid<=0)return 'error fileid';
$fobj = m('file');
$frs = $fobj->getone($fileid);
if(!$frs)return 'filers not found';
$filepathout = $frs['filepathout'];
if(isempt($filepathout))return 'filepathout is empty';
//$filepathout = str_replace('//');
$filepath = $frs['filepath'];
$fileext = $frs['fileext'];
$dstPath = ROOT_PATH.'/'.$filepath;
if(file_exists($dstPath)){
return ''.$dstPath.' exists';
}
$filepath = ''.UPDIR.'/logs/costmp/'.date('YmdHis').'a'.$fileid.'.'.$fileext.'';//用临时文件
$dstPath = ROOT_PATH.'/'.$filepath;
$this->rock->createdir($filepath);
$res = returnerror('error');
$res['message'] = '';
//腾讯云的存储
if(contain($filepathout,'myqcloud.com')){
$fsarr = explode('myqcloud.com', $filepathout);
$srcPath = substr($fsarr[1],1);
$res = c('qcloudCos')->download($srcPath, $dstPath);
}
//腾讯云的存储
if(contain($filepathout,'aliyuncs.com')){
$fsarr = explode('aliyuncs.com', $filepathout);
$srcPath = substr($fsarr[1],1);
$res = c('alioss')->download($srcPath, $dstPath);
if(!$res['success'])$res['message'] = $res['msg'];
}
if($res['code']==0 && file_exists($dstPath)){
if(!c('upfile')->issavefile($fileext)){
$filebase64 = base64_encode(file_get_contents($dstPath));
$filepath = str_replace('.'.$fileext.'','.uptemp', $filepath);
$bo = $this->rock->createtxt($filepath, $filebase64);
@unlink($dstPath);
}
$fobj->update("`filepath`='$filepath'", $fileid);
}else{
$msg = ''.$frs['filename'].',无法下载('.$res['code'].')'.$res['message'].'';
m('log')->addlogs('存储下载',$msg,2);
}
return $res['code'].'.'.$res['message'].'@'.$filepath.'@'.$srcPath;
}
}

View File

@@ -0,0 +1,192 @@
<?php
/**
* 计划任务用的程序
*/
class runtAction extends ActionNot
{
public $runid = 0;
public $queuelogid = 0;
public $runrs = array();
public $splitlast = 0; //距离上次提醒秒数0上次没有运行
public $todoarr = array();
public function initAction()
{
$this->display = false;
ob_start(); //打开缓冲区
$this->runid = (int)$this->getparams('runid','0');
$this->queuelogid = (int)$this->getparams('queuelogid','0');
$this->initTask($this->runid);
}
public function initTask($runid)
{
if($runid==0)return;
$this->runid = $runid;
$this->runrs = m('task')->getone($this->runid);
if($this->runrs && !isempt($this->runrs['lastdt'])){
$this->splitlast = time() - strtotime($this->runrs['lastdt']);
}
}
public function taskAfter()
{
//提醒的
$todoid = arrvalue($this->runrs,'todoid');
if(!isempt($todoid) && $this->todoarr){
$modenum = arrvalue($this->todoarr, 'modenum');
$agentname = arrvalue($this->todoarr, 'agentname');
$title = arrvalue($this->todoarr, 'title');
$cont = arrvalue($this->todoarr, 'cont');
if(!isempt($modenum)){
$flow = m('flow')->initflow($modenum);
$flow->push($todoid, $agentname, $cont, $title);
}else{
m('todo')->add($todoid, $title, $cont);
}
}
}
//判断模块是否存在开启
public function moderock($num)
{
$to = m('flow_set')->rows("`num`='$num' and `status`=1");
return ($to>0);
}
/**
* 运行完成后判断运行状态
*/
public function afterAction()
{
if($this->runid > 0){
$state = 2;
$cont = ob_get_contents();
if($cont=='success')$state=1;
m('task')->update(array(
'lastdt' => $this->rock->now,
'lastcont' => $cont,
'state' => $state
), $this->runid);
$this->taskAfter();
}
if($this->queuelogid > 0){
$cont = ob_get_contents();
m('log')->update(array('result' => $cont), $this->queuelogid);
}
}
/**
* 获取cli上参数格式-key=val
*/
public function getparams($key, $dev='')
{
if(PHP_SAPI != 'cli'){
return $this->get($key, $dev);
}
$arr = arrvalue($GLOBALS, 'argv');
$sss = '';
if($arr)for($i=2;$i<count($arr);$i++){
$str = $arr[$i];
if(!isempt($str)){
$stra = explode('=', $str);
if($stra[0]=='-'.$key.''){
$sss = arrvalue($stra, 1);
break;
}
}
}
if(isempt($sss))$sss = $dev;
return $sss;
}
}
class runtClassAction extends runtAction
{
public function runAction()
{
$mid = (int)$this->get('mid','0');
m('task')->baserun($mid);
echo 'success';
}
public function getlistAction()
{
$dt = $this->get('dt', $this->date);
$barr = m('task')->getlistrun($dt);
$this->option->setval('systaskrun', $this->now);
$this->returnjson($barr);
}
/**
* 运行定时任务用于cli模式的建每5分钟运行一次
* Linux 使用crontab php task.php runt,task
* win 使用计划任务 php task.php runt,task
* 也可以每5分钟访问地址http://127.0.0.1/app/xinhu/task.php?m=runt&a=task
*/
public function taskAction()
{
$runtime = $this->getparams('runtime',time());
$rtype = $this->getparams('rtype'); //运行类型
$dbs = m('task');
if($rtype=='queue')$dbs->sendstarttask();
$yunarr = $dbs->runjsonlist($runtime);
$oi = $cg = $sb = 0;
foreach($yunarr as $k=>$rs){
$urllu = $rs['urllu'];
$taskid = (int)$rs['id'];
$state = 2;
$cont = '';
$oi++;
if(substr($urllu,0,4)=='http'){
$cont = c('curl')->getcurl($urllu);
}else{
$urla = explode(',', $urllu);
$path = ''.ROOT_PATH.'/'.P.'/task/runt/'.$urla[0].'Action.php';
if(file_exists($path)){
$act = arrvalue($urla, 1,'run').'Action';
include_once($path);
$class= ''.$urla[0].'ClassAction';
$obj = new $class();
$obj->initTask($taskid);
$cont = $obj->$act();
$obj->taskAfter();
}else{
$cont = ''.$urla[0].'Action.php not found';
}
}
if(contain($cont,'success')){
$state = 1;
$cg++;
}else{
$sb++;
}
$dbs->update(array(
'lastdt' => $this->rock->now,
'lastcont' => $cont,
'state' => $state
), $taskid);
}
return 'runtask('.$oi.'),success('.$cg.'),fail('.$sb.')';
}
//新服务端加载计划任务
public function taskgetAction()
{
m('task')->sendstarttask();
return 'taskget.'.time().'';
}
/**
* 初始化计划任务linux
* php task.php runt,taskinit
*/
public function taskinitAction()
{
$str1 = 'cd '.ROOT_PATH.''.chr(10).'php '.ROOT_PATH.'/task.php runt,task';
$spath= ''.UPDIR.'/cli/xinhutaskrun.sh';
file_put_contents($spath, $str1);
if(function_exists('exec'))exec('chmod 777 '.$spath.'');
echo 'xinhu taskinit success';
}
}

View File

@@ -0,0 +1,89 @@
<?php
class sysClassAction extends runtAction
{
//数据备份
public function beifenAction()
{
if(getconfig('systype')=='demo')return 'success';
m('beifen')->start();
$this->todoarr = array(
'title' => '数据库备份',
'cont' => '数据库在['.$this->now.']备份了。',
);
return 'success';
}
public function upgtxAction()
{
$xinhu = c('xinhu');
$db = m('chargems');
$lastdt = strtotime($this->runrs['lastdt']);
$barr = $xinhu->getdata('modeupg', array('lastdt'=>$lastdt));
if($barr['code']!=200)exit($barr['msg']);
$str = '';
foreach($barr['data'] as $k=>$rs){
$id = $rs['id'];
$na = $rs['name'];
$state = 0;
$ors = $db->getone("`type`=0 and `mid`='$id'");
if($ors){
$state = 1;
if($rs['updatedt']>$ors['updatedt'])$state=2;
}
if($state==0)$str.='模块['.$na.']可安装;';
if($state==2)$str.='模块['.$na.']可<font color=red>升级</font>;';
}
if($str!=''){
$this->todoarr = array(
'title' => '安装升级',
'cont' => $str.'请到[系统→系统工具→系统升级]下处理',
);
}
return 'success';
}
//数据更新,更新用户的
//命令就是php task.php sys,dataup -runid=6
public function dataupAction()
{
m('admin')->updateinfo(); //更新人员
m('imgroup')->updategall(); //更新会话组
$reim = m('reim');
if($reim->installwx(1))m('weixinqy:user')->getuserlist();
return 'success';
}
/**
* 清理数据
*/
public function clearAction()
{
$date1 = date('Y-m-d', time()-30*24*3600); //30天前
$date2 = date('Y-m-d', time()-6*30*24*3600); //半年前
$date3 = date('Y-m-d', time()-3*30*24*3600); //3个月
$month3 = date('Y-m', time()-3*30*24*3600); //3个月
$kqclear = (int)$this->option->getval('kqcleartime','0');
$alltabls = $this->db->getalltable();
if($kqclear>0){
$date4 = date('Y-m-d', time()-$kqclear*30*24*3600);
if(in_array(''.PREFIX.'kqdkjl', $alltabls))
m('kqdkjl')->delete("`dkdt`<='$date4 23:59:9'"); //打卡记录
}
m('log')->delete("`optdt`<'$date3 23:59:59'"); // 日志3个月
m('logintoken')->delete("`moddt`<'$date1 23:59:59'"); // token1个月
if(in_array(''.PREFIX.'kqjcmd', $alltabls))
m('kqjcmd')->delete("`optdt`<'$date1 23:59:59'"); //考勤机命令
if(in_array(''.PREFIX.'kqanay', $alltabls))
m('kqanay')->delete("`dt`<'$date3'"); //考勤分析
if(in_array(''.PREFIX.'dailyfx', $alltabls))
m('dailyfx')->delete("`month`<'$month3'"); //日志分析
//更多清理自己添加
return 'success';
}
}

View File

@@ -0,0 +1,130 @@
<?php
/**
* 语音通话
*
*/
class tonghuaClassAction extends runtAction
{
public function sendcpush($arr)
{
$arr['msgtype'] = 'calltonghua';
$arr['type'] = 'calltonghua';
$reimobj = m('reim');
$reimobj->pushserver('sendapp', $arr);
$reimobj->pushserver('send', $arr);
}
/**
* 呼叫发送
* http://192.168.1.2/app/xinhu/task.php?m=tonghua|runt&a=call&key=d9ydh2d8
*/
public function callAction()
{
$key = $this->getparams('key');
$cishu = (int)$this->getparams('cishu','1');
if($cishu>=15)return;
if(!$key)return;
$data = c('cache')->get($key);
if(!$data)return;
$channel = $data['channel'];
$uid = $data['uid'];
$urs = m('admin')->getone($uid);
$thrs = m('im_tonghua')->getone("`channel`='$channel'");
if(!$thrs)return;
if($thrs['state']>0)return;
$this->rock->adminid = $uid;
$this->rock->adminname = $urs['name'];
//每3秒呼叫一次
$this->sendcpush(array(
'adminid' => $uid,
'adminname' => $urs['name'],
'adminface' => m('admin')->getface($urs['face']),
'th_type' => $data['type'],
'calltype' => 'call',
'th_channel' => $channel,
'th_appid' => $data['appid'],
'th_time' => time()-strtotime($thrs['adddt']),
'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';
}
/**
* 取消呼叫
*/
public function cancelAction()
{
$key = $this->getparams('key');
$data = c('cache')->get($key);
if(!$data)return;
$channel = $data['channel'];
$this->sendcpush(array(
'adminid' => $data['uid'],
'calltype' => 'cancel',
'receid' => $data['toid']
));
return 'success';
}
/**
* 拒接/同意
*/
public function jieAction()
{
$key = $this->getparams('key');
$state = (int)$this->getparams('state','2');
$nowtime = $this->getparams('nowtime');
$uid = (int)$this->getparams('uid','0');
$data = c('cache')->get($key);
if(!$data)return;
$channel = $data['channel'];
$tayar = array('','tongyi','jujue');
$this->sendcpush(array(
'adminid' => $data['toid'],
'calltype' => $tayar[$state],
'receid' => $data['uid'].','.$data['toid']
));
c('xinhuapi')->getdata('tonghua','jietongs', array('uid'=>$uid,'state'=>$state,'nowtime'=>$nowtime,'channel'=>$channel));
return 'success';
}
/**
* 结束通话
*/
public function jiesuAction()
{
$uid = (int)$this->getparams('uid');
$toid = (int)$this->getparams('toid');
$nowtime = $this->getparams('nowtime');
$channel = $this->getparams('channel');
$this->sendcpush(array(
'adminid' => $uid,
'calltype' => 'jiesu',
'receid' => $toid
));
return c('xinhuapi')->getdata('tonghua','jiesu', array('uid'=>$uid,'nowtime'=>$nowtime,'channel'=>$channel));
}
}

View File

@@ -0,0 +1,174 @@
<?php
/**
* 文件同步上传到文件平台
* php task.php uptoxinhudoc,run -fileid=1
*/
class uptoxinhudocClassAction extends runtAction
{
public function initAction()
{
exit('此文件已经不需要');
}
/**
* 发送上传文件
*/
public function runAction()
{
$fileid = (int)$this->getparams('fileid','0'); //文件ID
if($fileid<=0)return 'error fileid';
$frs = m('file')->getone($fileid);
if(!$frs)return 'filers not found';
$filepath = $frs['filepath'];
if(substr($filepath, 0, 4)=='http')return 'filepath is httppath';
$msg = $this->sendpath($filepath, $frs);
if($msg)return $msg;
return 'success';
}
private function sendpath($filepath, $frs)
{
$path = ROOT_PATH.'/'.$filepath;
if(!file_exists($path))return 'filepath not exists';
$lx = 'file';
if(getconfig('xinhudoc_diskops'))$lx='path';
$url = $this->upfileurl($lx);
//文件远程上传的
if($lx=='file'){
$data = base64_encode(file_get_contents($path));
$params = array(
'filename' => $frs['filename'],
'optname' => $frs['optname'],
'adddt' => $frs['adddt'],
'fileext' => $frs['fileext'],
'filesize' => $frs['filesize'],
'filepath' => $frs['filepath'],
'table' => ''.DB_BASE.'.file',
'mid' => $frs['id'],
'optid' => $frs['optid'],
);
$canstr = $this->jm->base64encode(json_encode($params));
$url .= '&sendtype=file&paramsstr='.$canstr.'';
$result = c('curl')->postcurl($url, $data);
$msg = $this->chuliresult($result, $frs, 1);
if(!$msg){
$this->sendother($frs['thumbpath'], 'thumb', $frs,2);
$this->sendother($frs['pdfpath'], 'pdf', $frs,3);
}
return $msg;
}
//同服务器用复制的
$result = c('curl')->postcurl($url, array(
'rootpath' => ROOT_PATH,
'filepath' => $frs['filepath'],
'fileext' => $frs['fileext'],
'filename' => $frs['filename'],
'filesize' => $frs['filesize'],
'pdfpath' => $frs['pdfpath'],
'thumbpath' => $frs['thumbpath'],
'optname' => $frs['optname'],
'adddt' => $frs['adddt'],
'table' => ''.DB_BASE.'.file',
'mid' => $frs['id'],
'optid' => $frs['optid'],
));
return $this->chuliresult($result, $frs, 0);
}
private function sendother($filepath, $type, $frs, $lx)
{
if(isempt($filepath))return;
$path = ROOT_PATH.'/'.$filepath;
if(!file_exists($path))return;
$url = $this->upfileurl('file');
$data = base64_encode(file_get_contents($path));
$params = array(
'filepath' => $filepath,
'table' => ''.DB_BASE.'.file',
'mid' => $frs['id'],
);
$canstr = $this->jm->base64encode(json_encode($params));
$url .= '&sendtype='.$type.'&paramsstr='.$canstr.'';
$result = c('curl')->postcurl($url, $data);
return $this->chuliresult($result, $frs, $lx);
}
private function chuliresult($result, $frs, $lx)
{
$barr = c('xinhudoc')->returnresult($result);
if($barr['success']){
$data = $barr['data'];
$uarr = array();
if($lx==0 || $lx==1){
$filenum = $data['filenum'];
$uarr['filenum'] = $filenum;
}
//缩略图必须保存对应路径
if($lx==0 || $lx==2){
$thumbpath = arrvalue($data, 'thumbpath');
if(!isempt($thumbpath)){
$uarr['thumbplat'] = '{PLATURL}'.$thumbpath;
}
}
//自动删除文件
if(getconfig('autoup_localdbool')){
if($lx==0 || $lx==1)$this->delfilelocal($frs['filepath']);
if($lx==0 || $lx==2)$this->delfilelocal($frs['thumbpath']);
if($lx==0 || $lx==3)$this->delfilelocal($frs['pdfpath']);
}
if($uarr)m('file')->update($uarr, $frs['id']); //更新
}else{
return $barr['msg'];
}
return '';
}
private function delfilelocal($path)
{
if(isempt($path))return;
$path = ROOT_PATH.'/'.$path;
if(file_exists($path))@unlink($path);
}
private function upfileurl($lx)
{
$url = c('xinhudoc')->geturlstr('upfile', $lx, array(
'updir' => getconfig('xinhudoc_upmkdir')
));
return $url;
}
/**
* 从管理平台上删除文件
*/
public function delAction()
{
$filenum = $this->getparams('filenum'); //文件ID
if(isempt($filenum))return 'filenum is empty';
$doc = c('xinhudoc');
$url = $doc->geturlstr('upfile', 'del', array(
'filenum' => $filenum
));
$result = c('curl')->getcurl($url);
$barr = $doc->returnresult($result);
if($barr['success']){
return $barr['data'];
}else{
return $barr['msg'];
}
}
}

View File

@@ -0,0 +1,9 @@
<?php
class workClassAction extends runtAction
{
public function todoAction()
{
return 'success';
}
}