wesmiler 3 месяцев назад
Родитель
Сommit
9efaf3035a
2 измененных файлов с 8 добавлено и 3 удалено
  1. 4 1
      app/Services/DyrPayService.php
  2. 4 2
      app/Services/PaymentService.php

+ 4 - 1
app/Services/DyrPayService.php

@@ -76,9 +76,12 @@ class DyrPayService extends BaseService
             'product_id' => $productId,             // 产品ID
             'out_trade_num' => $no,     // 单号
             'amount' => $amount,                // 金额
-            'mobile' => $account,                // 手机号
+            'mobile' => $account,                // 手机号或账号
             'notify_url' => url('/api/dry/notify/' . $productId),            // 回调地址
         ];
+        if(isset($params['price']) && $params['price']){
+            $param['price'] = floatval($params['price']);
+        }
         if(isset($params['ytype']) && $params['ytype']){
             $param['ytype'] = intval($params['ytype']);
         }

+ 4 - 2
app/Services/PaymentService.php

@@ -565,8 +565,10 @@ class PaymentService extends BaseService
                     $orderNo = isset($orderInfo['order_no'])? $orderInfo['order_no'] : '';
                     $account = isset($orderInfo['account'])? $orderInfo['account'] : '';
                     $total = isset($orderInfo['pay_money'])? $orderInfo['pay_money'] : 0;
+                    $payTotal = isset($orderInfo['pay_total'])? $orderInfo['pay_total'] : 0;
                     $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']:'',
@@ -584,10 +586,10 @@ class PaymentService extends BaseService
                         $this->error = '充值调用失败:'.$errmsg;
 
                         // 退款
-                        $orderInfo['money'] = $total;
+                        $orderInfo['money'] = $payTotal;
                         $orderInfo['remark'] = '充值失败退款';
                         $refundStatus = PaymentService::make()->refund($orderInfo,'pay');
-                        $updateData = ['refund_status'=> $refundStatus?1:3,'status'=>5,'result'=>json_encode(['amount'=>$amount,'params'=>$params,'result'=>$result],256),'failed_remark'=> $errmsg,'refund_money'=>$refundStatus?$total:0,'update_time'=>time()];
+                        $updateData = ['refund_status'=> $refundStatus?1:3,'status'=>5,'result'=>json_encode(['amount'=>$amount,'params'=>$params,'result'=>$result],256),'failed_remark'=> $errmsg,'refund_money'=>$refundStatus?$payTotal:0,'update_time'=>time()];
                         $this->saveLog("caches:payments:notify_{$scene}:pay_failed_{$orderNo}_{$orderUserId}", ['error'=>$this->error,'update'=>$updateData,'order' => $orderInfo,'result'=>$result, 'notify' => $data]);
                         if(!PayOrdersModel::where(['id'=>$orderId])->update($updateData)){
                             $this->error = '订单退款状态更新错误~';