正在显示
3 个修改的文件
包含
63 行增加
和
11 行删除
@@ -14,17 +14,9 @@ function start(){ | @@ -14,17 +14,9 @@ function start(){ | ||
14 | if($id && is_numeric($id)){ | 14 | if($id && is_numeric($id)){ |
15 | // 占用当前的id,占用2小时 | 15 | // 占用当前的id,占用2小时 |
16 | if(redis()->add('just_sync_'.$id,time(),600)){ | 16 | if(redis()->add('just_sync_'.$id,time(),600)){ |
17 | - try{ | ||
18 | - // 开始同步 | ||
19 | - (new \Service\SyncMail($id))->sync(); | ||
20 | - }catch (Throwable $e){ | ||
21 | - logs('sync : '.$e->getMessage()); | ||
22 | - } | ||
23 | - // 30秒后 消除占用 | ||
24 | - redis()->expire('just_sync_'.$id,60); | ||
25 | - // 写入日志 | ||
26 | - \Lib\Log::getInstance()->write(); | ||
27 | - | 17 | + go(function () use ($id){ |
18 | + echo file_get_contents(APP_HOST.'v3/sync?id='.$id); | ||
19 | + }); | ||
28 | } | 20 | } |
29 | }else{ | 21 | }else{ |
30 | co::sleep(1); | 22 | co::sleep(1); |
controller/v3/Home.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace Controller\v3; | ||
4 | + | ||
5 | +use Controller\Base; | ||
6 | +use Lib\Mail\Mail; | ||
7 | +use Lib\Mail\MailFun; | ||
8 | +use Lib\UploadFile; | ||
9 | +use Lib\Verify; | ||
10 | +use Model\bodySql; | ||
11 | +use Model\emailSql; | ||
12 | +use Model\folderSql; | ||
13 | +use Model\listsSql; | ||
14 | +use Model\sendJobsSql; | ||
15 | +use Service\SyncMail; | ||
16 | +use function Co\run; | ||
17 | +use function Swoole\Coroutine\Http\request; | ||
18 | + | ||
19 | + | ||
20 | +/** | ||
21 | + * @author:dc | ||
22 | + * @time 2023/2/13 11:28 | ||
23 | + * Class Home | ||
24 | + * @package Controller | ||
25 | + */ | ||
26 | +class Home extends Base { | ||
27 | + | ||
28 | + | ||
29 | + /** | ||
30 | + * v3 版本 | ||
31 | + * 同步邮件 | ||
32 | + * @return string | ||
33 | + * @throws \Lib\Err | ||
34 | + * @author:dc | ||
35 | + * @time 2023/8/2 16:19 | ||
36 | + */ | ||
37 | + public function sync(){ | ||
38 | + $id = app()->request('id'); | ||
39 | + if($id && is_numeric($id)){ | ||
40 | + (new SyncMail($id))->sync(); | ||
41 | + } | ||
42 | + | ||
43 | + } | ||
44 | + | ||
45 | +} | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + |
@@ -39,6 +39,7 @@ return [ | @@ -39,6 +39,7 @@ return [ | ||
39 | 'sync' => [\Controller\Home::class, 'sync'], | 39 | 'sync' => [\Controller\Home::class, 'sync'], |
40 | // v2 版本的 | 40 | // v2 版本的 |
41 | 'v2/sync' => [\Controller\v2\Home::class, 'sync'], | 41 | 'v2/sync' => [\Controller\v2\Home::class, 'sync'], |
42 | + 'v3/sync' => [\Controller\v3\Home::class, 'sync'], | ||
42 | // 标记为已读 | 43 | // 标记为已读 |
43 | 'seen_2_unseen' => [\Controller\Home::class, 'seen_2_unseen'], | 44 | 'seen_2_unseen' => [\Controller\Home::class, 'seen_2_unseen'], |
44 | // 标记为已回复/未回复 | 45 | // 标记为已回复/未回复 |
-
请 注册 或 登录 后发表评论