Home.php 990 字节
<?php

namespace Controller\v3;

use Controller\Base;
use Lib\Imap\ImapSearch;
use Lib\Mail\Mail;
use Lib\Mail\MailFun;
use Lib\UploadFile;
use Lib\Verify;
use Model\bodySql;
use Model\emailSql;
use Model\folderSql;
use Model\listsSql;
use Model\sendJobsSql;
use Service\SyncMail;
use function Co\run;
use function Swoole\Coroutine\Http\request;


/**
 * @author:dc
 * @time 2023/2/13 11:28
 * Class Home
 * @package Controller
 */
class Home extends Base {


    /**
     * v3 版本
     * 同步邮件
     * @return string
     * @throws \Lib\Err
     * @author:dc
     * @time 2023/8/2 16:19
     */
    public function sync(){
        $id = app()->request('id');
        if($id && is_numeric($id)){
            ob_start();
            $num = (new SyncMail($id))->search((new ImapSearch())->date(date('Y-m-d')))->sync();
            ob_clean();
            if(is_array($num)){
                app()->_json($num);
            }
        }
        return 'ok';
    }

}