From 25ce316ce9853de476a0b4bf01c94f47b7496f30 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 23 Oct 2023 11:56:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BA=91=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E5=90=8A=E9=94=80=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/TestController.php | 68 ++++++++++++++----------------- extend/Ca/CaOnline.php | 31 ++++++++++++++ 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index f068759..6442d41 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -77,7 +77,7 @@ class TestController extends AbstractController // $this->test_12(); // $this->test_13(); // $this->test_14(); - $this->test_15(); + $this->test_14(); } // 获取未接诊的医生 @@ -300,29 +300,29 @@ class TestController extends AbstractController public function test_14(){ $CaOnline = new CaOnline(); -// // 测试医生 -// $data = array(); -// $data['user_id'] = "491925054435950592"; -// $data['mobile'] = "13028643897"; -// $data['card_name'] = "郝明明"; -// $data['card_num'] = "130582199202032038"; -// $data['orgDept'] = "科室名称"; -// $data['org_name'] = "成都金牛欣欣相照互联网医院有限公司"; -// $data['org_number'] = "91510106MABTJY4K9R"; -// $result = $CaOnline->getCloudCert($data); -// -// $data = array(); -// $data['user_id'] = "491925054435950592"; -// $data['type'] = 2; -// $data['cert_base64'] = $result['certBase64']; -// $data['cert_chain_p7'] = $result['certP7']; -// $data['cert_serial_number'] = $result['certSerialnumber']; -// $data['ca_pin'] = "491925054435950592"; -// $doctor_pharmacist_cert = UserCaCert::addDoctorPharmacistCert($data); -// if (empty($doctor_pharmacist_cert)){ -// return fail(); -// } -// dump(111); + // 测试医生 + $data = array(); + $data['user_id'] = "491925054435950592"; + $data['mobile'] = "13028643897"; + $data['card_name'] = "郝明明"; + $data['card_num'] = "130582199202032038"; + $data['orgDept'] = "科室名称"; + $data['org_name'] = "成都金牛欣欣相照互联网医院有限公司"; + $data['org_number'] = "91510106MABTJY4K9R"; + $result = $CaOnline->getCloudCert($data); + + $data = array(); + $data['user_id'] = "491925054435950592"; + $data['type'] = 2; + $data['cert_base64'] = $result['certBase64']; + $data['cert_chain_p7'] = $result['certP7']; + $data['cert_serial_number'] = $result['certSerialnumber']; + $data['ca_pin'] = "491925054435950592"; + $doctor_pharmacist_cert = UserCaCert::addUserCaCert($data); + if (empty($doctor_pharmacist_cert)){ + return fail(); + } + dump(111); // // 测试药师 // $data = array(); @@ -370,22 +370,14 @@ class TestController extends AbstractController } public function test_15(){ - $params = array(); - $params[] = ['inquiry_type','=',2]; - $params[] = ['inquiry_mode','=',1]; - $params[] = ['start_time','<',date('H',time()) . date('i',time())]; - $params[] = ['end_time','>',date('H',time()) . date('i',time())]; + $CaOnline = new CaOnline(); - $user_doctor_params = array(); - $user_doctor_params['is_platform_deep_cooperation'] = 1; + $a = array( + "user_id" => 491925054435950592 + ); + $data = $CaOnline->removeCloudCert($a); - $doctor_inquiry_config_params = array(); - $doctor_inquiry_config_params['inquiry_type'] = 2; - $doctor_inquiry_config_params['inquiry_mode'] = 1; - $doctor_inquiry_config_params['is_enable'] = 1; - - $doctor_inquiry_times = DoctorInquiryTime::getMinPlatDeepCooperationDoctor($params,$user_doctor_params,[],$doctor_inquiry_config_params); - dump($doctor_inquiry_times); + dump($data); } // 设置坐班医生 diff --git a/extend/Ca/CaOnline.php b/extend/Ca/CaOnline.php index 5f038fe..898a8ab 100644 --- a/extend/Ca/CaOnline.php +++ b/extend/Ca/CaOnline.php @@ -62,4 +62,35 @@ class CaOnline extends Ca throw new BusinessException($e->getMessage()); } } + + /** + * 吊销云证书 + * @param array $data + * @param string $type + * @return mixed + */ + public function removeCloudCert(array $data, string $type = "Personal"): mixed + { + $option = [ + 'form_params' => [ + 'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义 + 'pin' => $data['user_id'], // 证书PIN码 + 'authType' => "实人认证", // 委托鉴证方式[实人认证、线下认证、其它方式认证] + 'authTime' => time(), // 委托鉴证时间(鉴证完成的时间戳)单位:秒 + 'authResult' => "认证通过", // 委托鉴证结果[认证通过] + 'authNoticeType' => "数字证书吊销告知", // 委托鉴证告知类型[数字证书申请告知] + ] + ]; + + try { + $response = $this->httpRequest($this->api_url . '/cloud-certificate-service' . '/api/cloudCert/open/v2/cert/certRevoke', $option); + if (empty($response)) { + // 返回值为空 + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + return $response; + } catch (GuzzleException $e) { + throw new BusinessException($e->getMessage()); + } + } } \ No newline at end of file