<?php

namespace App\Console\Commands\BatchWechatMaterial;

use Illuminate\Console\Command;
use App\Modules\WechatMaterial\Services\BatchWechatCustomSendService;
use Redis;

/**
 * 发送微信素材客服消息
 *
 */
class SendCustomWechatMaterial extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'BatchWechatMaterial:SendCustomWechatMaterial';

    /**
     * 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()
    {
        $this->start();
    }

    public function start(){
    	\Log::info('send_custom_wechat_material_start');
    	switch_global_db('api_mysql','default');

    	BatchWechatCustomSendService::toCheckAndSendBatchCustomMsg();

    	switch_global_db('mysql','default');
    	\Log::info('send_custom_wechat_material_end:');
    }
  
}
