wesmiler hace 3 meses
padre
commit
9c019d27a4
Se han modificado 1 ficheros con 3 adiciones y 6 borrados
  1. 3 6
      app/Services/PaymentService.php

+ 3 - 6
app/Services/PaymentService.php

@@ -492,7 +492,7 @@ class PaymentService extends BaseService
             // 生活充值
             else if ($scene == 'pay') {
                 $orderInfo = PayOrdersModel::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', 'pay_at as pay_time', 'remark', 'status'])
+                    ->select(['id as order_id', 'user_id','meal_id','product_id', 'order_no','transaction_id','account', 'total as pay_money','pay_total', 'pay_at as pay_time', 'remark', 'status'])
                     ->first();
                 $orderStatus = isset($orderInfo['status']) ? $orderInfo['status'] : 0;
                 // 验证订单
@@ -566,9 +566,6 @@ class PaymentService extends BaseService
                     $account = isset($orderInfo['account'])? $orderInfo['account'] : '';
                     $total = isset($orderInfo['pay_money'])? $orderInfo['pay_money'] : 0;
                     $amount = $total;
-                    if(env('PAY_DEBUG')){
-                        $amount = 50;
-                    }
 
                     $result = DyrPayService::make()->recharge($orderNo, $account, $productId, $amount);
                     $errno = isset($result['errno'])?$result['errno'] : -1;
@@ -584,7 +581,7 @@ class PaymentService extends BaseService
                         $orderInfo['money'] = $total;
                         $orderInfo['remark'] = '充值失败退款';
                         $refundStatus = PaymentService::make()->refund($orderInfo,'pay');
-                        $updateData = ['refund_status'=> $refundStatus?1:3,'status'=>5,'failed_remark'=> $errmsg,'refund_money'=>$refundStatus?$total:0,'update_time'=>time()];
+                        $updateData = ['refund_status'=> $refundStatus?1:3,'status'=>5,'result'=>json_encode(['amount'=>$amount,'result'=>$result],256),'failed_remark'=> $errmsg,'refund_money'=>$refundStatus?$total: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 = '订单退款状态更新错误~';
@@ -594,7 +591,7 @@ class PaymentService extends BaseService
                         return false;
                     }
 
-                    $updateData = ['status'=>3,'out_trade_no'=>$order_number,'update_time'=>time()+1];
+                    $updateData = ['status'=>3,'result'=>json_encode(['amount'=>$amount,'result'=>$result],256),'out_trade_no'=>$order_number,'update_time'=>time()+1];
                     $this->saveLog("caches:payments:notify_{$scene}:pay_success_{$orderNo}_{$orderUserId}", ['error'=> '充值调用成功','id'=>$orderId,'update'=>$updateData,'order' => $orderInfo,'result'=>$result, 'notify' => $data]);
                     if(!PayOrdersModel::where(['id'=>$orderId])->update($updateData)){
                         DB::commit();