<?php
/**
 * Created by PhpStorm.
 * User: sogndb
 * Date: 2018/02/05
 * Time: 下午5:26
 */

namespace App\Console\Commands\SendOrder;

use App\Modules\SendOrder\Services\SendOrderStatService;
use Log;
use Illuminate\Console\Command;

class GenerateStat extends Command
{
    /**
     * 执行命令   php artisan send_order:generate_day_stat
     *
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'send_order:generate_stat';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '派单统计数据生成';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        ini_set('memory_limit', '1024M');
        print_r('memory_used:'.memory_get_usage()."\n");
        print_r("======派单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
        Log::info("======派单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));

        //SendOrderStatService::generateStat();
        SendOrderStatService::generateStatsByChunk();
        Log::info("======派单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
        print_r("======派单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
        print_r('memory_used:'.memory_get_usage()."\n");
    }
}