From 2c61fd718479380549c83dc93a445a70bb2a434e Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 15 Aug 2025 14:05:13 +0800 Subject: [PATCH 1/5] 111 --- app/Services/OrderPrescriptionService.php | 1 + app/Services/UserDoctorService.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Services/OrderPrescriptionService.php b/app/Services/OrderPrescriptionService.php index a5751b2..e34a073 100644 --- a/app/Services/OrderPrescriptionService.php +++ b/app/Services/OrderPrescriptionService.php @@ -152,6 +152,7 @@ class OrderPrescriptionService extends BaseService throw new BusinessException("医生开方日期错误"); } + dump($user_id); $CaService = new CaService($order_prescription,$type,$user_id); // 获取云证书签名+验证云证书签名 diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index a342328..2387c99 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1542,6 +1542,7 @@ class UserDoctorService extends BaseService // 开具处方 $OrderPrescriptionService = new OrderPrescriptionService(); + dump($user_info['user_id']); $prescription_open_result = $OrderPrescriptionService->openPrescription($order_prescription->order_prescription_id,2,$user_info['user_id']); if (empty($prescription_open_result['prescription_img_oss_path']) || empty($prescription_open_result['file_id'])){ Db::rollBack(); From b72110fd2a5dcf1762f6bd77f4ec0f35aa31b6f6 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 15 Aug 2025 14:07:04 +0800 Subject: [PATCH 2/5] 11133 --- app/Services/CaService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/CaService.php b/app/Services/CaService.php index 050854a..03b2adf 100644 --- a/app/Services/CaService.php +++ b/app/Services/CaService.php @@ -249,6 +249,7 @@ class CaService extends BaseService $data['product'][] = $product; } + dump($this->entity_id); $cert_sign_result = $CaOnline->getCertSign($this->entity_id, $this->entity_id, $data); // 验证云证书签名 验证无需处理,只要不返回错误即可 From bde4ef5a0f1f5eceffac6daa0134763099a34ee4 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 4 Sep 2025 13:01:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/UserDoctorInfo.php | 3 ++- app/Services/UserDoctorService.php | 10 ++++++++++ app/Utils/HttpRequest.php | 20 ++++++++++++++++++++ extend/Wechat/Wechat.php | 1 - 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/Model/UserDoctorInfo.php b/app/Model/UserDoctorInfo.php index 1e5b07c..59dcb65 100644 --- a/app/Model/UserDoctorInfo.php +++ b/app/Model/UserDoctorInfo.php @@ -25,6 +25,7 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property string $id_card_front 身份证正面图片 * @property string $id_card_back 身份证背面图片 * @property string $sign_image 签名图片 + * @property string $register_cert 电子注册证图片 * @property \Carbon\Carbon $created_at 创建时间 * @property \Carbon\Carbon $updated_at 修改时间 */ @@ -40,7 +41,7 @@ class UserDoctorInfo extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['doctor_info_id', 'user_id', 'doctor_id', 'card_type', 'card_name', 'card_name_mask', 'card_num', 'card_num_mask', 'license_cert', 'qualification_cert', 'qualification_cert_num', 'work_cert', 'multi_point_images', 'id_card_front', 'id_card_back', 'sign_image', 'created_at', 'updated_at']; + protected array $fillable = ['doctor_info_id', 'user_id', 'doctor_id', 'card_type', 'card_name', 'card_name_mask', 'card_num', 'card_num_mask', 'license_cert', 'qualification_cert', 'qualification_cert_num', 'work_cert', 'multi_point_images', 'id_card_front', 'id_card_back', 'sign_image', 'register_cert', 'created_at', 'updated_at']; protected string $primaryKey = "doctor_info_id"; diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 2387c99..a0a4415 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -2378,6 +2378,16 @@ class UserDoctorService extends BaseService $userDoctorService = new UserDoctorService(); $result['multi_point_enable'] = $userDoctorService->getDoctorMultiPointEnable($doctor_id); + // 获取医生详情数据 + $result['register_cert'] = ""; + $params = array(); + $params['doctor_id'] = $user_doctor['doctor_id']; + $user_doctor_info = UserDoctorInfo::getOne($params); + if (!empty($user_doctor_info)){ + if (!empty($user_doctor_info["register_cert"])){ + $result['register_cert'] = addAliyunOssWebsite($user_doctor_info["register_cert"]); + } + } return success($result); } diff --git a/app/Utils/HttpRequest.php b/app/Utils/HttpRequest.php index 6ccddb1..68f09c0 100644 --- a/app/Utils/HttpRequest.php +++ b/app/Utils/HttpRequest.php @@ -35,4 +35,24 @@ class HttpRequest return json_decode($response->getBody(),true); } + + /** + * 请求封装 + * post请求 + * @param string $path + * @param array $option + * @return array + * @throws GuzzleException + */ + public function getRequest(string $path, array $option = []): array + { + $response = $this->client->get($path, $option); + + if ($response->getStatusCode() != '200'){ + // 请求失败 + throw new BusinessException(HttpEnumCode::SERVER_ERROR,$response->getBody()->getContents()); + } + + return json_decode($response->getBody(),true); + } } \ No newline at end of file diff --git a/extend/Wechat/Wechat.php b/extend/Wechat/Wechat.php index edefd57..05c5ecd 100644 --- a/extend/Wechat/Wechat.php +++ b/extend/Wechat/Wechat.php @@ -231,7 +231,6 @@ class Wechat if ($response->isFailed()) { // 出错了,处理异常 $result = $response->toArray(); - dump($result); if(empty($result)){ // 返回值为空 return []; From ded48e5dc119a9d7c6831ce79cfa7aaf9ca69368 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 11 Sep 2025 09:24:04 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=B9=B4=E5=AE=A1=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B4=E6=94=B9=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E5=85=B3=E8=81=94=E7=A1=AE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientDoctorController.php | 2 + app/Controller/TestController.php | 109 +++++++++++++++++++++ app/Services/PatientDoctorService.php | 17 ++++ 3 files changed, 128 insertions(+) diff --git a/app/Controller/PatientDoctorController.php b/app/Controller/PatientDoctorController.php index b4c868a..53f8758 100644 --- a/app/Controller/PatientDoctorController.php +++ b/app/Controller/PatientDoctorController.php @@ -26,6 +26,8 @@ class PatientDoctorController extends AbstractController $request = $this->container->get(PatientDoctorRequest::class); $request->scene('getInquiryDoctorList')->validateResolved(); + $user_info = $this->request->getAttribute("userInfo") ?? []; + $PatientDoctorService = new PatientDoctorService(); $data = $PatientDoctorService->getInquiryDoctorList(); return $this->response->json($data); diff --git a/app/Controller/TestController.php b/app/Controller/TestController.php index a752847..762ad0a 100644 --- a/app/Controller/TestController.php +++ b/app/Controller/TestController.php @@ -55,6 +55,7 @@ use App\Services\PatientOrderService; use App\Services\UserCouponService; use App\Services\UserDoctorService; use App\Utils\Data; +use App\Utils\HttpRequest; use App\Utils\Jwt; use App\Utils\Log; use App\Utils\Mask; @@ -507,6 +508,51 @@ class TestController extends AbstractController // $PatientOrderService = new PatientOrderService(); // $product_datas = $PatientOrderService->calculateProductOrderItemActualPrice($product_datas,$coupons); // dump($product_datas); + + // 使用 +// $params = [ +// 'project_id' => "1897100403531583488", +// 'starttime' => "2025-03-05 00:00:00", +// 'endtime' => "2025-03-05 23:59:59" +// ]; + $params = [ + 'sid' => "1897103702804664320", + 'starttime' => "2025-03-05 00:00:00", + 'endtime' => "2025-03-05 23:59:59" + ]; + $timestamp = 1736755831000; + $secret = 'zxcv'; + + try { + $signature = $this->genSignature($params, (string)$timestamp, $secret); + + $HttpRequest = new HttpRequest(); + $requestUrl = "127.0.0.1:8513/res/case/behavior/list"; + + $option = [ +// 'headers' => [ +// 'platformKey' => '654321', +// 'sign' => $signature, +// 'timestamp' => "1736755831000", +// ], + 'headers' => [ + 'platformKey' => '654321', + 'sign' => $signature, + 'timestamp' => "1736755831000", + ], + 'query' => [ + 'sid' => "1897103702804664320", + 'starttime' => "2025-03-05 00:00:00", + 'endtime' => "2025-03-05 23:59:59" + ] + ]; + + $data = $HttpRequest->getRequest($requestUrl,$option); + dump($data); + + } catch (\Throwable $e) { + echo "错误: " . $e->getMessage() . "\n"; + } } // 退款 @@ -959,4 +1005,67 @@ class TestController extends AbstractController return success(); } + + /** + * 生成签名 + * + * @param array $paramsMap 请求参数数组 + * @param string $timestamp 时间戳 + * @param string $secret 秘钥 + * @return string 签名 + */ + function genSignature(array $paramsMap, string $timestamp, string $secret): string { + // 对参数进行排序 + $paramsData = $this->sortMapParams($paramsMap); + $paramsData['timestamp'] = $timestamp; + + // 转换为 JSON + $jsonData = json_encode($paramsData, JSON_UNESCAPED_UNICODE); + if ($jsonData === false) { + return "错误"; + } + + dump($jsonData); + + // 计算 HMAC-SHA256 签名 + return $this->hmacSHA256($jsonData, $secret); + } + + /** + * 对数组的键进行排序,包括多层嵌套 + * + * @param array $data 输入的数组 + * @return array 排序后的数组 + */ + function sortMapParams(array $data): array { + ksort($data); // 对键进行升序排序 + foreach ($data as $key => &$value) { + if (is_array($value)) { + if (array_keys($value) !== range(0, count($value) - 1)) { + // 如果是关联数组,递归排序 + $value = $this->sortMapParams($value); + } else { + // 如果是索引数组,递归处理其中的每个元素 + foreach ($value as &$subValue) { + if (is_array($subValue)) { + $subValue = $this->sortMapParams($subValue); + } + } + } + } + } + return $data; + } + + /** + * 计算 HMAC-SHA256 签名 + * + * @param string $data 要签名的数据 + * @param string $key 秘钥 + * @return string 签名 + */ + function hmacSHA256(string $data, string $key): string { + return hash_hmac('sha256', $data, $key); + } + } \ No newline at end of file diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index cda5ba2..e9845f4 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -75,6 +75,23 @@ class PatientDoctorService extends BaseService $doctor_params["iden_auth_status"] = 1;// 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败) $doctor_params["is_bind_bank"] = 1;// 是否已绑定结算银行卡(0:否 1:是) + $user_info = $this->request->getAttribute("userInfo") ?? []; + $params = array(); + $params['user_id'] = $user_info['user_id']; + $user = User::getOne($params); + if (!empty($user)){ + if ($user["mobile"] == "15026619021"){ + $doctor_params["multi_point_status"] = 1; + } + + $app_env = config('app_env','dev'); + if ($app_env == 'dev'){ + if ($user["mobile"] == "17600901561"){ + $doctor_params["multi_point_status"] = 1; + } + } + } + $fields = [ "user_doctor.doctor_id", "user_id", From cba00aae41be0d8651a85fcf94277c71a1bfe4b8 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 11 Sep 2025 09:29:28 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=B9=B4=E5=AE=A1=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B4=E6=94=B9=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E5=85=B3=E8=81=94=E7=A1=AE=E5=AE=9A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientDoctorService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PatientDoctorService.php b/app/Services/PatientDoctorService.php index e9845f4..71b1026 100644 --- a/app/Services/PatientDoctorService.php +++ b/app/Services/PatientDoctorService.php @@ -86,7 +86,7 @@ class PatientDoctorService extends BaseService $app_env = config('app_env','dev'); if ($app_env == 'dev'){ - if ($user["mobile"] == "17600901561"){ + if ($user["mobile"] == "18012345001"){ $doctor_params["multi_point_status"] = 1; } }