lavarel腳本執行 - 進度條展示

use Illuminate\Console\Command;



$log = PointsMallLog::where('store_id',$store_id)
                ->get();
$bar = $this->output->createProgressBar($points_mall_logs->count());
foreach($log as $user){
    try {
        $bar->advance();
        if (!empty($customerId)) {
            PointsMallLog::where('user_id',$user->user_id)->update(['user_id' => $customerId]);
            Log::type('SyncExchangeLog')->info('修改數據', ['user_id' => $user->user_id, 'customerId' => $customerId]);
        }
    } catch (\Throwable $exception) {
        Log::type('SyncExchangeLog')->info('報錯信息記錄', ['params' => $params, 'result' => $result,'$exception' => $exception->getMessage()]);
        continue;
    }
}
$bar->finish();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章