Jelajahi Sumber

订单用储值卡

gorden 3 bulan lalu
induk
melakukan
229feecba3
1 mengubah file dengan 18 tambahan dan 18 penghapusan
  1. 18 18
      app/admin/controller/order/WholeController.php

+ 18 - 18
app/admin/controller/order/WholeController.php

@@ -1593,7 +1593,7 @@ class WholeController extends Curd
                     ];
                     // 生成支付记录
                     $params['order_status_payment'] = 'PENDING';
-                    OrderService::createPayConstituteDetail($params,$payDetail);
+                    OrderService::createPayConstituteDetail($params, $payDetail);
                     $params['order_status_payment'] = 'SUCCESS';
                     $params['order_amount_pay'] = $orderAmountPay;
                     $order->order_status_system = $systemStatus;
@@ -4873,10 +4873,10 @@ class WholeController extends Curd
             $full = '';
             $payStatus = 'N';
             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') {
                     $payStatus = 'Y';
                     $order->order_status_payment = 'SUCCESS';
@@ -4911,17 +4911,17 @@ class WholeController extends Curd
                         'pay_json_response' => json_encode($result)
                     ]);
                     // 除微信外的支付记录
-                    PayDetail::where('join_pay_order_id', $order->order_groupby)->where('pay_prepayid','<>', 'WXPAY')->update([
+                    PayDetail::where('join_pay_order_id', $order->order_groupby)->where('pay_prepayid', '<>', 'WXPAY')->update([
                         'pay_status' => 'SUCCESS',
                         'pay_paytimes' => date('Y-m-d H:i:s'),
-                        'pay_json_response' => json_encode(['pay-result'=>'支付成功','result-datetime'=>date('Y-m-d H:i:s')])
+                        'pay_json_response' => json_encode(['pay-result' => '支付成功', 'result-datetime' => date('Y-m-d H:i:s')])
                     ]);
                     // 加销售量
                     OrderSheetService::addGoodsSales($params['orderId']);
                     // 优惠券标记使用
                     $this->changeOrderCouponStatus($discountJson, 'USED');
 
-                    
+
                 }
             } else if (in_array('ALIPAY', $payDetailType)) {
                 $result = Pay::alipay(config('payment.alipay'))->find($order->order_groupby);
@@ -4979,13 +4979,13 @@ class WholeController extends Curd
                 }
             }
 
-            if ($payStatus == 'Y'){
-                foreach($payDetailType as $item){
-                    if (in_array($item,['WXPAY','ALIPAY'])){
+            if ($payStatus == 'Y') {
+                foreach ($payDetailType as $item) {
+                    if (in_array($item, ['WXPAY', 'ALIPAY'])) {
                         continue;
                     }
-                    $amount = PayDetail::where('join_pay_order_id',$order->order_groupby)
-                        ->where('pay_prepayid',$item)
+                    $amount = PayDetail::where('join_pay_order_id', $order->order_groupby)
+                        ->where('pay_prepayid', $item)
                         ->value('pay_amount');
                     $this->deductAccountOne($order->order_groupby, $item, $amount);
                 }
@@ -5107,12 +5107,12 @@ class WholeController extends Curd
                 }
             }
             if ($payStatus == 'Y') {
-                foreach($payDetailType as $item){
-                    if (in_array($item,['WXPAY','ALIPAY'])){
+                foreach ($payDetailType as $item) {
+                    if (in_array($item, ['WXPAY', 'ALIPAY'])) {
                         continue;
                     }
-                    $amount = PayDetail::where('join_pay_order_id',$groupId)
-                        ->where('pay_prepayid',$item)
+                    $amount = PayDetail::where('join_pay_order_id', $groupId)
+                        ->where('pay_prepayid', $item)
                         ->value('pay_amount');
                     $this->deductAccountOne($groupId, $item, $amount);
                 }
@@ -5201,7 +5201,7 @@ class WholeController extends Curd
                     'pay_status' => 'SUCCESS'
                 ]);
         } catch (\Exception $e) {
-            Log::info("获取大额支付状态:扣除账户金额失败", ['nbr' => $accountNbr, 'amount' => $account]);
+            Log::info("获取大额支付状态:扣除账户金额失败", ['nbr' => $accountNbr, 'group_id' => $groupId]);
 
             throw new BusinessException("账户金额扣除失败");
         }