正在显示
1 个修改的文件
包含
29 行增加
和
2 行删除
@@ -180,8 +180,35 @@ class SyncToEsCmd { | @@ -180,8 +180,35 @@ class SyncToEsCmd { | ||
180 | */ | 180 | */ |
181 | public function getPostid($email_id,$udate){ | 181 | public function getPostid($email_id,$udate){ |
182 | 182 | ||
183 | + //每60秒验证一次 | ||
184 | + if(redis()->add('fob_bind_mail_times_check:'.$email_id,1,60)){ | ||
185 | + $lastpostid = $this->fob_db->throw()->value("select `post_id` from `e_mail_binds_log` where `email_id` = '{$email_id}' order by `id` desc limit 1"); | ||
186 | + $thelast = $this->fob_db->throw()->first("select * from `e_mail_binds` where `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1"); | ||
187 | + if(!$thelast){ | ||
188 | + return [0,0]; | ||
189 | + } | ||
190 | + | ||
191 | + $thelastpostid = $thelast['post_id']; | ||
192 | + | ||
193 | + // 说明变了 | ||
194 | + if($lastpostid!=$thelastpostid){ | ||
195 | + $ret = $this->fob_db->throw()->insert('e_mail_binds_log',[ | ||
196 | + 'post_id' => $thelastpostid, | ||
197 | + 'bind_time' => date('Y-m-d H:i:s'), | ||
198 | + 'source' => $thelast['source'], | ||
199 | + 'email' => $thelast['email'], | ||
200 | + 'email_id' => $thelast['email_id'], | ||
201 | + ],false); | ||
202 | + if(!$ret){ | ||
203 | + throw new Exception('新增失败'); | ||
204 | + } | ||
205 | + } | ||
206 | + | ||
207 | + } | ||
208 | + | ||
209 | + | ||
183 | // 查询历史记录 | 210 | // 查询历史记录 |
184 | - $times = redis()->getSet('fob_bind_mail_times2:'.$email_id,300,function ($email_id){ | 211 | + $times = redis()->getSet('fob_bind_mail_times3:'.$email_id,300,function ($email_id){ |
185 | 212 | ||
186 | $times = $this->fob_db->throw()->all("select `post_id`,`bind_time`,`source` from `e_mail_binds_log` where `email_id` = {$email_id} order by `bind_time` desc "); | 213 | $times = $this->fob_db->throw()->all("select `post_id`,`bind_time`,`source` from `e_mail_binds_log` where `email_id` = {$email_id} order by `bind_time` desc "); |
187 | if(!$times){ | 214 | if(!$times){ |
@@ -205,7 +232,7 @@ class SyncToEsCmd { | @@ -205,7 +232,7 @@ class SyncToEsCmd { | ||
205 | 232 | ||
206 | // 没有找到历史,就找绑定表 | 233 | // 没有找到历史,就找绑定表 |
207 | if(empty($data)){ | 234 | if(empty($data)){ |
208 | - $data = redis()->getSet('fob_bind_mail:'.$email_id,300,function ($email_id){ | 235 | + $data = redis()->getSet('fob_bind_mail3:'.$email_id,300,function ($email_id){ |
209 | return $this->fob_db->throw()->first("select `post_id`,`source` from `e_mail_binds` where `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1"); | 236 | return $this->fob_db->throw()->first("select `post_id`,`source` from `e_mail_binds` where `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1"); |
210 | },$email_id); | 237 | },$email_id); |
211 | 238 |
-
请 注册 或 登录 后发表评论