正在显示
1 个修改的文件
包含
21 行增加
和
8 行删除
| @@ -138,14 +138,27 @@ class fob_ai_mail_auto_reply { | @@ -138,14 +138,27 @@ class fob_ai_mail_auto_reply { | ||
| 138 | // 配置 | 138 | // 配置 |
| 139 | $replySetting = $this->getAutoReplySetting($postid,$email['email']); | 139 | $replySetting = $this->getAutoReplySetting($postid,$email['email']); |
| 140 | if($replySetting){ | 140 | if($replySetting){ |
| 141 | - // 有配置才回复 | ||
| 142 | - $ret = \Lib\Mail\MailFun::sendEmail([ | ||
| 143 | - 'subject' => 'Re:'.$data['subject'], | ||
| 144 | - 'tos' => [['email'=>$data['from'],'name'=>explode('@',$data['from'])[0]]], | ||
| 145 | - 'body' => $this->trimBody($data,$replySetting['content'],$body) | ||
| 146 | - ],$email); | ||
| 147 | - _echo('回复成功'.$data['id'].'==='.$postid); | ||
| 148 | - $this->log([$data,$replySetting,$ret]); // 立即写入日志 | 141 | + $isnext = true; |
| 142 | + if($replySetting['reply_num']??0){ | ||
| 143 | + $nk = 'fobaimailautoreplynum:'.$postid.':'.md5($data['from']); | ||
| 144 | + if(redis()->get($nk,0) > $replySetting['reply_num']){ | ||
| 145 | + $isnext = false; | ||
| 146 | + }else{ | ||
| 147 | + redis()->incr($nk); | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + if($isnext){ | ||
| 152 | + // 有配置才回复 | ||
| 153 | + $ret = \Lib\Mail\MailFun::sendEmail([ | ||
| 154 | + 'subject' => 'Re:'.$data['subject'], | ||
| 155 | + 'tos' => [['email'=>$data['from'],'name'=>explode('@',$data['from'])[0]]], | ||
| 156 | + 'body' => $this->trimBody($data,$replySetting['content'],$body) | ||
| 157 | + ],$email); | ||
| 158 | + _echo('回复成功'.$data['id'].'==='.$postid); | ||
| 159 | + $this->log([$data,$replySetting,$ret]); // 立即写入日志 | ||
| 160 | + } | ||
| 161 | + | ||
| 149 | }else{ | 162 | }else{ |
| 150 | _echo('没有找到配置'.$data['id'].'==='.$postid); | 163 | _echo('没有找到配置'.$data['id'].'==='.$postid); |
| 151 | } | 164 | } |
-
请 注册 或 登录 后发表评论