Commit 9b0ada11 by Joneq

新增通知系统-完成更新之后的数据修改

parent 54be437d
Showing with 31 additions and 3 deletions
...@@ -153,9 +153,13 @@ class SystemNoticeLogic ...@@ -153,9 +153,13 @@ class SystemNoticeLogic
$sendData['content'] = ''; $sendData['content'] = '';
$sendData['host'] = ''; $sendData['host'] = '';
$time = date('Y-m-d'); $time = date('Y-m-d');
$now = time();
if ($data['type'] == 'system_update'){ if ($data['type'] == 'system_update'){
$sendInfo = (new SystemUpdateModel())->where('smue_id',$data['id'])->first(); $modelObj = (new SystemUpdateModel());
$sendInfo = $modelObj->where('smue_id',$data['id'])->first();
$sendData['user_info'] = DB::table('t_user_perm')->where('begDate','<=',$time) $sendData['user_info'] = DB::table('t_user_perm')->where('begDate','<=',$time)
->where('endDate','>=',$time) ->where('endDate','>=',$time)
...@@ -170,7 +174,9 @@ class SystemNoticeLogic ...@@ -170,7 +174,9 @@ class SystemNoticeLogic
}else if ($data['type'] == 'system_preach'){ }else if ($data['type'] == 'system_preach'){
$sendInfo = (new SystemPreachModel())->where('smph_id',$data['id'])->first(); $modelObj = (new SystemUpdateModel());
$sendInfo = $modelObj->where('smph_id',$data['id'])->first();
$sendData['user_info'] = DB::table('t_user_perm')->where('begDate','<=',$time) $sendData['user_info'] = DB::table('t_user_perm')->where('begDate','<=',$time)
->where('endDate','>=',$time) ->where('endDate','>=',$time)
...@@ -185,7 +191,9 @@ class SystemNoticeLogic ...@@ -185,7 +191,9 @@ class SystemNoticeLogic
}else if ($data['type'] == 'system_bulletin'){ }else if ($data['type'] == 'system_bulletin'){
$sendInfo = (new SystemBulletinModel())->where('smbn_id',$data['id'])->first(); $modelObj = (new SystemUpdateModel());
$sendInfo = $modelObj->where('smbn_id',$data['id'])->first();
$sendData['user'] = ['all@ichunt.com']; $sendData['user'] = ['all@ichunt.com'];
...@@ -196,14 +204,34 @@ class SystemNoticeLogic ...@@ -196,14 +204,34 @@ class SystemNoticeLogic
throw new \Exception('暂无该种类型'); throw new \Exception('暂无该种类型');
} }
$emailSendCount = 0;
$bulletinSendCount = 0;
foreach ($data['notice_type'] as $value){ foreach ($data['notice_type'] as $value){
if (intval($value) === 1){ if (intval($value) === 1){
$this->sendEmail($sendData); $this->sendEmail($sendData);
$emailSendCount++;
}else{ }else{
//rabbitmq 方法不行 //rabbitmq 方法不行
$this->sendRedisNotice($sendData); $this->sendRedisNotice($sendData);
$bulletinSendCount++;
} }
} }
//发送成功之后就行修改
if ($data['type'] == 'system_update'){
$modelObj->where('smue_id',$data['id'])->update(['update_time'=>$now]);
$modelObj->where('smue_id',$data['id'])->increment('bulletin_count',$bulletinSendCount);
$modelObj->where('smue_id',$data['id'])->increment('bulletin_count',$emailSendCount);
}else if ($data['type'] == 'system_preach'){
$modelObj->where('smph_id',$data['id'])->update(['update_time'=>$now]);
}else if ($data['type'] == 'system_bulletin'){
$modelObj->where('smbn_id',$data['id'])->update(['update_time'=>$now,'is_send'=>'已发送']);
}else{
throw new \Exception('暂无该种类型');
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment