|
@@ -29,27 +29,33 @@ class AutoMail { |
|
@@ -29,27 +29,33 @@ class AutoMail { |
29
|
echo date('Y-m-d H:i:s');
|
29
|
echo date('Y-m-d H:i:s');
|
30
|
echo "\n";
|
30
|
echo "\n";
|
31
|
$at = 0;
|
31
|
$at = 0;
|
32
|
- if(redis()->get('resync_to_es_inbox') == 1){
|
|
|
33
|
-
|
|
|
34
|
- redis()->set('resync_to_es_inbox',2,3600);
|
|
|
35
|
-
|
|
|
36
|
- $post_ids = fob_mysql()->all("select `post_id` from `e_mail_binds` group by `post_id`");
|
|
|
37
|
-
|
|
|
38
|
- if($post_ids){
|
|
|
39
|
- $post_ids = array_column($post_ids,'post_id','post_id');
|
32
|
+ $this->es = es();
|
|
|
33
|
+ while (true){
|
|
|
34
|
+ $postid = redis()->lPop('resync_to_es_inbox_list');
|
|
|
35
|
+ if (!is_numeric($postid)){
|
|
|
36
|
+ break;
|
40
|
}
|
37
|
}
|
|
|
38
|
+ if(redis()->add('resync_to_es_inbox:'.$postid,1,$postid?600:7200)){
|
|
|
39
|
+ if (!$postid){
|
|
|
40
|
+ $post_ids = fob_mysql()->all("select `post_id` from `e_mail_binds` group by `post_id`");
|
|
|
41
|
+ if($post_ids){
|
|
|
42
|
+ $post_ids = array_column($post_ids,'post_id','post_id');
|
|
|
43
|
+ }
|
|
|
44
|
+ }else{
|
|
|
45
|
+ $post_ids = [$postid];
|
|
|
46
|
+ }
|
|
|
47
|
+
|
|
|
48
|
+ foreach ($post_ids as $post_id){
|
|
|
49
|
+ $total = $this->essss(0,$post_id,0);
|
|
|
50
|
+ $autoTotal = $this->essss(0,$post_id,1);
|
|
|
51
|
+ echo "postid {$post_id} inbox {$total} auto {$autoTotal}\n";
|
|
|
52
|
+ $at += $total + $autoTotal;
|
|
|
53
|
+ }
|
41
|
|
54
|
|
42
|
- $this->es = es();
|
|
|
43
|
-
|
|
|
44
|
- foreach ($post_ids as $post_id){
|
|
|
45
|
- $total = $this->essss(0,$post_id,0);
|
|
|
46
|
- $autoTotal = $this->essss(0,$post_id,1);
|
|
|
47
|
- echo "postid {$post_id} inbox {$total} auto {$autoTotal}\n";
|
|
|
48
|
- $at += $total + $autoTotal;
|
|
|
49
|
}
|
55
|
}
|
50
|
|
56
|
|
51
|
- redis()->set('resync_to_es_inbox',2,600);
|
|
|
52
|
}
|
57
|
}
|
|
|
58
|
+
|
53
|
echo "总数量 {$at} ";
|
59
|
echo "总数量 {$at} ";
|
54
|
echo "end ";
|
60
|
echo "end ";
|
55
|
echo date('Y-m-d H:i:s');
|
61
|
echo date('Y-m-d H:i:s');
|