-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathDqAlert.php
55 lines (46 loc) · 1.53 KB
/
DqAlert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
class DqAlert{
static function send($msg,$topic){
$topicList= DqModule::getRegisterTopic();
if(isset($topicList[$topic])){
$mailList = trim($topicList[$topic]['email']);
if(empty($mailList)){
return;
}
$mailto = array();
$tmp = explode(',',$mailList);
foreach ($tmp as $v){
$v = trim($v);
if(!empty($v)) {
$mailto[] = $v;
}
}
if(!empty($mailto)){
DqMailer::sendMail($mailto,'[延时队列通知]',$msg);
}
}
}
static function send_redis_down_notice($redis,$msg=''){
$mailInfo = DqMysql::select('dq_alert');
if(empty($mailInfo)){
DqLog::writeLog('empty alert mail conf,plear check',DqLog::LOG_TYPE_EXCEPTION);
return false;
}else{
$mailInfo = $mailInfo[0];
$extArr = json_decode($mailInfo['ext'],true);
if(isset($extArr['redis'])){
$tmp = explode(',',$extArr['redis']);
$mailTo = array();
foreach ($tmp as $v){
$v = trim($v);
if(!empty($v)){
$mailTo[] = $v;
}
}
if(!empty($mailTo)){
DqMailer::sendMail($mailTo,'[延时队列通知]-redi连接异常','info='.json_encode($redis).',msg='.$msg);
}
}
}
}
}