正在显示
4 个修改的文件
包含
40 行增加
和
13 行删除
@@ -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 |
@@ -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 | ]; |
-
请 注册 或 登录 后发表评论