Compare commits
6 Commits
ad9e345eb3
...
73b922d8af
| Author | SHA1 | Date | |
|---|---|---|---|
| 73b922d8af | |||
| cba00aae41 | |||
| ded48e5dc1 | |||
| bde4ef5a0f | |||
| b72110fd2a | |||
| 2c61fd7184 |
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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";
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
// 验证云证书签名 验证无需处理,只要不返回错误即可
|
||||
|
||||
@ -152,6 +152,7 @@ class OrderPrescriptionService extends BaseService
|
||||
throw new BusinessException("医生开方日期错误");
|
||||
}
|
||||
|
||||
dump($user_id);
|
||||
$CaService = new CaService($order_prescription,$type,$user_id);
|
||||
|
||||
// 获取云证书签名+验证云证书签名
|
||||
|
||||
@ -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"] == "18012345001"){
|
||||
$doctor_params["multi_point_status"] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fields = [
|
||||
"user_doctor.doctor_id",
|
||||
"user_id",
|
||||
|
||||
@ -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();
|
||||
@ -2377,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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -231,7 +231,6 @@ class Wechat
|
||||
if ($response->isFailed()) {
|
||||
// 出错了,处理异常
|
||||
$result = $response->toArray();
|
||||
dump($result);
|
||||
if(empty($result)){
|
||||
// 返回值为空
|
||||
return [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user