作者 邓超

超迹配置的自动回复

@@ -138,6 +138,17 @@ class fob_ai_mail_auto_reply { @@ -138,6 +138,17 @@ 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 + $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){
141 // 有配置才回复 152 // 有配置才回复
142 $ret = \Lib\Mail\MailFun::sendEmail([ 153 $ret = \Lib\Mail\MailFun::sendEmail([
143 'subject' => 'Re:'.$data['subject'], 154 'subject' => 'Re:'.$data['subject'],
@@ -146,6 +157,8 @@ class fob_ai_mail_auto_reply { @@ -146,6 +157,8 @@ class fob_ai_mail_auto_reply {
146 ],$email); 157 ],$email);
147 _echo('回复成功'.$data['id'].'==='.$postid); 158 _echo('回复成功'.$data['id'].'==='.$postid);
148 $this->log([$data,$replySetting,$ret]); // 立即写入日志 159 $this->log([$data,$replySetting,$ret]); // 立即写入日志
  160 + }
  161 +
149 }else{ 162 }else{
150 _echo('没有找到配置'.$data['id'].'==='.$postid); 163 _echo('没有找到配置'.$data['id'].'==='.$postid);
151 } 164 }