<?php

namespace App\Console\Commands\ProductStats;

use App\Modules\Statistic\Services\ProductionStatsEmailService;

use Illuminate\Console\Command;

class MonthlyProductionStats extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'saveMonthlyProductsStats';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '发送每日作品分析报表';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
        $from_date = date('Y-m-01 00:00:00',strtotime('-1 month'));
        $end_date = date('Y-m-d 23:59:59',strtotime(date('Y-m-01').' -1 day'));

        ProductionStatsEmailService::setMonthStats($from_date,$end_date);

    }
}
