data = $data; } public $tries = 5; public function backoff(): array { return [30, 60, 120]; // wait 30s before 1st retry, 60s before 2nd, etc. } /** * The number of seconds the job can run before timing out. * * @var int */ public $timeout = 300; // allow up to 5 minutes public function timeoutOn() { return now()->addMinutes(10); } /** * Execute the job. * * @return void */ public function handle() { if (empty($this->data)) return; // return ; Util::WriteLog('24680task',$this->data); // 接收数据 [$cmd,$data] = $this->data; switch ($cmd){ case 'UpdateLogin': [$UserID,$LastLogonDate,$LastLogonIP,$FPID]=$data; $accountInfo = AccountsInfo::where('UserID', $UserID)->first(); if(!$accountInfo)return; if(date('Ymd',strtotime($LastLogonDate)) != date('Ymd',strtotime($accountInfo->LastLogonDate))){ Util::WriteLog('24680dispatch-xxxx', ['UpdateLogin', [$UserID, $LastLogonDate, $accountInfo->LastLogonDate,$accountInfo->Channel,strtotime($accountInfo->LastLogonDate)]]); $channel = intval($accountInfo->Channel); //DB::connection('write')->select("SET NOCOUNT ON use QPRecordDB exec GSP_GP_AddPlatformData 2,$channel,1"); $updateArr =compact('LastLogonDate','LastLogonIP'); GlobalUserInfo::where('UserID',$UserID)->update($updateArr); AccountsInfo::where('UserID', $UserID)->update($updateArr); DB::table('QPRecordDB.dbo.RecordUserLogonStatistics')->insert([ 'UserID' => $UserID, 'LogonIP'=>$LastLogonIP, 'LastDate'=>$LastLogonDate, 'LogonCount'=>1, 'mac'=>$FPID??"" ]); $result = DB::connection('write')->select("DECLARE @return_value int SET NOCOUNT ON use QPRecordDB exec GSP_GP_AddPlatformData 2,$channel,1,0 SELECT 'ReturnValue' = @return_value "); } //DB::connection('write')->select("SET NOCOUNT ON use QPRecordDB exec GSP_GP_AddUserLogin $UserID"); //EXEC QPRecordDB.dbo.GSP_GP_AddPlatformData 2,@Channel,1 $result = DB::connection('write')->select("DECLARE @return_value int SET NOCOUNT ON use QPRecordDB exec GSP_GP_AddUserLogin $UserID SELECT 'ReturnValue' = @return_value "); break; } } }