修正退出登录

This commit is contained in:
2023-03-17 09:00:51 +08:00
parent 21320b3ea4
commit f9e86d27b7
4 changed files with 92 additions and 11 deletions
+26 -10
View File
@@ -54,24 +54,42 @@ class Ca
}
}
// 获取云证书签名
public function getCertSign(array $data){
/**
* 获取云证书签名
* @param array $data
* @return mixed
*/
public function getCertSign(array $data): mixed
{
$option = [
'form_params' => [
'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义
'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational]
'toSign' => $this->getRequestSign($data),
'pin' => $data['user_id'], // 证书PIN码
'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码)
]
];
try {
$response = $this->httpRequest(
config("ca.api_url") . '/cloud-certificate-service' . '/api/cloudCert/open/cert/sign',
$option
);
if (empty($response)){
// 返回值为空
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
}
return $response;
} catch (GuzzleException $e) {
throw new BusinessException($e->getMessage());
}
}
/**
* 获取签名
* 获取请求签名
* @param array $data
* @return string
*/
protected function getSign(array $data): string
protected function getRequestSign(array $data): string
{
ksort($data['form_params']);
@@ -86,19 +104,17 @@ class Ca
* @return mixed
* @throws GuzzleException
*/
public function httpRequest(string $path,array $arg = []): mixed
protected function httpRequest(string $path,array $arg = []): mixed
{
$option = [
"headers" => [
"app_id" => config("ca.app_id"),
"signature" => $this->getSign($arg)
"signature" => $this->getRequestSign($arg)
],
];
$arg = array_merge($arg,$option);
dump($arg);
dump($path);
$response = $this->client->post($path, $arg);
if ($response->getStatusCode() != '200'){
// 请求失败