wesmiler 2 mesiacov pred
rodič
commit
5e63867cd7
1 zmenil súbory, kde vykonal 9 pridanie a 3 odobranie
  1. 9 3
      app/Services/PaymentService.php

+ 9 - 3
app/Services/PaymentService.php

@@ -491,7 +491,7 @@ class PaymentService extends BaseService
             }
             // 生活充值
             else if ($scene == 'pay') {
-                $orderInfo = PayOrdersModel::where(['order_no' => $orderNo, 'mark' => 1])
+                $orderInfo = PayOrdersModel::with(['meal'])::where(['order_no' => $orderNo, 'mark' => 1])
                     ->select(['id as order_id', 'user_id','meal_id','product_id', 'order_no','transaction_id','account', 'total as pay_money','area','ytype','city','id_card_no','pay_total', 'pay_at as pay_time', 'remark', 'status'])
                     ->first();
                 $orderStatus = isset($orderInfo['status']) ? $orderInfo['status'] : 0;
@@ -566,21 +566,27 @@ class PaymentService extends BaseService
                     $account = isset($orderInfo['account'])? $orderInfo['account'] : '';
                     $total = isset($orderInfo['pay_money'])? $orderInfo['pay_money'] : 0;
                     $payTotal = isset($orderInfo['pay_total'])? $orderInfo['pay_total'] : 0;
+                    $mealData = isset($orderInfo['meal'])? $orderInfo['meal'] : [];
+                    $orderType = isset($orderInfo['type'])?$orderInfo['type']:1;
+                    $electricType = isset($mealData['electric_type'])?$mealData['electric_type']:0;
+                    $city = isset($orderInfo['city'])?$orderInfo['city']:'';
                     $amount = $total;
                     $params = [
                         'price'=>$payTotal,
                         'ytype'=>isset($orderInfo['ytype'])?$orderInfo['ytype']:0,
                         'id_card_no'=>isset($orderInfo['id_card_no'])?$orderInfo['id_card_no']:'',
                         'area'=>isset($orderInfo['area'])?$orderInfo['area']:'',
-                        'city'=>isset($orderInfo['city'])?$orderInfo['city']:'',
                     ];
 
+                    if($orderType==2 && $electricType!= 3 && $city){
+                        $params['city'] = $city;
+                    }
+
                     $result = DyrPayService::make()->recharge($orderNo, $account, $productId, $amount, $params);
                     $errno = isset($result['errno'])?$result['errno'] : -1;
                     $errmsg = isset($result['errmsg'])?$result['errmsg'] : '';
                     $res = isset($result['data'])?$result['data']:[];
                     $order_number = isset($res['order_number'])?$res['order_number']:'';
-                    $total_price = isset($res['total_price'])?$res['total_price']:'';
                     if(empty($result) || $errno != 0 || empty($order_number)){
 
                         $this->error = '充值调用失败:'.$errmsg;