信呼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,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;
}
}