新增药品订单支付回调
This commit is contained in:
@@ -154,7 +154,13 @@ class BasicDataService extends BaseService
|
||||
$params[] = ['disease_class_name', 'like', '%' . $disease_class_name . '%'];
|
||||
$disease_class = DiseaseClass::getList($params, $fields);
|
||||
if (empty($disease_class)){
|
||||
return success();
|
||||
$params = array();
|
||||
$params[] = ["disease_class_status", 1];
|
||||
$params[] = ["disease_class_enable", 1];
|
||||
$disease_class = DiseaseClass::getList($params, $fields);
|
||||
if(empty($disease_class)){
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -634,7 +634,7 @@ class InquiryService extends BaseService
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款接口
|
||||
* 问诊订单退款接口
|
||||
* 务必外层接收异常,回滚事务
|
||||
* @param string $order_inquiry_id
|
||||
* @param string $refund_reason 退款原因
|
||||
@@ -670,7 +670,7 @@ class InquiryService extends BaseService
|
||||
}
|
||||
|
||||
// 发起退款
|
||||
$WechatPay = new WechatPay(1);
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
|
||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||
|
||||
|
||||
@@ -111,12 +111,12 @@ class OrderProductService extends BaseService
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 库存+1
|
||||
// 库存+订单商品数量
|
||||
$params = array();
|
||||
$params['amount_id'] = $product['ProductPlatformAmount']['amount_id'];
|
||||
ProductPlatformAmount::inc($params, 'stock', (float)$item['amount']);
|
||||
|
||||
// 锁定库存-1
|
||||
// 锁定库存-订单商品数量
|
||||
ProductPlatformAmount::dec($params, 'lock_stock', (float)$item['amount']);
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +622,18 @@ class PatientOrderService extends BaseService
|
||||
$payment_amount_total = $order_inquiry['payment_amount_total'];
|
||||
$coupon_amount_total = $order_inquiry['coupon_amount_total'];
|
||||
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, $payment_amount_total * 100, $user_info['open_id']);
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 获取小程序支付配置
|
||||
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||
|
||||
} elseif ($order_type == 2) {
|
||||
// 药品订单
|
||||
$params = array();
|
||||
@@ -650,22 +662,22 @@ class PatientOrderService extends BaseService
|
||||
$amount_total = $order_product['amount_total'];
|
||||
$payment_amount_total = $order_product['payment_amount_total'];
|
||||
$coupon_amount_total = 0;
|
||||
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1,2);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, $payment_amount_total * 100, $user_info['open_id']);
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 获取小程序支付配置
|
||||
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||
} else {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 发起支付
|
||||
$WechatPay = new WechatPay(1);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$prepay = $WechatPay->getJsapiPrepayId($order_no, $payment_amount_total * 100, $user_info['open_id']);
|
||||
if (empty($prepay)) {
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 获取小程序支付配置
|
||||
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||
|
||||
$result = array();
|
||||
$result['amount_total'] = $amount_total; // 订单金额
|
||||
$result['payment_amount_total'] = $payment_amount_total; // 实际订单金额
|
||||
@@ -715,16 +727,6 @@ class PatientOrderService extends BaseService
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "处方未审核");
|
||||
}
|
||||
|
||||
// 检测是否已经存在药品订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_prescription['order_inquiry_id'];
|
||||
$params['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$order_product = OrderProduct::getExists($params);
|
||||
if ($order_product) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "处方已使用");
|
||||
}
|
||||
|
||||
// 检测收货地址
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
@@ -890,7 +892,7 @@ class PatientOrderService extends BaseService
|
||||
$data['order_type'] = 2;
|
||||
|
||||
$message = new CancelUnpayOrdersDelayDirectProducer($data);
|
||||
$message->setDelayMs(1000 * 30 * 1);
|
||||
$message->setDelayMs(1000 * 60 * 30);
|
||||
$producer = $this->container->get(Producer::class);
|
||||
$res = $producer->produce($message);
|
||||
if (!$res) {
|
||||
|
||||
Reference in New Issue
Block a user