table(TableName::QPRecordDB() . 'RecordPlatformData') ->where($where) ->selectRaw($sum) ->first(); $line = DB::connection('read')->table('QPTreasureDB.dbo.GameScoreLocker') ->selectRaw('KindID,count(DISTINCT UserID) as game_count') ->whereRaw('datediff(hh,CollectDate,getdate())<=5') ->groupBy('KindID') ->get(); $online = json_encode($line); Util::WriteLog('online_report',$list); Util::WriteLog('online_report',$online); if($list){ $data = [ 'ldate' => date('Ymd'), 'online' => $online, 'register' => $list->RegPeple??0, 'active' => $list->ActivePeple??0, 'recharge' => $list->PayTotal??0, 'withdraw' => $list->DrawTotal??0, 'created' => time() ]; DB::connection('mysql')->table('game-report')->insert($data); } } }