This commit is contained in:
2023-03-16 16:48:56 +08:00
parent 16f68e65b5
commit cb782ed4e2
3 changed files with 21 additions and 11 deletions
+7 -7
View File
@@ -33,12 +33,13 @@ class Ca
'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义
'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational]
'pin' => $data['user_id'], // 证书PIN码
// 'pin' => "123", // 证书PIN码
'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码)
]
];
try {
$response = $this->httpRequest(config("ca.api_url") . '/cloud-certificate-service' . '/api/cloudCert/open/V2/cert/offlineAuthCertEnroll', $option);
$response = $this->httpRequest(config("ca.api_url") . '/cloud-certificate-service' . '/api/cloudCert/open/v2/cert/offlineAuthCertEnroll', $option);
if (empty($response)){
// 返回值为空
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
@@ -57,6 +58,8 @@ class Ca
*/
protected function getSign(array $data): string
{
ksort($data['form_params']);
$data = implode('&',$data['form_params']);
return hash_hmac("sha1",$data,config("ca.secret"));
}
@@ -79,18 +82,15 @@ class Ca
];
$arg = array_merge($arg,$option);
dump($path);die;
dump($arg);die;
dump($arg);
dump($path);
$response = $this->client->post($path, $arg);
dump(1);
if ($response->getStatusCode() != '200'){
// 请求失败
throw new BusinessException($response->getBody()->getContents());
}
dump(2);
$body = json_decode($response->getBody(),true);
dump($body);die;
dump($body);
if (empty($body)){
// 返回值为空
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));