disableQueryLog(); $this->info(date('m-d H:i:s') . ' 开始整理'); $this->analysis(); $this->info(date('m-d H:i:s') . ' 整理结束'); } private function analysis() { try { $accountList = RedisModel::getAfterDecode(Account::XM_ACCOUNT_LIST_CONFIRM); # 获取对应的平台类型ID和渠道ID $accountData = Account::getAccountInfo($accountList); foreach($accountList as $appId) { $accounts = $accountData->where('app_id', $appId); foreach($accounts as $accountInfo) { if( isset($accountInfo->platform_id) && isset($accountInfo->channel_id) && !empty($accountInfo->platform_id) && !empty($accountInfo->channel_id) ) { $this->page = 1; do{ # 统计账号粉丝的充值数据 $data = Order::userAnalysis( $accountInfo->platform_id, $accountInfo->channel_id, $this->page, $this->pageSize ); $count = $data->count(); $this->info('本次共获取'.$count.'条数据'); if($count) { # 存入Redis供消费 RedisModel::lPush(Order::USER_ATTR_DATA, json_encode(['app_id' => $appId, 'data' => $data->toArray()])); } else { Log::logError('未查询到订单信息', [ 'app_id' => $appId, 'platform_id' => $accountInfo->platform_id, 'channel_id' => $accountInfo->channel_id, 'page' => $this->page ], 'UserAttrAnalysis-account'); } $this->page++; } while($count == $this->pageSize); } else { Log::logError('账号的渠道信息获取失败', [ 'app_id' => $appId, 'account_info' => $accountInfo ], 'UserAttrAnalysis'); } } } } catch (\Exception $e) { Log::logError('账号的粉丝数据分析失败', [ 'msg' => $e->getMessage(), 'line' => $e->getLine() ], 'UserAttrAnalysis-Exception'); } } }