folder.php 917 字节
<?php



include_once "../vendor/autoload.php";

// 查询不是预热邮箱
$eids = db()->all('SELECT id FROM emails LEFT JOIN hot_mail ON emails.email = hot_mail.email WHERE hot_mail.email is NULL AND pwd_error = 0');

$eids = array_column($eids,'id');

foreach ($eids as $eid){
    // 查询文件夹
    $fids = db()->all(\Model\folderSql::all($eid,'`id`'));
    array_map(function ($fid){
        // 总数
        $folder['exsts'] = db()->count(\Model\listsSql::listCount(
            dbWhere(['folder_id'=> $fid, 'deleted'  =>  0])
        ));
        // 未读
        $folder['unseen'] = db()->count(\Model\listsSql::listCount(
            dbWhere(['folder_id'=> $fid, 'seen'  =>  0, 'deleted'  =>  0])
        ));

        _echo('fid: '.$fid.' data: '.json_encode($folder));

        db()->update(\Model\folderSql::$table,$folder,'`id` = '.$fid,false);

    },array_column($fids,'id'));
}
_echo('完成');