...
|
...
|
@@ -180,8 +180,35 @@ class SyncToEsCmd { |
|
|
*/
|
|
|
public function getPostid($email_id,$udate){
|
|
|
|
|
|
//每60秒验证一次
|
|
|
if(redis()->add('fob_bind_mail_times_check:'.$email_id,1,60)){
|
|
|
$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");
|
|
|
$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");
|
|
|
if(!$thelast){
|
|
|
return [0,0];
|
|
|
}
|
|
|
|
|
|
$thelastpostid = $thelast['post_id'];
|
|
|
|
|
|
// 说明变了
|
|
|
if($lastpostid!=$thelastpostid){
|
|
|
$ret = $this->fob_db->throw()->insert('e_mail_binds_log',[
|
|
|
'post_id' => $thelastpostid,
|
|
|
'bind_time' => date('Y-m-d H:i:s'),
|
|
|
'source' => $thelast['source'],
|
|
|
'email' => $thelast['email'],
|
|
|
'email_id' => $thelast['email_id'],
|
|
|
],false);
|
|
|
if(!$ret){
|
|
|
throw new Exception('新增失败');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// 查询历史记录
|
|
|
$times = redis()->getSet('fob_bind_mail_times2:'.$email_id,300,function ($email_id){
|
|
|
$times = redis()->getSet('fob_bind_mail_times3:'.$email_id,300,function ($email_id){
|
|
|
|
|
|
$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 ");
|
|
|
if(!$times){
|
...
|
...
|
@@ -205,7 +232,7 @@ class SyncToEsCmd { |
|
|
|
|
|
// 没有找到历史,就找绑定表
|
|
|
if(empty($data)){
|
|
|
$data = redis()->getSet('fob_bind_mail:'.$email_id,300,function ($email_id){
|
|
|
$data = redis()->getSet('fob_bind_mail3:'.$email_id,300,function ($email_id){
|
|
|
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");
|
|
|
},$email_id);
|
|
|
|
...
|
...
|
|