12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
- namespace App\Console\Commands\Trade;
- use App\Modules\Trade\Services\OrderStatService;
- use App\Modules\Channel\Services\ChannelService;
- use Log;
- use Illuminate\Console\Command;
- class GenerateOrderStat extends Command
- {
- /**
- * 执行命令 php artisan generate_order_stat
- *
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'generate_order_stat';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '渠道订单统计数据生成';
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- print_r("======渠道订单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
- Log::info("======渠道订单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
- $channels = ChannelService::getAllChannels();
- $date = date('Y-m-d',strtotime('-1 day'));
- if(count($channels))
- {
- $channels->each(function($channel) use($date){
- OrderStatService::add($channel->id, $date);
- });
- }
- Log::info("======渠道订单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
- print_r("======渠道订单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
- }
- }
|