作者 邓超

1

@@ -61,21 +61,10 @@ function start(){ @@ -61,21 +61,10 @@ function start(){
61 }); 61 });
62 62
63 63
64 - // 需要更新同步的邮件 64 + //todo:: 需要更新同步的邮件,每10分钟同步一次,这里是的时间是微妙
65 \Swoole\Timer::tick(600000,function (){ 65 \Swoole\Timer::tick(600000,function (){
66 66
67 - $id = 0;  
68 -  
69 - while (true){  
70 - $ids = db()->all('select `id` from `'.\Model\emailSql::$table.'` where `id` > '.$id.' order by `id` asc limit 1000 offset 0');  
71 - if(!$ids){  
72 - break;  
73 - }  
74 - foreach ($ids as $v){  
75 - $id = $v['id'];  
76 - redis()->rPush('sync_email_lists', $v['id']);  
77 - }  
78 - } 67 + start_now_mail();
79 68
80 }); 69 });
81 70
@@ -107,6 +107,14 @@ class Home { @@ -107,6 +107,14 @@ class Home {
107 107
108 } 108 }
109 109
  110 + /**
  111 + * 邮箱文件夹
  112 + * @author:dc
  113 + * @time 2023/2/18 10:58
  114 + */
  115 + public function folder(){
  116 +
  117 + }
110 118
111 119
112 120
@@ -240,6 +240,33 @@ function list_to_tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0,$em @@ -240,6 +240,33 @@ function list_to_tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0,$em
240 } 240 }
241 241
242 242
  243 +/**
  244 + * todo:: 立即开始同步邮件,非必要请不要手动调用,,系统有定时调用,
  245 + * @author:dc
  246 + * @time 2023/2/18 11:04
  247 + */
  248 +function start_now_mail(){
  249 + $id = 0;
  250 +
  251 + while (true){
  252 + $ids = db()->all('select `id` from `'.\Model\emailSql::$table.'` where `id` > '.$id.' order by `id` asc limit 1000 offset 0');
  253 + if(!$ids){
  254 + break;
  255 + }
  256 + foreach ($ids as $v){
  257 + $id = $v['id'];
  258 + redis()->rPush('sync_email_lists', $v['id']);
  259 + }
  260 + }
  261 +
  262 +}
  263 +
  264 +
  265 +
  266 +
  267 +
  268 +
  269 +
243 270
244 271
245 272
@@ -11,4 +11,7 @@ return [ @@ -11,4 +11,7 @@ return [
11 /** 邮件列表 @see Home::lists() **/ 11 /** 邮件列表 @see Home::lists() **/
12 'mail/list' => [Home::class,'lists'], 12 'mail/list' => [Home::class,'lists'],
13 13
  14 + /** 邮件文件夹 @see Home::folder() **/
  15 + 'mail/folder' => [Home::class,'folder'],
  16 +
14 ]; 17 ];