新增ca认证对接、新增银行卡、身份证验证、修正消息通知
This commit is contained in:
parent
dcb2e801ce
commit
398bbf3a8c
@ -53,21 +53,21 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
}
|
||||
|
||||
// 检测订单分配状态
|
||||
if (!empty($order_inquiry['doctor_id'])){
|
||||
if (!empty($order_inquiry['doctor_id'])) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("队列执行失败原因:已分配医生");
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单类型
|
||||
if ($order_inquiry['inquiry_type'] != 2 && $order_inquiry['inquiry_type'] != 4){
|
||||
if ($order_inquiry['inquiry_type'] != 2 && $order_inquiry['inquiry_type'] != 4) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("队列执行失败原因:订单非快速问诊、问诊购药类型");
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单退款状态
|
||||
if (in_array($order_inquiry['inquiry_refund_status'],[1,2,3])){
|
||||
if (in_array($order_inquiry['inquiry_refund_status'], [1, 2, 3])) {
|
||||
Db::rollBack();
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
Log::getInstance()->error("队列执行失败原因:订单存在退款");
|
||||
@ -75,25 +75,25 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if ($order_inquiry['inquiry_status'] != 2){
|
||||
if ($order_inquiry['inquiry_status'] != 2) {
|
||||
Db::rollBack();
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
Log::getInstance()->info("订单状态错误:当前为" . $order_inquiry['inquiry_status'] . " 无法进行分配");
|
||||
Log::getInstance()->info("订单状态错误:当前为" . $order_inquiry['inquiry_status'] . " 无法进行分配");
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单支付状态
|
||||
if ($order_inquiry['inquiry_pay_status'] != 2){
|
||||
if ($order_inquiry['inquiry_pay_status'] != 2) {
|
||||
Db::rollBack();
|
||||
// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
Log::getInstance()->info("订单支付状态错误:当前为" . $order_inquiry['inquiry_pay_status'] . " 无法进行分配");
|
||||
Log::getInstance()->info("订单支付状态错误:当前为" . $order_inquiry['inquiry_pay_status'] . " 无法进行分配");
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单分配时间
|
||||
$pay_time = strtotime($order_inquiry['pay_time']);
|
||||
$diff_time = time() - $pay_time;
|
||||
if ($diff_time < 0){
|
||||
if ($diff_time < 0) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("订单支付状态错误:时间计算错误");
|
||||
return Result::DROP;// 销毁
|
||||
@ -101,15 +101,15 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
|
||||
$redis = $this->container->get(Redis::class);
|
||||
|
||||
if ($diff_time > 300){
|
||||
if ($diff_time > 300) {
|
||||
// 超出5分钟,执行退款
|
||||
Log::getInstance()->info("超出5分钟,执行退款");
|
||||
|
||||
$redis_key = "inquiryRefund" . $order_inquiry['order_inquiry_id'];
|
||||
$redis_value = $redis->get($redis_key);
|
||||
if (!empty($redis_value)){
|
||||
if (!empty($redis_value)) {
|
||||
// 判断退款次数
|
||||
if ($redis_value >= 3){
|
||||
if ($redis_value >= 3) {
|
||||
Log::getInstance()->info("退款取消,退款失败次数过多");
|
||||
|
||||
// 加入短信队列
|
||||
@ -118,15 +118,15 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
}
|
||||
|
||||
$redis_value = $redis_value + 1;
|
||||
}else{
|
||||
} else {
|
||||
$redis_value = 1;
|
||||
}
|
||||
|
||||
try {
|
||||
$InquiryService = new InquiryService();
|
||||
$InquiryService->inquiryRefund($order_inquiry['order_inquiry_id'],"暂无医生接诊");
|
||||
$InquiryService->inquiryRefund($order_inquiry['order_inquiry_id'], "暂无医生接诊");
|
||||
|
||||
$redis->set($redis_key,$redis_value);
|
||||
$redis->set($redis_key, $redis_value);
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("队列执行失败原因:退款失败,原因:" . $e->getMessage());
|
||||
@ -137,20 +137,20 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
// 分配医生
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$doctor_id = $UserDoctorService->getInquiryAssignDoctor($order_inquiry['inquiry_type']);
|
||||
if (empty($doctor_id)){
|
||||
if (empty($doctor_id)) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->error("重回队列,目前没有合适医生");
|
||||
|
||||
$redis_key = "AssignDoctor" . $order_inquiry['order_inquiry_id'];
|
||||
$redis_value = $redis->get($redis_key);
|
||||
if (!empty($redis_value)){
|
||||
if (!empty($redis_value)) {
|
||||
$redis_value = $redis_value + 1;
|
||||
}else{
|
||||
} else {
|
||||
$redis_value = 1;
|
||||
}
|
||||
|
||||
// 添加缓存,添加失败情况不考虑,最终都会睡眠5秒
|
||||
$redis->set($redis_key,$redis_value);
|
||||
$redis->set($redis_key, $redis_value);
|
||||
|
||||
// 执行睡眠,防止重复执行队列
|
||||
// 执行规则,第一次5秒,第二次10秒。以5的倍数增加
|
||||
@ -166,7 +166,7 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
OrderInquiry::edit($params, $data);
|
||||
|
||||
Db::commit();
|
||||
Log::getInstance()->error("分配医生 队列执行成功");
|
||||
@ -185,16 +185,31 @@ class AssignDoctorConsumer extends ConsumerMessage
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
Log::getInstance()->info("医生数据错误");
|
||||
return Result::ACK;
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
$ImService->sendTextMessage($user_doctor['user_id'],$order_inquiry['user_id'],"等待医生接诊",$order_inquiry['order_inquiry_id'],$order_inquiry['inquiry_type']);
|
||||
// 自定义消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = $order_inquiry['inquiry_type'];
|
||||
|
||||
// 消息内容
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 1;
|
||||
$message_content_data['content'] = "--等待医生接诊--";
|
||||
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage($user_doctor['user_id'], $order_inquiry['user_id'], $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
Log::getInstance()->info("分配医生成功,发送系统问诊消息成功");
|
||||
}catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("分配医生成功,发送系统问诊消息失败:" . $e->getMessage());
|
||||
return Result::ACK;
|
||||
|
||||
@ -161,7 +161,7 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
$ImService->sendTextMessage($user_doctor['user_id'],$order_inquiry['user_id'],"等待医生接诊",$order_inquiry['order_inquiry_id'],$order_inquiry['inquiry_type']);
|
||||
$ImService->sendMessage($user_doctor['user_id'],$order_inquiry['user_id'],"等待医生接诊",$order_inquiry['order_inquiry_id'],$order_inquiry['inquiry_type']);
|
||||
|
||||
Log::getInstance()->info("发送im消息成功");
|
||||
}
|
||||
|
||||
@ -14,12 +14,12 @@ use App\Services\UserDoctorService;
|
||||
use App\Services\UserService;
|
||||
use App\Utils\Http;
|
||||
use App\Utils\Log;
|
||||
use Extend\Ca\Ca;
|
||||
use Extend\Prescription\Prescription;
|
||||
use Extend\TencentIm\Account;
|
||||
use Extend\TencentIm\Friend;
|
||||
use Extend\TencentIm\Group;
|
||||
use Extend\TencentIm\Message;
|
||||
use Extend\TencentIm\MessageParams;
|
||||
use Extend\TencentIm\Profile;
|
||||
use Extend\VerifyDun\BankCard;
|
||||
use Extend\VerifyDun\IdCard;
|
||||
@ -205,7 +205,7 @@ class UserController extends AbstractController
|
||||
// }
|
||||
//
|
||||
// // 发送消息
|
||||
// $ImService->sendTextMessage($user_doctor['user_id'],"491923510680424449","等待医生接诊",491937904055369728);
|
||||
// $ImService->sendMessage($user_doctor['user_id'],"491923510680424449","等待医生接诊",491937904055369728);
|
||||
|
||||
//
|
||||
// $data = array();
|
||||
@ -254,5 +254,45 @@ class UserController extends AbstractController
|
||||
// $ImService = new ImService();
|
||||
// $ImService->setUserProfile("491925054435950592");
|
||||
|
||||
// $Prescription = new Prescription();
|
||||
// $token = $Prescription->getLogisticsFee();
|
||||
// dump($token);
|
||||
|
||||
|
||||
// $ImService = new ImService();
|
||||
//
|
||||
// // 发送消息
|
||||
// $ImService->sendMessage("491925054435950592","492404831991414785","等待医生接诊","494837308861095936",1);
|
||||
|
||||
// $Ca = new Ca();
|
||||
// $data = array();
|
||||
// $data['user_id'] = "123456";
|
||||
// $data['card_num'] = "372929199610075412";
|
||||
//
|
||||
// $result = $Ca->getCloudCert($data);
|
||||
// dump($result);
|
||||
|
||||
|
||||
$ImService = new ImService();
|
||||
|
||||
|
||||
// 发送消息
|
||||
// 自定义消息
|
||||
$cloud_custom_data = array();
|
||||
$cloud_custom_data['order_inquiry_id'] = "494837308861095936";
|
||||
$cloud_custom_data['is_system'] = 1;
|
||||
$cloud_custom_data['inquiry_type'] = 1;
|
||||
|
||||
// 消息内容
|
||||
$message_content_data = array();
|
||||
$message_content_data['message_type'] = 2;
|
||||
$message_content_data['content'] = "--问诊结束--";
|
||||
$message_content_data['desc'] = "温馨提示:您可继续补充问诊内容,便于更快确认病情,医生均在临床一线工作,还请耐心等待,医生接诊会第一时间短信通知您。";
|
||||
$message_content = [
|
||||
'Data' => json_encode($message_content_data,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
$ImService->sendMessage("491925054435950592", "492404831991414785", $message_content, "TIMCustomElem", $cloud_custom_data);
|
||||
|
||||
}
|
||||
}
|
||||
@ -109,16 +109,14 @@ class DoctorAuthService extends BaseService
|
||||
|
||||
// 网易易盾认证
|
||||
// 实人认证-生产环境开启
|
||||
if (env("APP_ENV") == "prod") {
|
||||
$IdCard = new IdCard();
|
||||
$IdCard = new IdCard();
|
||||
|
||||
$params = array();
|
||||
$params['name'] = $card_name;
|
||||
$params['cardNo'] = $card_num;
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
}
|
||||
$params = array();
|
||||
$params['name'] = $card_name;
|
||||
$params['cardNo'] = $card_num;
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
@ -225,7 +225,60 @@ class ImService extends BaseService
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function sendTextMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type): void
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* @param string $from_user_id 发送者id
|
||||
* @param string $to_user_id 接受者id
|
||||
* @param array $message_content 内容 对应 MsgBody.MsgContent
|
||||
* @param string $message_type 消息类型 具体查看(https://cloud.tencent.com/document/product/269/2720)
|
||||
* @param array $cloud_custom_data 自定义字段
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function sendMessage(string $from_user_id, string $to_user_id, array $message_content, string $message_type, array $cloud_custom_data): void
|
||||
{
|
||||
if (!empty($from_user_id)){
|
||||
// 检测并创建发送者资料
|
||||
$this->setUserProfile($from_user_id);
|
||||
}
|
||||
|
||||
// 检测并创建接收者资料
|
||||
$this->setUserProfile($to_user_id);
|
||||
|
||||
$message = new Message();
|
||||
|
||||
$arg = array();
|
||||
if (!empty($from_user_id)){
|
||||
$arg['From_Account'] = $from_user_id; // 发送方user_id 如系统发送,无需填写
|
||||
}
|
||||
$arg['To_Account'] = $to_user_id; // 接收方user_id
|
||||
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback',];
|
||||
$arg['SendMsgControl'] = ['NoUnread'];
|
||||
|
||||
$arg['MsgBody'] = [
|
||||
[
|
||||
"MsgType" => $message_type,
|
||||
"MsgContent" => $message_content,
|
||||
]
|
||||
];
|
||||
|
||||
// 自定义消息
|
||||
// $cloud_custom_data = array();
|
||||
// $cloud_custom_data['order_inquiry_id'] = $order_inquiry_id;
|
||||
// $cloud_custom_data['is_system'] = 1;
|
||||
// $cloud_custom_data['inquiry_type'] = $inquiry_type;
|
||||
|
||||
$arg['CloudCustomData'] = "";
|
||||
if (!empty($cloud_custom_data)){
|
||||
$arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
$message->sendMessage($arg);
|
||||
}
|
||||
|
||||
// 发送自定义消息
|
||||
public function sendCustomMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type): void
|
||||
{
|
||||
if (!empty($from_user_id)){
|
||||
// 检测并创建发送者资料
|
||||
@ -235,7 +288,6 @@ class ImService extends BaseService
|
||||
// 检测并创建接收者资料
|
||||
$this->setUserProfile($to_user_id);
|
||||
|
||||
// 医生给患者发送消息
|
||||
$message = new Message();
|
||||
|
||||
$arg = array();
|
||||
@ -248,9 +300,9 @@ class ImService extends BaseService
|
||||
|
||||
$arg['MsgBody'] = [
|
||||
[
|
||||
"MsgType" => "TIMTextElem",
|
||||
"MsgType" => "TIMCustomElem",
|
||||
"MsgContent" => [
|
||||
"Text" => $content,
|
||||
"Data" => $content,
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
@ -44,6 +44,7 @@ class IndexService extends BaseService
|
||||
"praise_rate",
|
||||
"avg_response_time",
|
||||
"number_of_fans",
|
||||
"avatar",
|
||||
"is_online",
|
||||
"is_img_expert_reception",
|
||||
"is_img_welfare_reception",
|
||||
|
||||
@ -139,16 +139,14 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
// 实人认证-生产环境开启
|
||||
if (env("APP_ENV") == "prod"){
|
||||
$IdCard = new IdCard();
|
||||
$IdCard = new IdCard();
|
||||
|
||||
$params =array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
$params =array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
@ -377,16 +375,14 @@ class PatientFamilyService extends BaseService
|
||||
$sex = getIdCardSex($this->request->input('id_number'));
|
||||
|
||||
// 实人认证-生产环境开启
|
||||
if (env("APP_ENV") == "prod"){
|
||||
$IdCard = new IdCard();
|
||||
$IdCard = new IdCard();
|
||||
|
||||
$params =array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
$params =array();
|
||||
$params['name'] = $request_params['card_name'];
|
||||
$params['cardNo'] = $request_params['id_number'];
|
||||
$res = $IdCard->checkIdCard($params);
|
||||
if (!empty($res)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,9 @@ use App\Model\ProductPlatformAmount;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserShipAddress;
|
||||
use App\Utils\Log;
|
||||
use Extend\Prescription\Prescription;
|
||||
use Extend\Wechat\WechatPay;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\IdGeneratorInterface;
|
||||
@ -705,14 +707,12 @@ class PatientOrderService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
// 模拟支付成功-金额为0时使用
|
||||
|
||||
/**
|
||||
*
|
||||
*模拟支付成功-金额为0时使用
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function addPatientOrderPay(): array
|
||||
{
|
||||
@ -788,7 +788,7 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
$ImService->sendTextMessage($user_doctor['user_id'],$order_inquiry['user_id'],"等待医生接诊",$order_inquiry['order_inquiry_id'],$order_inquiry['inquiry_type']);
|
||||
$ImService->sendMessage($user_doctor['user_id'],$order_inquiry['user_id'],"等待医生接诊",$order_inquiry['order_inquiry_id'],$order_inquiry['inquiry_type']);
|
||||
}
|
||||
|
||||
|
||||
@ -884,7 +884,14 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
// 获取运费金额
|
||||
$logistics_fee = 0;
|
||||
$Prescription = new Prescription();
|
||||
|
||||
$result = $Prescription->getLogisticsFee();
|
||||
if ($amount_total >= $result['drugCost']){
|
||||
$logistics_fee = 0;
|
||||
}else{
|
||||
$logistics_fee = $result['freight'];
|
||||
}
|
||||
|
||||
// 实际支付金额
|
||||
$payment_amount_total = $amount_total + $logistics_fee;
|
||||
@ -1134,7 +1141,6 @@ class PatientOrderService extends BaseService
|
||||
|
||||
$amount_total = 0;
|
||||
$coupon_amount_total = 0;
|
||||
$logistics_fee = 0; // 运费金额
|
||||
foreach ($order_prescription_product as &$item) {
|
||||
$params = array();
|
||||
$params['product_id'] = $item['product_id'];
|
||||
@ -1158,6 +1164,14 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
// 获取运费金额
|
||||
$Prescription = new Prescription();
|
||||
|
||||
$result = $Prescription->getLogisticsFee();
|
||||
if ($amount_total >= $result['drugCost']){
|
||||
$logistics_fee = 0;
|
||||
}else{
|
||||
$logistics_fee = $result['freight'];
|
||||
}
|
||||
|
||||
// 实际支付金额
|
||||
$payment_amount_total = $amount_total + $logistics_fee;
|
||||
|
||||
@ -33,7 +33,9 @@ use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Utils\Mask;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\VerifyDun\BankCard;
|
||||
use Extend\Wechat\Wechat;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Redis\Redis;
|
||||
@ -201,6 +203,7 @@ class UserDoctorService extends BaseService
|
||||
/**
|
||||
* 新增绑定医生银行卡
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function addDoctorBankCard(): array
|
||||
{
|
||||
@ -252,10 +255,28 @@ class UserDoctorService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "已绑定银行卡");
|
||||
}
|
||||
|
||||
// 获取医生详情数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||
if (empty($user_doctor_info)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 处理银行卡掩码
|
||||
$bank_card_code_mask = Mask::maskBankCard($bank_card_code);
|
||||
|
||||
// 验证银行卡
|
||||
$BankCard = new BankCard();
|
||||
|
||||
$params = array();
|
||||
$params['bankCardNo'] = $bank_card_code;
|
||||
$params['name'] = $user_doctor_info['card_name'];
|
||||
$params['idCardNo'] = $user_doctor_info['card_num'];
|
||||
$res = $BankCard->checkBankCard($params);
|
||||
if (!$res){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
@ -298,6 +319,7 @@ class UserDoctorService extends BaseService
|
||||
/**
|
||||
* 更换医生银行卡
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function putDoctorBankCard(): array
|
||||
{
|
||||
@ -312,6 +334,7 @@ class UserDoctorService extends BaseService
|
||||
|
||||
// 获取医生银行卡
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['bank_card_id'] = $bank_card_id;
|
||||
$doctor_bank_card = DoctorBankCard::getOne($params);
|
||||
if (empty($doctor_bank_card)) {
|
||||
@ -346,7 +369,25 @@ class UserDoctorService extends BaseService
|
||||
// 处理银行卡掩码
|
||||
$bank_card_code_mask = Mask::maskBankCard($bank_card_code);;
|
||||
|
||||
// 获取医生详情数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_doctor['doctor_id'];
|
||||
$user_doctor_info = UserDoctorInfo::getOne($params);
|
||||
if (empty($user_doctor_info)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 验证银行卡
|
||||
$BankCard = new BankCard();
|
||||
|
||||
$params = array();
|
||||
$params['bankCardNo'] = $bank_card_code;
|
||||
$params['name'] = $user_doctor_info['card_name'];
|
||||
$params['idCardNo'] = $user_doctor_info['card_num'];
|
||||
$res = $BankCard->checkBankCard($params);
|
||||
if (!$res){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,$res);
|
||||
}
|
||||
|
||||
// 修改银行卡
|
||||
$params = array();
|
||||
|
||||
@ -66,8 +66,8 @@ return [
|
||||
],
|
||||
],
|
||||
'verify_dun' =>[ // 网易易盾
|
||||
"secretId" => "a0efb0a735ca5f833d9c50075d3bd673",
|
||||
"secretKey" => "bc5fc333fec0f16973bb4600cebf8f32",
|
||||
"secretId" => "45a8fd254b4649e9bd25d773ac7ab666",
|
||||
"secretKey" => "3cb726bd85104161b25613153c4fba7c",
|
||||
"busunessId" => "",
|
||||
],
|
||||
'im' =>[ // 腾讯im
|
||||
@ -76,4 +76,9 @@ return [
|
||||
"base_url" => "https://console.tim.qq.com/",
|
||||
"token" => "NDc5MzExMDMxMDY2NDMxNDg5L", // 鉴权回调使用
|
||||
],
|
||||
'ca' => [ // ca
|
||||
"app_id" => env('CA_APP_ID', 'SCCA1560150113940832258'),
|
||||
"secret" => env('CA_APP_SECRET', 'facded39929f4aef9893cb766cd52e25'),
|
||||
"api_url" => env('CA_APP_URL', 'http://testmicrosrv.scca.com.cn:9527'),
|
||||
],
|
||||
];
|
||||
|
||||
109
extend/Ca/Ca.php
Normal file
109
extend/Ca/Ca.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Extend\Ca;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* 四川ca云证书+电子签章
|
||||
*/
|
||||
class Ca
|
||||
{
|
||||
#[Inject]
|
||||
protected ContainerInterface $container;
|
||||
|
||||
#[Inject]
|
||||
protected Client $client;
|
||||
|
||||
public function __construct(){
|
||||
$this->container = ApplicationContext::getContainer();
|
||||
$this->client = $this->container->get(Client::class);
|
||||
}
|
||||
|
||||
// 获取云证书
|
||||
public function getCloudCert(array $data){
|
||||
$option = [
|
||||
'form_params' => [
|
||||
'entityId' => $data['user_id'], // 用户唯一标识,由业务系统定义
|
||||
'entityType' => "Personal",// 用户类型,可选值[Personal/Organizational]
|
||||
'pin' => $data['user_id'], // 证书PIN码
|
||||
'cardNumber' => $data['card_num'], // 证件号码(个人身份证;企业统一社会信用代码)
|
||||
]
|
||||
];
|
||||
|
||||
try {
|
||||
$response = $this->httpRequest(config("ca.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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取签名
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function getSign(array $data): string
|
||||
{
|
||||
$data = implode('&',$data['form_params']);
|
||||
return hash_hmac("sha1",$data,config("ca.secret"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装公共请求
|
||||
* @param string $path
|
||||
* @param array $arg
|
||||
* @return mixed
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function httpRequest(string $path,array $arg = []): mixed
|
||||
{
|
||||
|
||||
$option = [
|
||||
"headers" => [
|
||||
"app_id" => config("ca.app_id"),
|
||||
"signature" => $this->getSign($arg)
|
||||
],
|
||||
];
|
||||
|
||||
$arg = array_merge($arg,$option);
|
||||
|
||||
dump($path);die;
|
||||
dump($arg);die;
|
||||
$response = $this->client->post($path, $arg);
|
||||
dump(1);
|
||||
if ($response->getStatusCode() != '200'){
|
||||
// 请求失败
|
||||
throw new BusinessException($response->getBody()->getContents());
|
||||
}
|
||||
dump(2);
|
||||
$body = json_decode($response->getBody(),true);
|
||||
dump($body);die;
|
||||
if (empty($body)){
|
||||
// 返回值为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
if ($body['result_code'] != 0){
|
||||
// 请求失败
|
||||
if (!empty($body['result_msg'])){
|
||||
throw new BusinessException($body['result_msg']);
|
||||
}
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
return $body['body'];
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,12 @@ class Prescription
|
||||
return $response['result']['token'];
|
||||
}
|
||||
|
||||
// 获取药品
|
||||
/**
|
||||
* 获取药品
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProd(int $page = 1,int $pageSize = 10){
|
||||
$option = [
|
||||
"json" => array(
|
||||
@ -125,8 +130,30 @@ class Prescription
|
||||
}
|
||||
}
|
||||
|
||||
// 获取运费
|
||||
/**
|
||||
* 获取运费
|
||||
* @return array
|
||||
*/
|
||||
public function getLogisticsFee(): array
|
||||
{
|
||||
$option = [
|
||||
"json" => array(
|
||||
"pharmacyCode" => "JG-10009",
|
||||
),
|
||||
];
|
||||
|
||||
try {
|
||||
$response = $this->httpRequest($this->api_url . $this->version . '/pharmacy/transportationExpenses', $option);
|
||||
if (empty($response)){
|
||||
// 返回值为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
return $response;
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求封装
|
||||
|
||||
@ -3,18 +3,25 @@
|
||||
namespace Extend\VerifyDun;
|
||||
|
||||
use App\Exception\BusinessException;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
* 银行卡三/四要素认证
|
||||
*/
|
||||
class BankCard extends Base
|
||||
{
|
||||
public function checkBankCard(array $params){
|
||||
/**
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function checkBankCard(array $params): string
|
||||
{
|
||||
try {
|
||||
// 组合请求地址
|
||||
$api_url = $this->api_url . $this->version . '/bankcard/check';
|
||||
|
||||
$this->params['businessId'] = "98c43b77719e4752b15519fbce011a58";
|
||||
$this->params['businessId'] = "3cb726bd85104161b25613153c4fba7c";
|
||||
|
||||
$this->params = array_merge($this->params,$params);
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class IdCard extends Base
|
||||
// 组合请求地址
|
||||
$api_url = $this->api_url . $this->version . '/idcard/check';
|
||||
|
||||
$this->params['businessId'] = "f7262b91aac1448a848d29c0800b109a";
|
||||
$this->params['businessId'] = "45a8fd254b4649e9bd25d773ac7ab666";
|
||||
|
||||
$this->params = array_merge($this->params,$params);
|
||||
|
||||
|
||||
@ -52,6 +52,10 @@ AMQP_PORT=5672
|
||||
AMQP_USER=gdxz_2022rabbitmq
|
||||
AMQP_PASSWORD=qwr2p&¥e@3.2p
|
||||
AMQP_VHOST=gdxz_2022rabbitmq
|
||||
|
||||
# [CA]
|
||||
CA_APP_ID=SCCA1560150113940832258
|
||||
CA_APP_SECRET=facded39929f4aef9893cb766cd52e25
|
||||
">.env
|
||||
|
||||
#nginx_upstrame="/Users/wucongxing/Desktop/test/hospital-upstream.conf"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user