|
@@ -11,16 +11,12 @@ Class Cron
|
|
|
foreach ($data as $k => $v) {
|
|
|
$group_id = explode(',',$v['group']);
|
|
|
$admin = Dever::db('manage/admin')->find($group_id[1]);
|
|
|
- $content = $this->email_api($v);
|
|
|
- $this->send($admin['email'], $admin['username'], $title, $content);
|
|
|
+ $content = $this->email_api($v,$admin);
|
|
|
+ $this->send($admin['email'], $admin['username'], $title, $content);
|
|
|
}
|
|
|
- // $content = $this->email_api();
|
|
|
- // foreach($admin as $key => $val){
|
|
|
- // $this->send($val['email'], $val['username'], $title, $content);
|
|
|
- // }
|
|
|
}
|
|
|
#发送邮件
|
|
|
- public function email_api($v)
|
|
|
+ public function email_api($v,$fsadmin)
|
|
|
{
|
|
|
$start=mktime(0,0,0,date('m'),date('d'),date('Y'))-86400;
|
|
|
$end = $start+86400-1;
|
|
@@ -30,9 +26,6 @@ Class Cron
|
|
|
$question = array_keys($question);
|
|
|
$data['info']['app'] = Dever::db('work/info')->getCount(array('question'=>$question,'end'=>$end));
|
|
|
$data['info']['xu'] = Dever::db('work/info')->getCount(array('group'=>$data['branch']['group_id'],'end'=>$end,'status'=>2));
|
|
|
- // $app = Dever::db('work/appoint')->getYAll(array('group'=>$data['branch']['group_id']));
|
|
|
- // $app = array_keys($app);
|
|
|
- // $data['info']['yi'] = Dever::db('work/info')->getCount(array('id'=>$app,'end'=>$end,'status'=>'3,4'));
|
|
|
$admin = explode(',',$data['branch']['group']);
|
|
|
if ($data['branch']['coor']) {
|
|
|
$coor = explode(',',$data['branch']['coor']);
|
|
@@ -45,15 +38,12 @@ Class Cron
|
|
|
$people = $admin[1];
|
|
|
}
|
|
|
$data['info']['yi'] = Dever::db('work/info')->getCount(array('fpeople'=>$people,'end'=>$end,'status'=>'3,4'));
|
|
|
- // echo Dever::sql();die;
|
|
|
- // $data['info']['wei'] = Dever::db('work/info')->getCount(array('group'=>$data['branch']['group_id'],'start'=>$start,'end'=>$end,'status'=>4));
|
|
|
|
|
|
$data['question'] = Dever::db('work/question')->getAll(array('branch_id'=>$data['branch']['group_id']));
|
|
|
$question = implode(',',$question);
|
|
|
// print_R($question);die;
|
|
|
$data['app'] = Dever::db('work/info')->fetchAll('select * from churen_work_info where (`group` in ('.$data['branch']['group_id'].') or fpeople in ('.$people.') or question in ('.$question.')) and cdate <='.$end.' and state = 1');
|
|
|
- // getAll(array('group'=>$data['branch']['group_id'],'end'=>$end));
|
|
|
- // print_R($data);die;
|
|
|
+
|
|
|
foreach ($data['app'] as $k1 => $v1) {
|
|
|
$data['app'][$k1]['cdate'] = date('Y-m-d H:i:s',$v1['cdate']);
|
|
|
$data['app'][$k1]['zhipai'] = date('Y-m-d H:i:s',$v1['zdate']);
|
|
@@ -64,6 +54,13 @@ Class Cron
|
|
|
$data['app'][$k1]['priority_name'] = $priority['name'];
|
|
|
$data['app'][$k1]['status']= Dever::status($config,$v1['status']);
|
|
|
}
|
|
|
+ $msg = array();
|
|
|
+ $msg['admin_email'] = $fsadmin['email'];
|
|
|
+ $msg['admin_username'] = $fsadmin['username'];
|
|
|
+ $msg['app'] = $data['info']['app'];
|
|
|
+ $msg['xu'] = $data['info']['xu'];
|
|
|
+ $msg['yi'] = $data['info']['yi'];
|
|
|
+ $res = Dever::log($msg, 'work');
|
|
|
return Dever::render('email', $data);
|
|
|
}
|
|
|
|
|
@@ -142,4 +139,65 @@ Class Cron
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ public function user_api()
|
|
|
+ {
|
|
|
+ $num = Dever::input('num', 1);
|
|
|
+ $start = Dever::input('start', date('Y-m-d', strtotime('-'.$num.' day')));
|
|
|
+ $end = Dever::input('end', date('Y-m-d'));
|
|
|
+
|
|
|
+ $start = Dever::maketime($start . ' 00:00:00');
|
|
|
+ $end = Dever::maketime($end . ' 23:59:59');
|
|
|
+ $day = intval(($end - $start)/86400);
|
|
|
+
|
|
|
+ for($i=0; $i<=$day; $i++) {
|
|
|
+ $where['start'] = $start + 86400*$i;
|
|
|
+ $where['end'] = $start + 86400*$i + 86399;
|
|
|
+ $where['priority_id'] = '';
|
|
|
+ $cate = Dever::db('work/q_cate')->state();
|
|
|
+ foreach ($cate as $k =>$v) {
|
|
|
+ $where['cate'] = $v['id'];
|
|
|
+ $num = Dever::db('work/info')->getNum($where);
|
|
|
+ if ($num <= 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $data = array();
|
|
|
+ $data['cate'] = $where['cate'];
|
|
|
+ $data['day'] = $where['start'];
|
|
|
+ $info = Dever::db('work/info_stat')->find($data);
|
|
|
+ $data['question'] = $num;
|
|
|
+ $where['priority_id'] = 4;
|
|
|
+ $data['super'] = Dever::db('work/info')->getNum($where);
|
|
|
+ $where['priority_id'] = 3;
|
|
|
+ $data['urgent'] = Dever::db('work/info')->getNum($where);
|
|
|
+ $where['priority_id'] = 2;
|
|
|
+ $data['yb'] = Dever::db('work/info')->getNum($where);
|
|
|
+ $where['priority_id'] = 1;
|
|
|
+ $data['pt'] = Dever::db('work/info')->getNum($where);
|
|
|
+ // echo dever::sql();
|
|
|
+ // print_r($data);
|
|
|
+ if (!$info) {
|
|
|
+ Dever::db('work/info_stat')->insert($data);
|
|
|
+ } else {
|
|
|
+ $data['where_id'] = $info['id'];
|
|
|
+ Dever::db('work/info_stat')->update($data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #修改info表中的问题分类
|
|
|
+ public function updateCate_api()
|
|
|
+ {
|
|
|
+ $data = Dever::db('work/info')->state();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ if (!$v['cate'] || $v['cate']<=0) {
|
|
|
+ if ($v['cate_id']) {
|
|
|
+ $cate_id = explode(',',$v['cate_id']);
|
|
|
+ $where['where_id'] = $v['id'];
|
|
|
+ $where['cate'] = $cate_id[0];
|
|
|
+ Dever::db('work/info')->update($where);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|