信呼OA版本v2.3.8
This commit is contained in:
57
webmain/task/runt/beifenAction.php
Normal file
57
webmain/task/runt/beifenAction.php
Normal 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';
|
||||
}
|
||||
|
||||
}
|
||||
10
webmain/task/runt/carmAction.php
Normal file
10
webmain/task/runt/carmAction.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
class carmClassAction extends runtAction
|
||||
{
|
||||
//车辆提醒,每天运行
|
||||
public function runAction()
|
||||
{
|
||||
return m('flow')->initflow('carms')->todocarms($this->runrs['todoid']);
|
||||
}
|
||||
|
||||
}
|
||||
43
webmain/task/runt/cliAction.php
Normal file
43
webmain/task/runt/cliAction.php
Normal 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);
|
||||
}
|
||||
}
|
||||
19
webmain/task/runt/crmAction.php
Normal file
19
webmain/task/runt/crmAction.php
Normal 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';
|
||||
}
|
||||
|
||||
}
|
||||
22
webmain/task/runt/dayAction.php
Normal file
22
webmain/task/runt/dayAction.php
Normal 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;
|
||||
}
|
||||
}
|
||||
57
webmain/task/runt/emailAction.php
Normal file
57
webmain/task/runt/emailAction.php
Normal 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;
|
||||
}
|
||||
}
|
||||
23
webmain/task/runt/flowAction.php
Normal file
23
webmain/task/runt/flowAction.php
Normal 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);
|
||||
}
|
||||
}
|
||||
113
webmain/task/runt/hrAction.php
Normal file
113
webmain/task/runt/hrAction.php
Normal 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)");
|
||||
}
|
||||
}
|
||||
87
webmain/task/runt/kaoqinAction.php
Normal file
87
webmain/task/runt/kaoqinAction.php
Normal 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;
|
||||
}
|
||||
}
|
||||
33
webmain/task/runt/minute5Action.php
Normal file
33
webmain/task/runt/minute5Action.php
Normal 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(); //会议提醒的
|
||||
}
|
||||
|
||||
}
|
||||
127
webmain/task/runt/qcloudCosAction.php
Normal file
127
webmain/task/runt/qcloudCosAction.php
Normal 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;
|
||||
}
|
||||
}
|
||||
192
webmain/task/runt/runtAction.php
Normal file
192
webmain/task/runt/runtAction.php
Normal 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';
|
||||
}
|
||||
}
|
||||
89
webmain/task/runt/sysAction.php
Normal file
89
webmain/task/runt/sysAction.php
Normal 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';
|
||||
}
|
||||
}
|
||||
130
webmain/task/runt/tonghuaAction.php
Normal file
130
webmain/task/runt/tonghuaAction.php
Normal 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));
|
||||
}
|
||||
}
|
||||
174
webmain/task/runt/uptoxinhudocAction.php
Normal file
174
webmain/task/runt/uptoxinhudocAction.php
Normal 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¶msstr='.$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.'¶msstr='.$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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
9
webmain/task/runt/workAction.php
Normal file
9
webmain/task/runt/workAction.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class workClassAction extends runtAction
|
||||
{
|
||||
public function todoAction()
|
||||
{
|
||||
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user