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

namespace App\Console\Commands\SendOrder;

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

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

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '每日图书派单数据生成';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        ini_set('memory_limit', '1280M');
        print_r("======每日图书派单数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
        Log::info("======每日图书派单数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
        //TODO 将时间改为今天
        $date = date("Y-m-d", strtotime(' -1 day'));
        SendOrderForceDayStatService::generateForceDayStat($date);
        //生成汇总
        //SendOrderStatService::generateStat();


        Log::info("======每日图书派单数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
        print_r("======每日图书派单数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
    }
}