正在显示
1 个修改的文件
包含
17 行增加
和
12 行删除
| @@ -90,7 +90,7 @@ class SyncToEsCmd { | @@ -90,7 +90,7 @@ class SyncToEsCmd { | ||
| 90 | // 为文件夹打标 方便查询 | 90 | // 为文件夹打标 方便查询 |
| 91 | $data['folder_as_int'] = folder2int($this->folders[$data['folder_id']]); | 91 | $data['folder_as_int'] = folder2int($this->folders[$data['folder_id']]); |
| 92 | // postid ai邮箱要用 这个是查询黑格 | 92 | // postid ai邮箱要用 这个是查询黑格 |
| 93 | - list($data['postid'],$data['source']) = $this->getPostid($data['email_id']); | 93 | + $data['postid'] = $this->getPostid($data['email_id']); |
| 94 | }catch (Throwable $e){ | 94 | }catch (Throwable $e){ |
| 95 | redis()->rPush('sync_to_es'.S_V2,$id); | 95 | redis()->rPush('sync_to_es'.S_V2,$id); |
| 96 | _echo('sync to es '.$e->getMessage()); | 96 | _echo('sync to es '.$e->getMessage()); |
| @@ -115,23 +115,28 @@ class SyncToEsCmd { | @@ -115,23 +115,28 @@ class SyncToEsCmd { | ||
| 115 | 115 | ||
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | + protected $postids = []; | ||
| 118 | 119 | ||
| 119 | /** | 120 | /** |
| 120 | - * 查询项目id 和 邮件来源 | ||
| 121 | - * @param int $email_id 邮箱id | ||
| 122 | - * @return array | 121 | + * 项目id |
| 123 | * @author:dc | 122 | * @author:dc |
| 124 | - * @time 2025/5/29 11:47 | 123 | + * @time 2025/5/20 15:44 |
| 125 | */ | 124 | */ |
| 126 | public function getPostid($email_id){ | 125 | public function getPostid($email_id){ |
| 127 | - $data = redis()->getSet('fob_bind_mail:'.$email_id,300,function ($email_id){ | ||
| 128 | - 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"); | ||
| 129 | - },$email_id); | 126 | + $h = date('dh'); |
| 127 | + if(!isset($this->postids[$h][$email_id])){ | ||
| 128 | + // 未删除状态 | ||
| 129 | + $id = (int) $this->fob_db->throw()->value("select `post_id` from `e_mail_binds` where `email_id` = '{$email_id}' and `deleted_at` is null order by `id` desc limit 1 "); | ||
| 130 | + if(!$id){ | ||
| 131 | + // 已删状态 | ||
| 132 | + $id = (int) $this->fob_db->throw()->value("select `post_id` from `e_mail_binds` where `email_id` = '{$email_id}' order by `id` desc limit 1 "); | ||
| 133 | + } | ||
| 134 | + $this->postids[$h][$email_id] = $id; | ||
| 135 | + } | ||
| 130 | 136 | ||
| 131 | - return [ | ||
| 132 | - 'postid' => $data['postid']??0, | ||
| 133 | - 'source' => $data['source']??0, | ||
| 134 | - ]; | 137 | + return $this->postids[$h][$email_id]; |
| 138 | + | ||
| 139 | + return 0; | ||
| 135 | } | 140 | } |
| 136 | 141 | ||
| 137 | 142 |
-
请 注册 或 登录 后发表评论