|
@@ -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
|
- $data['postid'] = $this->getPostid($data['email_id']);
|
93
|
+ list($data['postid'],$data['source']) = $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,28 +115,23 @@ class SyncToEsCmd { |
|
@@ -115,28 +115,23 @@ class SyncToEsCmd { |
115
|
|
115
|
|
116
|
}
|
116
|
}
|
117
|
|
117
|
|
118
|
- protected $postids = [];
|
|
|
119
|
|
118
|
|
120
|
/**
|
119
|
/**
|
121
|
- * 项目id
|
120
|
+ * 查询项目id 和 邮件来源
|
|
|
121
|
+ * @param int $email_id 邮箱id
|
|
|
122
|
+ * @return array
|
122
|
* @author:dc
|
123
|
* @author:dc
|
123
|
- * @time 2025/5/20 15:44
|
124
|
+ * @time 2025/5/29 11:47
|
124
|
*/
|
125
|
*/
|
125
|
public function getPostid($email_id){
|
126
|
public function getPostid($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
|
- }
|
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);
|
136
|
|
130
|
|
137
|
- return $this->postids[$h][$email_id];
|
|
|
138
|
-
|
|
|
139
|
- return 0;
|
131
|
+ return [
|
|
|
132
|
+ 'postid' => $data['postid']??0,
|
|
|
133
|
+ 'source' => $data['source']??0,
|
|
|
134
|
+ ];
|
140
|
}
|
135
|
}
|
141
|
|
136
|
|
142
|
|
137
|
|