作者 邓超

to es

... ... @@ -20,6 +20,10 @@ class SyncToEsCmd {
*/
public $folders = [];
/**
* @var \Lib\Db
*/
public $fob_db;
public function handler(){
... ... @@ -35,6 +39,7 @@ class SyncToEsCmd {
$es = es();
$db = db();
$this->fob_db = fob_mysql();
$startTime = time();
while (1){
... ... @@ -71,6 +76,9 @@ class SyncToEsCmd {
}
// 为文件夹打标 方便查询
$data['folder_as_int'] = folder2int($this->folders[$data['folder_id']]);
// postid ai邮箱要用 这个是查询黑格
$data['postid'] = $this->getPostid($data['email_id']);
$data = $this->getEsData($data);
$doc_id = $data['email_id'].'_'.$data['folder_id'].'_'.$data['uid'];
... ... @@ -90,6 +98,25 @@ class SyncToEsCmd {
}
protected $postids = [];
/**
* 项目id
* @author:dc
* @time 2025/5/20 15:44
*/
public function getPostid($email_id){
$h = date('dhi');
if(empty($this->postids[$h][$email_id])){
$id = (int) $this->fob_db->throw()->value("select `post_id` from `e_mail_binds` where `email_id` = '{$email_id}' and `source` = 2 and `deleted_at` is null order by `id` desc limit 1 ");
$this->postids[$h][$email_id] = $id;
}
return $this->postids[$h][$email_id];
return 0;
}
public function getEsData($data){
if(!empty($data['id'])){
... ...