Showing
3 changed files
with
52 additions
and
2 deletions
@@ -148,4 +148,25 @@ class OrderData | @@ -148,4 +148,25 @@ class OrderData | ||
148 | return Yohobuy::post(Yohobuy::API_URL, $param); | 148 | return Yohobuy::post(Yohobuy::API_URL, $param); |
149 | } | 149 | } |
150 | 150 | ||
151 | + /** | ||
152 | + * 支付成功后--支付确认接口 | ||
153 | + * @param type int $orderCode 订单号 | ||
154 | + * @param type int $paymentId 支付方式 | ||
155 | + * @param type int $uid 用户ID | ||
156 | + * @return type [] | ||
157 | + */ | ||
158 | + public static function payConfirm($orderCode, $paymentId, $uid) | ||
159 | + { | ||
160 | + // 构建必传参数 | ||
161 | + $param = Yohobuy::param(); | ||
162 | + $param['method'] = 'app.SpaceOrders.payConfirm'; | ||
163 | + $param['order_code'] = $orderCode; | ||
164 | + $param['payment_id'] = $paymentId; | ||
165 | + $param['uid'] = intval($uid); | ||
166 | + $param['client_secret'] = Sign::getSign($param); | ||
167 | + | ||
168 | + // 调用接口获得数据 | ||
169 | + return Yohobuy::post(Yohobuy::API_URL, $param); | ||
170 | + | ||
171 | + } | ||
151 | } | 172 | } |
@@ -243,8 +243,8 @@ class PaymentModel | @@ -243,8 +243,8 @@ class PaymentModel | ||
243 | } | 243 | } |
244 | 244 | ||
245 | // if ($orderData['payment_status'] === 'N') { | 245 | // if ($orderData['payment_status'] === 'N') { |
246 | -// logup::info( | ||
247 | -// '用户支付成功,同步地址返回,查询订单状态为未付款,有可能异步地址还未即时更新状态', | 246 | +// UdpLog::info( |
247 | +// '【用户支付成功,同步地址返回】,查询订单状态为未付款,有可能异步地址还未即时更新状态,参数', | ||
248 | // array('payResult' => $payResult, 'orderData' => $orderData) | 248 | // array('payResult' => $payResult, 'orderData' => $orderData) |
249 | // ); | 249 | // ); |
250 | // } | 250 | // } |
@@ -414,4 +414,29 @@ class PaymentModel | @@ -414,4 +414,29 @@ class PaymentModel | ||
414 | } | 414 | } |
415 | return $uid; | 415 | return $uid; |
416 | } | 416 | } |
417 | + /** | ||
418 | + * 支付成功后--确认接口 | ||
419 | + * @param type object $payResult 订单号 | ||
420 | + * @param type int $paymentId 支付方式id | ||
421 | + * @param type int $uid 用户ID | ||
422 | + * @return type [] | ||
423 | + */ | ||
424 | + public static function payConfirm($payResult, $paymentId, $uid) | ||
425 | + { | ||
426 | +// UdpLog::info("【支付成功-发送确认接口】,function:payConfirm,支付方式ID:{$paymentId},参数", $payResult); | ||
427 | + if (empty($payResult->orderCode)) { | ||
428 | + return self::$code; | ||
429 | + } | ||
430 | + | ||
431 | + $orderCode = $payResult->orderCode; | ||
432 | + //如果uid,为空,则从缓存中取uid,但还是不排除uid为空的情况下。 | ||
433 | + $uid = empty($uid) ? self::getUid($orderCode) : $uid; | ||
434 | + $confirm = OrderData::payConfirm($orderCode, $paymentId, $uid); | ||
435 | + | ||
436 | +// UdpLog::info( | ||
437 | +// "【支付成功-发送确认接口】,function:payConfirm,orderCode:{$orderCode},支付方式ID:{$paymentId},接口返回", | ||
438 | +// array('confirm' => $confirm, '$payResult' => $payResult) | ||
439 | +// ); | ||
440 | + return $confirm; | ||
441 | + } | ||
417 | } | 442 | } |
@@ -100,6 +100,10 @@ class PayreturnController extends WebAction | @@ -100,6 +100,10 @@ class PayreturnController extends WebAction | ||
100 | ); | 100 | ); |
101 | 101 | ||
102 | if ($payResult->payResult == 200) { | 102 | if ($payResult->payResult == 200) { |
103 | + //支付成功,发送一次支付确认 | ||
104 | + $uid = $this->getUid(true); | ||
105 | + PaymentModel::payConfirm($payResult, $payment, $uid); | ||
106 | + | ||
103 | //支付成功 | 107 | //支付成功 |
104 | $result = PaymentModel::procOrderData($payResult, $payment); | 108 | $result = PaymentModel::procOrderData($payResult, $payment); |
105 | } | 109 | } |
-
Please register or login to post a comment