去除问诊价格调整次数限制
This commit is contained in:
parent
9074bfd30c
commit
019ac8fcc5
@ -19,8 +19,8 @@ class TestController extends AbstractController
|
||||
// $this->test_8();
|
||||
// $this->test_3();
|
||||
// $this->test_4();
|
||||
$this->test_6();
|
||||
|
||||
// $this->test_6();
|
||||
$this->test_9();
|
||||
|
||||
}
|
||||
|
||||
@ -308,22 +308,12 @@ class TestController extends AbstractController
|
||||
|
||||
$pdf->AddPage();
|
||||
$pdf->Image('@' . $result, 10, 10, 0, 0, '', '', '', false, 300, '', false, false, 0, false, false, false);
|
||||
return $pdf->Output("","S");
|
||||
$pdf->Output(dirname(__DIR__, 2) . "/prescription_img.pdf","F");
|
||||
}
|
||||
|
||||
// pdf进行签章
|
||||
public function test_6(){
|
||||
$pdf_file = $this->test_5();
|
||||
|
||||
// $oss = new Oss();
|
||||
// $filename = "Basic/images/prescription_img.jpg";
|
||||
//
|
||||
// $pdf_file = $oss->getObjectToRAM($filename);
|
||||
// $pdf_file = file_get_contents('./runtime/dsddasdasdasdasdasdsa.pdf');
|
||||
|
||||
// $pdf_file = new \CURLFILE('./runtime/dsddasdasdasdasdasdsa.pdf');
|
||||
// $pdf_file = fopen("/Users/wucongxing/Desktop/work/php/hospital-applets-api/runtime/dsddasdasdasdasdasdsa.pdf",'f');
|
||||
// dump($pdf_file);die;
|
||||
$pdf_file = fopen("./runtime/prescription_img.pdf",'r');
|
||||
|
||||
$oss = new Oss();
|
||||
|
||||
@ -337,8 +327,6 @@ class TestController extends AbstractController
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// $sign_image = urlencode($sign_image);
|
||||
|
||||
$sign_param = [
|
||||
[
|
||||
"llx"=> "700", // 左边底部X坐标
|
||||
@ -355,7 +343,8 @@ class TestController extends AbstractController
|
||||
|
||||
$ca = new Ca();
|
||||
$result = $ca->addSignPdf("491925054435950592",$data);
|
||||
dump($result);
|
||||
// fclose($data['pdf_file']);
|
||||
|
||||
}
|
||||
|
||||
// 延迟队列测试
|
||||
@ -397,4 +386,11 @@ class TestController extends AbstractController
|
||||
$ca = new Ca();
|
||||
$result = $ca->deleteUserSignConfig("491925054435950592");
|
||||
}
|
||||
|
||||
// 下载签章的pdf文件
|
||||
public function test_9(){
|
||||
$ca = new Ca();
|
||||
$result = $ca->getSignedFile("491925054435950592","1638477783898161153");
|
||||
}
|
||||
|
||||
}
|
||||
@ -338,30 +338,30 @@ class DoctorInquiryService extends BaseService
|
||||
}
|
||||
} else {
|
||||
// 在线问诊限制在线问诊验证修改次数
|
||||
if ($inquiry_type == 1 && $doctor_inquiry_config['inquiry_price'] != $inquiry_price) {
|
||||
// 获取月份内总调整次数
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $user_info['client_user_id']];
|
||||
$params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']];
|
||||
$params[] = ['created_at', '>', date('Y-m-01', time())];
|
||||
$modify_month_count = DoctorInquiryPriceRecord::getCount($params);
|
||||
if ($modify_month_count >= 5) {
|
||||
// 每自然月仅限调整5次
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每自然月仅限调整5次");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params[] = ['doctor_id', '=', $user_info['client_user_id']];
|
||||
$params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']];
|
||||
$params[] = ['created_at', '>', date('Y-m-d', time())];
|
||||
$modify_month_count = DoctorInquiryPriceRecord::getCount($params);
|
||||
if ($modify_month_count >= 1) {
|
||||
// 问诊价格每日仅限调整1次
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每日仅限调整1次");
|
||||
}
|
||||
}
|
||||
// if ($inquiry_type == 1 && $doctor_inquiry_config['inquiry_price'] != $inquiry_price) {
|
||||
// // 获取月份内总调整次数
|
||||
// $params = array();
|
||||
// $params[] = ['doctor_id', '=', $user_info['client_user_id']];
|
||||
// $params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']];
|
||||
// $params[] = ['created_at', '>', date('Y-m-01', time())];
|
||||
// $modify_month_count = DoctorInquiryPriceRecord::getCount($params);
|
||||
// if ($modify_month_count >= 5) {
|
||||
// // 每自然月仅限调整5次
|
||||
// Db::rollBack();
|
||||
// return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每自然月仅限调整5次");
|
||||
// }
|
||||
//
|
||||
// $params = array();
|
||||
// $params[] = ['doctor_id', '=', $user_info['client_user_id']];
|
||||
// $params[] = ['inquiry_config_id', '=', $doctor_inquiry_config['inquiry_config_id']];
|
||||
// $params[] = ['created_at', '>', date('Y-m-d', time())];
|
||||
// $modify_month_count = DoctorInquiryPriceRecord::getCount($params);
|
||||
// if ($modify_month_count >= 1) {
|
||||
// // 问诊价格每日仅限调整1次
|
||||
// Db::rollBack();
|
||||
// return fail(HttpEnumCode::HTTP_ERROR, "问诊价格每日仅限调整1次");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 修改
|
||||
if ($doctor_inquiry_config['work_num_day'] != $work_num_day || $doctor_inquiry_config['inquiry_price'] != $inquiry_price) {
|
||||
|
||||
@ -28,7 +28,7 @@ class PatientDoctorService extends BaseService
|
||||
$expertise_id = $this->request->input('expertise_id');
|
||||
$province_id = $this->request->input('province_id');
|
||||
$city_id = $this->request->input('city_id');
|
||||
$sort_order = $this->request->input('sort_order');
|
||||
$sort_order = $this->request->input('sort_order',1);
|
||||
$keyword = $this->request->input('keyword',"");
|
||||
$page = $this->request->input('page',1);
|
||||
$per_page = $this->request->input('per_page',10);
|
||||
|
||||
@ -141,4 +141,5 @@ class Oss
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -24,7 +24,8 @@ class Ca
|
||||
#[Inject]
|
||||
protected Client $client;
|
||||
|
||||
public function __construct(){
|
||||
public function __construct()
|
||||
{
|
||||
$this->container = ApplicationContext::getContainer();
|
||||
$this->client = $this->container->get(Client::class);
|
||||
}
|
||||
@ -91,7 +92,8 @@ class Ca
|
||||
|
||||
// PKCS7签名验证接口
|
||||
// 对客户端签名信息进行验证,返回证书信息,同时可以配置回调服务,在验证成功后回调业务系统
|
||||
public function verifyPkcs7(string $sign_p7,array $data){
|
||||
public function verifyPkcs7(string $sign_p7, array $data)
|
||||
{
|
||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||
|
||||
$option = [
|
||||
@ -208,20 +210,17 @@ class Ca
|
||||
|
||||
/**
|
||||
* PDF添加电子签章
|
||||
* @param string $user_id
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function addSignPdf(string $user_id,array $data){
|
||||
public function addSignPdf(string $user_id, array $data)
|
||||
{
|
||||
$option = [
|
||||
// 'form_params' => [
|
||||
// 'userId' => $user_id,// 用户标识信息
|
||||
// 'configKey' => $user_id,// 签章配置唯一标识
|
||||
// 'signParams' => $data['sign_param'],// 签章参数,JSON格式数据,如果不指定,那么以签章配置接口配置为准
|
||||
// 'pdfFile' => $data['pdf_file'],// 待签章PDF文件(字节流)
|
||||
// 'cloudCertPass' => $user_id,// 云证书PIN码,云证书签章时使用
|
||||
// ],
|
||||
'multipart' => [
|
||||
[
|
||||
'name' => 'pdfFile',
|
||||
'contents' => $data['pdf_file'],
|
||||
'contents' => $data['pdf_file'],// 待签章PDF文件(字节流)
|
||||
],
|
||||
[
|
||||
'name' => 'userId',
|
||||
@ -258,6 +257,35 @@ class Ca
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载签章的pdf文件
|
||||
* @param string $user_id
|
||||
* @param string $file_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSignedFile(string $user_id, string $file_id): mixed
|
||||
{
|
||||
$option = [
|
||||
'form_params' => [
|
||||
'userId' => $user_id,// 用户标识信息(为云证书entityId)
|
||||
'fileId' => $file_id,// 签章接口返回的文件标识
|
||||
]
|
||||
];
|
||||
|
||||
try {
|
||||
$response = $this->httpRequest(
|
||||
config("ca.api_url") . '/signature-server/api/open/signature/fetchSignedFile',
|
||||
$option
|
||||
);
|
||||
if (empty($response)) {
|
||||
// 返回值为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
return $response;
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -267,21 +295,25 @@ class Ca
|
||||
*/
|
||||
protected function getRequestSign(array $data): string
|
||||
{
|
||||
$sign_data = array();
|
||||
if (isset($data['form_params'])) {
|
||||
$sign_data = $data['form_params'];
|
||||
}
|
||||
|
||||
if (isset($data['multipart'])) {
|
||||
foreach ($data['multipart'] as $item) {
|
||||
// pdf进行签章时,此参数为文件流,不参与签名
|
||||
unset($data['form_params']['pdfFile']);
|
||||
if ($item['name'] == "pdfFile") {
|
||||
continue;
|
||||
}
|
||||
|
||||
// signParams参数计算时不进行urlencode处理
|
||||
// if (isset($data['form_params']['signParams'])){
|
||||
// $sign_param = json_decode($data['form_params']['signParams'],true);
|
||||
// $sign_param[0]['sealImg'] = urldecode($sign_param[0]['sealImg']);
|
||||
//
|
||||
// $data['form_params']['signParams'] = json_encode($sign_param);
|
||||
// }
|
||||
$sign_data[$item['name']] = $item['contents'];
|
||||
}
|
||||
}
|
||||
|
||||
ksort($sign_data);
|
||||
$data = implode('&', $sign_data);
|
||||
|
||||
ksort($data['form_params']);
|
||||
$data = implode('&',$data['form_params']);
|
||||
dump($data);
|
||||
$data = hash_hmac("sha1", $data, config("ca.secret"));
|
||||
return $data;
|
||||
}
|
||||
@ -304,11 +336,7 @@ class Ca
|
||||
|
||||
$arg = array_merge($arg, $option);
|
||||
|
||||
try {
|
||||
$response = $this->client->post($path, $arg);
|
||||
}catch(\Exception $e){
|
||||
dump($e->getMessage());
|
||||
}
|
||||
|
||||
if ($response->getStatusCode() != '200') {
|
||||
// 请求失败
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user