信呼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,189 @@
<?php if(!defined('HOST'))die('not access');?>
<script >
$(document).ready(function(){
var a = $('#veiw_{rand}').bootstable({
tablename:'task',celleditor:true,modenum:'task',sort:'sort',dir:'asc',
columns:[{
text:'分类',dataIndex:'fenlei',editor:true,sortable:true
},{
text:'名称',dataIndex:'name',editor:true,align:'left'
},{
text:'地址',dataIndex:'url',editor:true
},{
text:'频率',dataIndex:'type',editor:true
},{
text:'运行时间',dataIndex:'time',editor:true
},{
text:'运行说明',dataIndex:'ratecont',editor:true
},{
text:'状态',dataIndex:'status',editor:true,type:'checkbox',editor:true,sortable:true
},{
text:'排序号',dataIndex:'sort',editor:true,sortable:true
},{
text:'最后运行',dataIndex:'lastdt',sortable:true,renderer:function(v){
return v.replace(' ','<br>');
}
},{
text:'最后状态',dataIndex:'state',renderer:function(v){
var s='<font color=#888888>待运行</font>';
if(v==1)s='<font color=green>成功</font>';
if(v==2)s='<font color=red>失败</font>';
return s;
}
},{
text:'最后内容',dataIndex:'lastcont'
},{
text:'说明',dataIndex:'explain',type:'textarea',editor:true,align:'left'
},{
text:'提醒给',dataIndex:'todoname'
},{
text:'ID',dataIndex:'id'
}],
itemclick:function(){
btn(false);
}
});
var c = {
del:function(){
a.del({check:function(lx){if(lx=='yes')btn(true)}});
},
clickwin:function(o1,lx){
var h = $.bootsform({
title:'计划任务',height:400,width:500,
tablename:'task',isedit:lx,
params:{int_filestype:'sort,status'},
submitfields:'fenlei,name,url,sort,status,type,time,ratecont,todoid,todoname',
items:[{
labelText:'分类',name:'fenlei',required:true
},{
labelText:'名称',name:'name',required:true
},{
labelText:'运行地址',name:'url',required:true
},{
labelText:'频率',name:'type',required:true
},{
labelText:'运行时间',name:'time',required:true
},{
labelText:'说明',name:'ratecont'
},{
name:'status',labelBox:'启用',type:'checkbox',checked:true
},{
name:'todoid',type:'hidden'
},{
labelText:'通知给',type:'changeuser',changeuser:{
type:'usercheck',idname:'todoid',title:'选择人员'
},name:'todoname',clearbool:true
},{
labelText:'序号',name:'sort',type:'number',value:'0'
}],
success:function(){
a.reload();
}
});
if(lx==1){
h.setValues(a.changedata);
}
h.getField('name').focus();
},
refresh:function(){
a.reload();
},
creaefile:function(){
js.msg('wait','创建中...');
js.ajax(js.getajaxurl('creaefile','{mode}','{dir}'),{},function(s){
js.msg('success','创建成功');
});
},
yunx:function(){
if(a.changedata.status!=1){
js.msg('msg','没有启用不能运行');
return;
}
js.msg('wait','运行中...');
var url='task.php?m=runt&a=run&mid='+a.changeid+'';
var ase = a.changedata.url.split(',');
var url='task.php?m='+ase[0]+'|runt&a='+ase[1]+'&runid='+a.changeid+'';
js.ajax(url,{},function(s){
if(s.indexOf('success')>=0){
if(s!='success'){
js.msg();
js.alert(jm.base64decode('6L!Q6KGM5oiQ5Yqf77yM6ICM5L2g5Y!v6IO955So6K6w5LqL5pys5L!u5pS557O757uf5paH5Lu25LqG77yM6K!35Yiw5L!h5ZG85a6Y572R5pCc57Si4oCc6K6w5LqL5pys4oCd5p!l55yL5biu5Yqp'));
}else{
js.msg('success','运行成功');
}
a.reload();
}else{
js.msg('msg','运行失败:'+s+'');
}
});
},
start:function(lx){
js.msg('wait','处理中...');
js.ajax(js.getajaxurl('starttask','{mode}','{dir}'),{lx:lx},function(ret){
if(ret.success){
js.msg('success', ret.data);
}else{
js.msg('msg', ret.msg);
}
},'get,json');
},
clearzt:function(){
js.msg('wait','清空中...');
js.ajax(js.getajaxurl('clearzt','{mode}','{dir}'),{},function(s){
js.msg();
a.reload();
});
},
openanz:function(){
js.open(js.getajaxurl('downbat','{mode}','{dir}'));
},
openqueue:function(){
js.open('?a=queue&m=task&d=system');
},
qidong:function(){
this.start(0);
}
};
function btn(bo){
if(ISDEMO)return;
get('del_{rand}').disabled = bo;
get('edit_{rand}').disabled = bo;
get('yun_{rand}').disabled = bo;
}
js.initbtn(c);
});
</script>
<div>
<table width="100%"><tr>
<td nowrap>
<button class="btn btn-primary" click="clickwin,0" type="button"><i class="icon-plus"></i> 新增</button> &nbsp;
<button class="btn btn-default" click="refresh" type="button"><i class="icon-refresh"></i> 刷新</button> &nbsp;
<button class="btn btn-default" click="clearzt" type="button">清空状态</button> &nbsp;
<?php if(!COMPANYNUM){?>
<button class="btn btn-success" click="qidong" type="button"><i class="icon-stop"></i> 启动计划任务</button>
<?php }?>
</td>
<?php if(!COMPANYNUM){?>
<td width="80%">&nbsp;&nbsp;<a href="javascipt:;" click="openanz">[查看计划任务安装]</a>&nbsp;&nbsp;<a href="javascipt:;" click="openqueue">[计划任务队列]</a>&nbsp;&nbsp;<a href="<?=URLY?>view_taskrun.html"target="_blank">[帮助]</a></td>
<?php }?>
<td align="right" nowrap>
<button class="btn btn-default" id="yun_{rand}" click="yunx" disabled type="button">运行</button> &nbsp;
<button class="btn btn-danger" id="del_{rand}" click="del" disabled type="button"><i class="icon-trash"></i> 删除</button> &nbsp;
<button class="btn btn-info" id="edit_{rand}" click="clickwin,1" disabled type="button"><i class="icon-edit"></i> 编辑 </button>
</td>
</tr>
</table>
</div>
<div class="blank10"></div>
<div id="veiw_{rand}"></div>
<div class="tishi">提示:执行地址如[sys,beifen]也就是运行webmain/task/runt/sysAction.php文件的beifenAction方法以此类推。频率d每天,i分钟,w周,m月,y年,h小时</div>

View File

@@ -0,0 +1,89 @@
<?php
//计划任务列表控制器
class taskClassAction extends Action
{
public function getrunlistAjax()
{
$barr = m('task')->getlistrun($this->date);
$this->returnjson($barr);
}
public function starttaskAjax()
{
$lx = (int)$this->get('lx','0');
$tobj = m('task');
$tobj->cleartask();
if($lx==0){
$carr = $tobj->pdlocal();
if(!$carr['success'])return $carr;
$barr = $tobj->starttask();
if($barr['success']){
return returnsuccess('启动成功');
}else{
return returnsuccess('无法启动可能未开启服务端:'.$barr['msg'].'');
}
}else{
if($lx==1){
$barr = c('xinhuapi')->starttask();
if($barr['success'])$barr['data'] = '已通过官网服务开启计划任务';
}
if($lx==2){
$barr = c('xinhuapi')->stoptask();
if($barr['success'])$barr['data'] = '已停止使用官网计划任务';
}
return $barr;
}
}
public function clearztAjax()
{
m('task')->update('state=0,lastdt=null,lastcont=null','1=1');
}
public function downbatAjax()
{
$ljth = str_replace('/','\\',ROOT_PATH);
echo '<title>计划任务开启方法</title>';
echo '<font color="red">如您有安装信呼服务端,就不用根据下面来开启计划任务了</font><br><a target="_blank" style="color:blue" href="'.URLY.'view_taskrun.html">查看官网上帮助</a><br>';
echo '计划任务的运行时间需要设置为5的倍数才可以运行到。<br>';
echo '一、<b>Windows服务器</b>,可根据以下设置定时任务<br>';
$str1 = '@echo off
cd '.$ljth.'
'.getconfig('phppath','php').' '.$ljth.'\task.php runt,task';
$this->rock->createtxt(''.UPDIR.'/cli/xinhutaskrun.bat', $str1);
echo '1、打开系统配置文件webmainConfig.php加上一个配置phppath设置php环境的目录地址如F:\php\php-5.6.22\php.exe设置好了刷新本页面。<br>';
echo '<div style="background:#caeccb;padding:5px;border:1px #888888 solid;border-radius:5px;">';
echo "return array(<br>'title' =>'信呼OA',<br>'phppath' => 'F:\php\php-5.6.22\php.exe' <font color=#aaaaaa>//加上这个路径如果有空格请加入环境变量这个设置为php即可</font><br>)";
echo '</div>';
echo '2、在您的win服务器上开始菜单→运行 输入 cmd 回车(管理员身份运行),输入以下命令(每5分钟运行一次)<br>';
echo '<div style="background:#caeccb;padding:5px;border:1px #888888 solid;border-radius:5px;">';
echo 'schtasks /create /sc DAILY /mo 1 /du "24:00" /ri 5 /sd "2017/04/01" /st "00:00:05" /tn "信呼计划任务" /ru System /tr '.$ljth.'\\'.UPDIR.'\cli\xinhutaskrun.bat';
echo '</div>';
$str1 = 'cd '.ROOT_PATH.''.chr(10).'php '.ROOT_PATH.'/task.php runt,task';
$spath= ''.UPDIR.'/cli/xinhutaskrun.sh';
$this->rock->createtxt($spath, $str1);
echo '<br>二、<b>Linux服务器</b>,可用根据以下设置定时任务<br>';
echo '根据以下命令设置运行:<br>';
echo '<div style="background:#caeccb;padding:5px;border:1px #888888 solid;border-radius:5px;"><font color=blue>chmod</font> 777 '.ROOT_PATH.'/'.$spath.'<br>';
echo '<font color=blue>crontab</font> -e<br>';
echo '#信呼计划任务每5分钟运行一次<br>';
echo '*/5 * * * * '.ROOT_PATH.'/'.$spath.'</div>';
echo '<br><br>三、<b>浏览器窗口运行</b>,用于你的是虚拟主机没办法管理服务器时<br>';
echo '打开<a href="?m=task&a=queue&d=system" style="color:blue">[计划任务队列]</a> 来启用计划任务。<br>';
}
public function queueAction()
{
$this->title = '计划任务队列';
$tasklist = m('task')->getrunlist('',1);
$this->smartydata['tasklist'] = $tasklist;
}
}

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$da['title']?></title>
<link rel="stylesheet" type="text/css" href="<?=$da['p']?>/css/css.css"/>
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<style>
</style>
</head>
<body>
<div style="padding:10px">
<div><font color="red">长时间打开这个页面,不关闭,也可以达到开启计划任务功能。</font></div>
<div>以下是待运行任务共<span id="allshu">(<?=count($da['tasklist'])?>)</span>条,现在是:<span id="nowdate"><?=$rock->now?></span></div>
<?php
foreach ($da['tasklist'] as $k=>$rs){
$oi = $k+1;
$runtimes = date('Y-m-d H:i:s', $rs['runtime']);
$da['tasklist'][$k]['runtimes'] = $runtimes;
$runtimesa = explode(' ', $runtimes);
echo '<div oi="'.$oi.'" style="padding:2px">'.$oi.'、['.$runtimesa[1].']'.$rs['name'].',&nbsp;<span id="zt_'.$oi.'"><font color="#888888">(待运行)</font></span></div>';
}
?>
</div>
<script>
var tasklist = <?=json_encode($da['tasklist'])?>;
var nowoi = 0;
var nowdt = '';
var alloi = tasklist.length;
function startrun(){
var now = js.now('now');
var nowa = now.split(' '),bstdt = nowa[0];
if(nowdt=='')nowdt = bstdt;
var i,d,url;
$('#nowdate').html(now);
var suxh = nowoi;
for(i= nowoi;i<nowoi+10;i++){
d = tasklist[i];
if(d && d.runtimes==now){
url = d.url.split('task.php');
if(url.length==2){
url = 'task.php'+url[1];
}else{
url = d.url;
}
runrurl(url, i);
suxh = i;
alloi--;
}
}
nowoi = suxh;
$('#allshu').html('('+alloi+')');
//到了第二天了就要刷新喽
if(nowdt != bstdt){
location.reload();
}
setTimeout('startrun()',1000);
}
function runrurl(url, i){
var oi = i+1;
var o = $('#zt_'+oi+'');
o.html('<font color="#ff6600">运行中</font>');
$.get(url, function(s){
if(s=='success'){
o.html('<font color="green">运行成功</font>');
}else{
o.html('<font color="red">运行失败</font>');
}
});
}
startrun();
</script>
</body>
</html>