utils = UtilsService::getInstance(); $token = WxTokenService::getInstance(); if ($this->needLogin) { $this->userInfo = $token->requireUser(); } else { $this->userInfo = $token->resolveUser(request()->bearerToken()) ?? []; } $this->userId = (int) ($this->userInfo['id'] ?? 0); } /** * 当前用户是否可见价格 */ protected function canSeePrice(): bool { return (bool) ($this->userInfo['show_price'] ?? 0); } /** * 当前用户的价格倍率 */ protected function priceMultiplier(): mixed { return $this->userInfo['price_number'] ?? 1; } }