修改添加签章配置重复问题
This commit is contained in:
+30
-6
@@ -115,7 +115,7 @@ abstract class Ca
|
||||
*/
|
||||
public function addUserSignConfig(string $user_id, string $card_num, array $data): bool
|
||||
{
|
||||
$option = [
|
||||
$arg = [
|
||||
'form_params' => [
|
||||
'userId' => $user_id,//用户标识信息(为云证书entityId)
|
||||
'configKey' => $user_id, // 签章配置唯一标识,一张云证书配置一个
|
||||
@@ -130,17 +130,41 @@ abstract class Ca
|
||||
];
|
||||
|
||||
try {
|
||||
$response = $this->httpRequest(
|
||||
$this->api_url . '/signature-server/api/open/signature/userSignConfig',
|
||||
$option
|
||||
);
|
||||
$option = [
|
||||
"headers" => [
|
||||
"app_id" => $this->app_id,
|
||||
"signature" => $this->getRequestSign($arg),
|
||||
],
|
||||
];
|
||||
|
||||
$option = array_merge($arg, $option);
|
||||
|
||||
$response = $this->client->post($this->api_url . '/signature-server/api/open/signature/userSignConfig', $option);
|
||||
|
||||
if ($response->getStatusCode() != '200') {
|
||||
// 请求失败
|
||||
throw new BusinessException($response->getBody()->getContents());
|
||||
}
|
||||
|
||||
$body = json_decode($response->getBody(), true);
|
||||
if (empty($body)) {
|
||||
// 返回值为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
dump($response);
|
||||
if ($response['result_code'] == "1104"){
|
||||
// 用户标识已经存在,请检查!
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($body['result_code'] != 0) {
|
||||
// 请求失败
|
||||
if (!empty($body['result_msg'])) {
|
||||
throw new BusinessException($body['result_msg']);
|
||||
}
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user