|
@@ -559,6 +559,7 @@ class PaymentService extends BaseService
|
|
|
break;
|
|
break;
|
|
|
case 'pay': //
|
|
case 'pay': //
|
|
|
// 调起 接口充值
|
|
// 调起 接口充值
|
|
|
|
|
+ $orderId = isset($orderInfo['id'])? $orderInfo['id'] : 0;
|
|
|
$productId = isset($orderInfo['product_id'])? $orderInfo['product_id'] : '';
|
|
$productId = isset($orderInfo['product_id'])? $orderInfo['product_id'] : '';
|
|
|
$orderNo = isset($orderInfo['order_no'])? $orderInfo['order_no'] : '';
|
|
$orderNo = isset($orderInfo['order_no'])? $orderInfo['order_no'] : '';
|
|
|
$account = isset($orderInfo['account'])? $orderInfo['account'] : '';
|
|
$account = isset($orderInfo['account'])? $orderInfo['account'] : '';
|
|
@@ -570,14 +571,24 @@ class PaymentService extends BaseService
|
|
|
$order_number = isset($data['order_number'])?$data['order_number']:'';
|
|
$order_number = isset($data['order_number'])?$data['order_number']:'';
|
|
|
$total_price = isset($data['total_price'])?$data['total_price']:'';
|
|
$total_price = isset($data['total_price'])?$data['total_price']:'';
|
|
|
if(empty($result) || $errno != 0 || empty($order_number)){
|
|
if(empty($result) || $errno != 0 || empty($order_number)){
|
|
|
|
|
+ DB::commit();
|
|
|
$this->error = '充值调用失败:'.$errmsg;
|
|
$this->error = '充值调用失败:'.$errmsg;
|
|
|
- DB::rollBack();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 退款
|
|
|
|
|
+ $orderInfo['money'] = $amount;
|
|
|
|
|
+ $orderInfo['remark'] = '充值失败退款';
|
|
|
|
|
+ $refundStatus = PaymentService::make()->refund($orderInfo,'pay');
|
|
|
|
|
+ if(!PayOrdersModel::where(['id'=>$orderId])->update(['refund_status'=> $refundStatus?1:3,'status'=>5,'refund_money'=>$refundStatus?$amount:0,'update_time'=>time()])){
|
|
|
|
|
+ $this->error = '订单退款状态更新错误~';
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(!PayOrdersModel::where(['status'=>3,'out_trade_no'=>$order_number,'pay_total'=>$total_price,'remark'=> json_encode($data,256),'update_time'=>time()])){
|
|
if(!PayOrdersModel::where(['status'=>3,'out_trade_no'=>$order_number,'pay_total'=>$total_price,'remark'=> json_encode($data,256),'update_time'=>time()])){
|
|
|
|
|
+ DB::commit();
|
|
|
$this->error = '更新充值订单失败';
|
|
$this->error = '更新充值订单失败';
|
|
|
- DB::rollBack();
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -596,6 +607,15 @@ class PaymentService extends BaseService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 充值回调
|
|
|
|
|
+ * @param $productId
|
|
|
|
|
+ * @param $data
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ * @throws \Yansongda\Pay\Exception\ContainerException
|
|
|
|
|
+ * @throws \Yansongda\Pay\Exception\InvalidParamsException
|
|
|
|
|
+ * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
|
|
|
|
|
+ */
|
|
|
public function catchPayNotify($productId, $data)
|
|
public function catchPayNotify($productId, $data)
|
|
|
{
|
|
{
|
|
|
$out_trade_num = isset($data['out_trade_num'])?$data['out_trade_num']:'';
|
|
$out_trade_num = isset($data['out_trade_num'])?$data['out_trade_num']:'';
|