|
@@ -242,6 +242,9 @@ class NewCustomerController extends Curd
|
|
|
if (!empty($paidOrder)) {
|
|
|
$paidOrder->order_groupby = $params['orderGroupId'];
|
|
|
$params['orderId'] = $paidOrder->order_id;
|
|
|
+ }else{
|
|
|
+ // 检查产品配置
|
|
|
+ $this->checkGoodsConfig($params);
|
|
|
}
|
|
|
$systemStatus = 'PAYING';
|
|
|
// 立即结算
|
|
@@ -320,6 +323,9 @@ class NewCustomerController extends Curd
|
|
|
// 分期付完
|
|
|
if ($params['goods_classify'] == 'COMBINE' && $params['order_status_payment'] == 'SUCCESS' && (!empty($paidOrder) && floatval($paidOrder->order_amount_paid) >= $paidOrder->order_amount_total || floatval($params['order_amount_pay']) >= $params['order_amount_total'])) {
|
|
|
$params['member_id'] = $params['join_order_member_id'];
|
|
|
+ // 完成订单
|
|
|
+ Event::dispatch('order.complete', $params);
|
|
|
+
|
|
|
Event::dispatch('order.new_custom.grant', $params);
|
|
|
}
|
|
|
if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
|
|
@@ -526,13 +532,11 @@ class NewCustomerController extends Curd
|
|
|
// 分期付款完成
|
|
|
if ($params['goods_classify'] == 'COMBINE' && $order->order_status_payment == 'SUCCESS' && floatval($order->order_amount_paid) >= $order->order_amount_total) {
|
|
|
$params['member_id'] = $params['join_order_member_id'];
|
|
|
- Event::dispatch('order.new_custom.grant', $params);
|
|
|
- }
|
|
|
-
|
|
|
- if ($order->order_is_complete == 'Y' && $order->order_status_payment == 'SUCCESS') {
|
|
|
+ // 完成订单
|
|
|
Event::dispatch('order.complete', $params);
|
|
|
+ // 处理分期完成后的操作
|
|
|
+ Event::dispatch('order.new_custom.grant', $params);
|
|
|
}
|
|
|
-
|
|
|
if ($order->order_status_payment != 'SUCCESS' && $paymentStatus != 'SUCCESS') {
|
|
|
_syslog("订单", "支付异常,检查是否有轮询");
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId'], 'group_id' => $params['orderGroupId']]);
|
|
@@ -1150,4 +1154,35 @@ class NewCustomerController extends Curd
|
|
|
return json_fail('查询失败');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Desc 检查产品配置
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/9/28 15:42
|
|
|
+ *
|
|
|
+ * @param $params
|
|
|
+ * @return void
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ public function checkGoodsConfig($params)
|
|
|
+ {
|
|
|
+ foreach ($params['goodsContentList'] as $goods) {
|
|
|
+ $goods = Goods::where('goods_id',$goods['goods_id'])->select('goods_attribute_json')->first();
|
|
|
+ if (!empty($goods)){
|
|
|
+ $goodsAttributeJson = json_decode($goods->goods_attribute_json,true);
|
|
|
+ // 不允许分期
|
|
|
+ if (isset($goodsAttributeJson['control']) && $goodsAttributeJson['control']['if_installment'] == 'N'){
|
|
|
+ if ($params['order_amount_total'] > $params['order_amount_pay']){
|
|
|
+ throw new BusinessException('不支持分期支付');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 不允许重复购买
|
|
|
+ if (isset($goodsAttributeJson['control']) && $goodsAttributeJson['control']['if_repeat_buy'] == 'N'){
|
|
|
+ if (Order::where('join_order_member_id',$params['join_order_member_id'])->where('order_classify','COMBINE')->exists()){
|
|
|
+ throw new BusinessException('仅可购买一次');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|