disableQueryLog(); $this->info(date('m-d H:i:s') . ' 开始更新'); if(date('Y-m-d H:i:s') <= date('Y-m-d') . ' 00:00:50') { $this->date = $this->argument('date') ? $this->argument('date') : date('Y-m-d', strtotime('-1 days')); } else { $this->date = $this->argument('date') ? $this->argument('date') : date('Y-m-d'); } $this->userList(); $this->info(date('Y-m-d H:i:s') . ' 更新结束'); } public function userList() { try { $this->page = 1; do{ $params['timestamp'] = time(); $params['method'] = 'user.list'; $params['param'] = [ 'date' => $this->date, 'pageNum' => $this->page, 'pageSize' => $this->limit ]; $params['appId'] = config('capacity.app_id'); $secret = config('capacity.app_secret'); $params['signature'] = CapacityService::createSign($params['param'], $secret, $params['timestamp']); list($userList, $count) = CapacityService::orderList($params); Log::logInfo('容量平台用户信息', [$userList], 'CapacityUserList'); # 用户信息入库 foreach ($userList as $user) { CapacityUser::saveCapacityUser($user); } $this->page++; } while($this->page <= ceil($count / $this->limit)); } catch (\Exception $e) { Log::logError('容量平台用户获取过程发生异常', [ 'file' => $e->getFile(), 'line' => $e->getLine(), 'msg' => $e->getMessage(), 'trace' => $e->getTraceAsString() ], 'CapacityUserList-Exception'); } } }