| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace ThirdParty\Urs\Request;
- use ThirdParty\Urs\Dto\Config;
- abstract class BaseRequest extends \App\Module\ThirdParty\Services\BaseRequest
- {
- /**
- * 构造函数
- */
- public function __construct()
- {
- // 使用'urs'作为服务代码,需要在thirdparty_services表中注册
- parent::__construct('urs');
- }
- /**
- * 获取URS配置对象
- *
- * @return \ThirdParty\Urs\Dto\Config
- */
- protected function getUrsConfig(): \ThirdParty\Urs\Dto\Config
- {
- return Config::fromArray($this->service->config);
- }
- /**
- * 获取URS凭证对象
- *
- * @return \ThirdParty\Urs\Dto\Credential
- */
- protected function getUrsCredential(): \ThirdParty\Urs\Dto\Credential
- {
- // 从认证凭证中获取凭证信息,而不是从服务配置
- $credentials = $this->getCredential()->getDecryptedCredentials();
- return \ThirdParty\Urs\Dto\Credential::fromArray($credentials);
- }
- }
|