|
@@ -4765,11 +4765,12 @@ class WholeController extends Curd
|
|
|
$payDetailType = PayDetail::where('join_pay_order_id', $order->order_groupby)->pluck('pay_prepayid')->toArray();
|
|
|
try {
|
|
|
Db::beginTransaction();
|
|
|
+ $full = '';
|
|
|
if (in_array('WXPAY', $payDetailType)) {
|
|
|
- $result = Pay::wechat(config('payment.wxpay'))->find($order->order_groupby, 'pos');
|
|
|
- $result = json_decode(json_encode($result), true);
|
|
|
-// $result = '{"return_code":"SUCCESS","return_msg":"OK","result_code":"SUCCESS","mch_id":"1680393367","appid":"wxc6274da7198e3eb4","openid":"o3JAn6Ii_bAlxS-jbNEC4WnPhdwM","is_subscribe":"N","trade_type":"MICROPAY","trade_state":"SUCCESS","bank_type":"OTHERS","total_fee":"3","fee_type":"CNY","cash_fee":"1000","cash_fee_type":"CNY","transaction_id":"4200067718202409250802875650","out_trade_no":"OD24092518408RV7","attach":[],"time_end":"20240925184009","trade_state_desc":"支付成功","nonce_str":"OeGOkjch4eaV5qIt","sign":"6DCB3BFC594EBC018A2BEE2C3DFEA4E3"}';
|
|
|
-// $result = json_decode($result, true);
|
|
|
+// $result = Pay::wechat(config('payment.wxpay'))->find($order->order_groupby, 'pos');
|
|
|
+// $result = json_decode(json_encode($result), true);
|
|
|
+ $result = '{"return_code":"SUCCESS","return_msg":"OK","result_code":"SUCCESS","mch_id":"1680393367","appid":"wxc6274da7198e3eb4","openid":"o3JAn6Ii_bAlxS-jbNEC4WnPhdwM","is_subscribe":"N","trade_type":"MICROPAY","trade_state":"SUCCESS","bank_type":"OTHERS","total_fee":"3","fee_type":"CNY","cash_fee":"1000","cash_fee_type":"CNY","transaction_id":"4200067718202409250802875650","out_trade_no":"OD24092518408RV7","attach":[],"time_end":"20240925184009","trade_state_desc":"支付成功","nonce_str":"OeGOkjch4eaV5qIt","sign":"6DCB3BFC594EBC018A2BEE2C3DFEA4E3"}';
|
|
|
+ $result = json_decode($result, true);
|
|
|
if (!empty($result['return_code']) && $result['return_code'] == 'SUCCESS' && !empty($result['result_code']) && $result['result_code'] == 'SUCCESS' && !empty($result['trade_state']) && $result['trade_state'] == 'SUCCESS') {
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
if (in_array($order->order_category, ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE'])) {
|
|
@@ -4780,8 +4781,10 @@ class WholeController extends Curd
|
|
|
} else if (in_array($order->order_category, ['VIP', 'PARTNER'])) {
|
|
|
$order->order_status_payment = 'PENDING';
|
|
|
$totalFee = $result['total_fee'] / 100;
|
|
|
- if ($order->order_amount_paid + $totalFee >= $order->order_amount_total) {
|
|
|
- $order->order_amount_paid = $order->order_amount_paid + $totalFee;
|
|
|
+ $order->order_amount_paid = $order->order_amount_paid + $totalFee;
|
|
|
+ $order->order_amount_pay = $order->order_amount_paid;
|
|
|
+ if ($order->order_amount_paid >= $order->order_amount_total) {
|
|
|
+ $full = '-满额';
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
$order->order_status_system = 'DONE';
|
|
|
$order->order_is_complete = 'Y';
|
|
@@ -4800,16 +4803,17 @@ class WholeController extends Curd
|
|
|
'pay_paytimes' => date('Y-m-d H:i:s'),
|
|
|
'pay_json_response' => json_encode($result)
|
|
|
]);
|
|
|
-
|
|
|
// 优惠券标记使用
|
|
|
$this->changeOrderCouponStatus($discountJson, 'USED');
|
|
|
|
|
|
Db::commit();
|
|
|
|
|
|
- // 给上级提成
|
|
|
- Event::dispatch('commission.order', $params);
|
|
|
+ if (in_array($order->order_category, ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE', 'GOODS', 'DISHES', 'MEALS'])) {
|
|
|
+ // 给上级提成
|
|
|
+ Event::dispatch('commission.order', $params);
|
|
|
+ }
|
|
|
// 收支明细
|
|
|
- $params['inout_category'] = $oldOrderPaymentStatus == 'AWAITING' ? '挂账订单结算收入' : ($order->order_classify == 'VIP' ? '购买康养城VIP套餐包收入' : '餐饮订单收入');
|
|
|
+ $params['inout_category'] = $oldOrderPaymentStatus == 'AWAITING' ? '挂账订单结算收入' : ($order->order_classify == 'VIP' ? ('购买康养城VIP套餐包收入' . $full) : '餐饮订单收入');
|
|
|
Event::dispatch('statistics.inout.in', $params);
|
|
|
|
|
|
return json_success('success');
|
|
@@ -4828,8 +4832,10 @@ class WholeController extends Curd
|
|
|
$order->order_status_system = 'DONE';
|
|
|
} else if (in_array($order->order_category, ['VIP', 'PARTNER'])) {
|
|
|
$order->order_status_payment = 'PENDING';
|
|
|
- if ($order->order_amount_paid + $result['total_amount'] >= $order->order_amount_total) {
|
|
|
- $order->order_amount_paid = $order->order_amount_paid + $result['total_amount'];
|
|
|
+ $order->order_amount_paid = $order->order_amount_paid + $result['total_amount'];
|
|
|
+ $order->order_amount_pay = $order->order_amount_paid;
|
|
|
+ if ($order->order_amount_paid >= $order->order_amount_total) {
|
|
|
+ $full = '-满额';
|
|
|
$order->order_status_system = 'DONE';
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
$order->order_is_complete = 'Y';
|
|
@@ -4853,11 +4859,13 @@ class WholeController extends Curd
|
|
|
$this->changeOrderCouponStatus($discountJson, 'USED');
|
|
|
Db::commit();
|
|
|
|
|
|
- // 给上级提成
|
|
|
- Event::dispatch('commission.order', $params);
|
|
|
+ if (in_array($order->order_category, ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE', 'GOODS', 'DISHES', 'MEALS'])) {
|
|
|
+ // 给上级提成
|
|
|
+ Event::dispatch('commission.order', $params);
|
|
|
+ }
|
|
|
|
|
|
// 收支明细
|
|
|
- $params['inout_category'] = $oldOrderPaymentStatus == 'AWAITING' ? '挂账订单结算收入' : ($order->order_classify == 'VIP' ? '购买康养城VIP套餐包收入' : '餐饮订单收入');
|
|
|
+ $params['inout_category'] = $oldOrderPaymentStatus == 'AWAITING' ? '挂账订单结算收入' : ($order->order_classify == 'VIP' ? ('购买康养城VIP套餐包收入' . $full) : '餐饮订单收入');
|
|
|
Event::dispatch('statistics.inout.in', $params);
|
|
|
|
|
|
return json_success('success');
|