<?php
/**
维护公众号交互的用户表
 */

namespace App\Console\Commands\Tool;

use Log;
use Illuminate\Console\Command;
use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
use DB;

class MaintainTempForceSubscribeUser extends Command
{
    /**
     * 执行命令  MaintainTempForceSubscribeUser
     *
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'MaintainTempForceSubscribeUser';

    /**
     * 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"));
      
        $end_time = date('Y-m-d 00:00:00',strtotime('- 3 day'));
        \Log::info('OfficialAccountUserTranser_start:end_time:'.$end_time);
        TempForceSubscribeUsers::deleteTempForceSubscribeUsersByTime($end_time);
        \Log::info('OfficialAccountUserTranser_end');
        
        print_r("======维护公众号交互的用户表 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
        print_r('memory_used:'.memory_get_usage()."\n");
    }
}