|
@@ -571,7 +571,6 @@ class ServicesController extends Curd
|
|
public function insertConstitute(Request $request): Response
|
|
public function insertConstitute(Request $request): Response
|
|
{
|
|
{
|
|
$params = $request->post();
|
|
$params = $request->post();
|
|
- // 判断餐品是否连带着服务或实体
|
|
|
|
$goodsClassifys = array_unique(array_column($params['goodsContentList'], 'goods_classify'));
|
|
$goodsClassifys = array_unique(array_column($params['goodsContentList'], 'goods_classify'));
|
|
$premises = [];
|
|
$premises = [];
|
|
if (!empty($params['dept_premises_id'])) {
|
|
if (!empty($params['dept_premises_id'])) {
|
|
@@ -913,9 +912,6 @@ class ServicesController extends Curd
|
|
}
|
|
}
|
|
$this->changeOrderCouponStatus($couponUseJson, 'WAITING');
|
|
$this->changeOrderCouponStatus($couponUseJson, 'WAITING');
|
|
|
|
|
|
- // 清除支付记录,恢复账户金额
|
|
|
|
-// $this->restoreAccount($params['pay_detail_item']);
|
|
|
|
-
|
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
}
|
|
}
|
|
_syslog("订单", "创建订单成功");
|
|
_syslog("订单", "创建订单成功");
|
|
@@ -937,9 +933,25 @@ class ServicesController extends Curd
|
|
|
|
|
|
public function restoreAccount($payDetailItem)
|
|
public function restoreAccount($payDetailItem)
|
|
{
|
|
{
|
|
- foreach ($payDetailItem as $item){
|
|
|
|
- if ($item['order_status_payment'] == 'SUCCESS'){
|
|
|
|
-// if ($item[''])
|
|
|
|
|
|
+ foreach ($payDetailItem as $item) {
|
|
|
|
+ $prepayId = '';
|
|
|
|
+ if ($item['order_status_payment'] == 'SUCCESS') {
|
|
|
|
+ if (in_array($item['pay_category'], ['MONEY', 'OFFLINE', 'OFFLINE_ALIPAY', 'OFFLINE_WXPAY'])) {
|
|
|
|
+ $prepayId = $item['pay_category'];
|
|
|
|
+ }
|
|
|
|
+ if (strpos($item['pay_category'],'CASH') !== false || strpos($item['pay_category'],'CARD') !== false || strpos($item['pay_category'],'WELFARE') !== false || strpos($item['pay_category'],'VIP') !== false){
|
|
|
|
+ $prepayId = $item['pay_category'];
|
|
|
|
+ $account = MemberAccount::where('member_account_nbr', $prepayId)->first();
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend - $item['order_amount_pay'];
|
|
|
|
+ $account->member_account_surplus = $account->member_account_surplus + $item['order_amount_pay'];
|
|
|
|
+ $account->save();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!empty($prepayId)) {
|
|
|
|
+ PayDetail::where('pay_prepayid', $prepayId)
|
|
|
|
+ ->where('join_pay_order_id', $item['orderGroupId'])
|
|
|
|
+ ->whereJsonContains('join_pay_object_json->order_id',$item['orderId'])
|
|
|
|
+ ->update(['pay_status' => 'WAITING']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1577,6 +1589,7 @@ class ServicesController extends Curd
|
|
if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
|
|
if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
|
|
throw new BusinessException('组合支付金额与应付金额不一致');
|
|
throw new BusinessException('组合支付金额与应付金额不一致');
|
|
}
|
|
}
|
|
|
|
+ $params['pay_detail_item'] = [];
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { //线下付款
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { //线下付款
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_payment = 'SUCCESS';
|
|
$order->order_status_payment = 'SUCCESS';
|
|
@@ -1587,6 +1600,8 @@ class ServicesController extends Curd
|
|
$params['order_amount_pay'] = $constituteList['OFFLINE'];
|
|
$params['order_amount_pay'] = $constituteList['OFFLINE'];
|
|
// 生成支付记录
|
|
// 生成支付记录
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
|
+ $params['pay_detail_item'][] = $params;
|
|
}
|
|
}
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
}
|
|
}
|
|
@@ -1600,6 +1615,8 @@ class ServicesController extends Curd
|
|
$params['order_amount_pay'] = $constituteList['MONEY'];
|
|
$params['order_amount_pay'] = $constituteList['MONEY'];
|
|
// 生成支付记录
|
|
// 生成支付记录
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
|
+ $params['pay_detail_item'][] = $params;
|
|
}
|
|
}
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
}
|
|
}
|
|
@@ -1634,6 +1651,8 @@ class ServicesController extends Curd
|
|
$account->save();
|
|
$account->save();
|
|
// 生成支付记录
|
|
// 生成支付记录
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
|
+ $params['pay_detail_item'][] = $params;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_payment = 'SUCCESS';
|
|
$order->order_status_payment = 'SUCCESS';
|
|
@@ -1675,6 +1694,8 @@ class ServicesController extends Curd
|
|
$account->save();
|
|
$account->save();
|
|
// 生成支付记录
|
|
// 生成支付记录
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
OrderService::createPayConstituteDetail($params, $payDetail);
|
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
|
+ $params['pay_detail_item'][] = $params;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_system = $systemStatus;
|
|
$order->order_status_payment = 'SUCCESS';
|
|
$order->order_status_payment = 'SUCCESS';
|
|
@@ -1819,11 +1840,6 @@ class ServicesController extends Curd
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // 2.4W 康养城
|
|
|
|
- if ($params['goods_classify'] == 'VIP' && $order->order_status_payment == 'SUCCESS') {
|
|
|
|
- $params['member_id'] = $params['join_order_member_id'];
|
|
|
|
- Event::dispatch('order.kangyangCityVIP.grant', $params);
|
|
|
|
- }
|
|
|
|
|
|
|
|
Db::commit();
|
|
Db::commit();
|
|
// 会员升级
|
|
// 会员升级
|
|
@@ -1862,6 +1878,9 @@ class ServicesController extends Curd
|
|
if (empty($discountJson)) {
|
|
if (empty($discountJson)) {
|
|
$this->changeOrderCouponStatus($couponUseJson, 'WAITING');
|
|
$this->changeOrderCouponStatus($couponUseJson, 'WAITING');
|
|
}
|
|
}
|
|
|
|
+ // 清除支付记录,恢复账户金额
|
|
|
|
+ $this->restoreAccount($params['pay_detail_item']);
|
|
|
|
+
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
}
|
|
}
|
|
_syslog("订单", "订单支付成功");
|
|
_syslog("订单", "订单支付成功");
|