folder.php 650 字节
<?php



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

$fid = 1;

while ($fid){
    $fid = db()->value(\Model\folderSql::first([
        'id.>'    =>  $fid
    ],
        '`id`'
    ));
    if(!$fid){
        break;
    }

    // 总数
    $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);

}