app_id = $offline['app_id']; $this->api_url = $offline['api_url']; $this->secret = $offline['secret']; } /** * 申请云证书 * @param array $data * @param string $type * @return mixed */ protected function getCloudCert(array $data,string $type = "Personal"): mixed { $option = [ 'form_params' => [ 'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义 'entityType' => $type,// 用户类型,可选值[Personal/Organizational] 'pin' => $data['user_id'], // 证书PIN码 'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码) ] ]; try { $response = $this->httpRequest($this->api_url . '/cloud-certificate-service' . '/api/cloudCert/open/v2/cert/offlineAuthCertEnroll', $option); if (empty($response)) { // 返回值为空 throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); } return $response; } catch (GuzzleException $e) { throw new BusinessException($e->getMessage()); } } }