作者 邓超

同步es异常

@@ -184,7 +184,7 @@ class SyncToEsCmd { @@ -184,7 +184,7 @@ class SyncToEsCmd {
184 * @time 2025/8/5 14:53 184 * @time 2025/8/5 14:53
185 */ 185 */
186 private function getPostids($email_id){ 186 private function getPostids($email_id){
187 - $postids = $this->fob_db->throw()->cache(1800)->all("select `post_id` from `e_mail_binds` where `source` = 1 and `email_id` = {$email_id} and `deleted_at` is null"); 187 + $postids = $this->fob_db->throw()->cache(1800)->all("select `post_id` from `e_mail_binds` where `source` = 1 and `email_id` = {$email_id}");
188 188
189 if($postids){ 189 if($postids){
190 return array_column($postids,'post_id'); 190 return array_column($postids,'post_id');
@@ -403,10 +403,19 @@ class SyncToEsCmd { @@ -403,10 +403,19 @@ class SyncToEsCmd {
403 //每60秒验证一次 403 //每60秒验证一次
404 if(redis()->add('fob_bind_mail_times_check:'.$email_id,1,60)){ 404 if(redis()->add('fob_bind_mail_times_check:'.$email_id,1,60)){
405 $lastpostid = $this->fob_db->throw()->value("select `post_id` from `e_mail_binds_log` where `source` = 2 and `email_id` = '{$email_id}' order by `id` desc limit 1"); 405 $lastpostid = $this->fob_db->throw()->value("select `post_id` from `e_mail_binds_log` where `source` = 2 and `email_id` = '{$email_id}' order by `id` desc limit 1");
  406 + // 如果找不到了
406 $thelast = $this->fob_db->throw()->first("select * from `e_mail_binds` where `source` = 2 and `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1"); 407 $thelast = $this->fob_db->throw()->first("select * from `e_mail_binds` where `source` = 2 and `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1");
407 if(!$thelast){ 408 if(!$thelast){
  409 + $his = $this->fob_db->throw()->first("select `email` from `e_mail_binds` where `source` = 2 and `email_id` = '{$email_id}' limit 1");
  410 + if(!$his){
408 return [0,0]; 411 return [0,0];
409 } 412 }
  413 + // 归公
  414 + $thelast['post_id'] = 0;
  415 + $thelast['source'] = 2;
  416 + $thelast['email'] = $his['email'];
  417 + $thelast['email_id'] = $email_id;
  418 + }
410 419
411 $thelastpostid = $thelast['post_id']; 420 $thelastpostid = $thelast['post_id'];
412 421