Authored by 郝肖肖

更新订单状态接口二合一

@@ -218,5 +218,26 @@ class PayData @@ -218,5 +218,26 @@ class PayData
218 218
219 return Yohobuy::get(Yohobuy::API_URL, $param); 219 return Yohobuy::get(Yohobuy::API_URL, $param);
220 } 220 }
  221 +
  222 + /**
  223 + * 更新订单状态-未付款更新已付款状态
  224 + * @param type int $orderCode 订单号
  225 + * @param type int $paymentCode 支付方式
  226 + * @param type int $totalFee 金额
  227 + * @return type []
  228 + */
  229 + public static function pcpayNotify($orderCode, $paymentCode, $totalFee)
  230 + {
  231 + $param = Yohobuy::param();
  232 + $param['client_type'] = 'web';
  233 + $param['private_key'] = Yohobuy::$privateKeyList['web'];
  234 + $param['method'] = 'web.SpaceOrders.pcpayNotify';
  235 + $param['orderCode'] = $orderCode;
  236 + $param['paymentCode'] = $paymentCode;
  237 + $param['totalFee'] = $totalFee;
  238 +
  239 + $param['client_secret'] = Sign::getSign($param);
221 240
  241 + return Yohobuy::get(Yohobuy::API_URL, $param);
  242 + }
222 } 243 }
@@ -68,7 +68,7 @@ class PayController extends AbstractAction @@ -68,7 +68,7 @@ class PayController extends AbstractAction
68 // 此处是咨询过JAVA开发任明明,按照老代码的实现方式判断,更新支付方式 68 // 此处是咨询过JAVA开发任明明,按照老代码的实现方式判断,更新支付方式
69 $paymentRecod = OrderData::updateOrderPayment($orderCode, 2, $uid); 69 $paymentRecod = OrderData::updateOrderPayment($orderCode, 2, $uid);
70 if (empty($paymentRecod) || $paymentRecod['code'] != 200) { 70 if (empty($paymentRecod) || $paymentRecod['code'] != 200) {
71 - $this->helpJsRedirect('系统繁忙,请稍后再试'); 71 + $this->helpJsRedirect(isset($paymentRecod['message']) ? $paymentRecod['message'] : '系统繁忙,请稍后再试');
72 break; 72 break;
73 } 73 }
74 74
@@ -337,7 +337,7 @@ class PayModel @@ -337,7 +337,7 @@ class PayModel
337 $paymentRecod = OrderData::updateOrderPayment($orderCode, $payId, $uid); 337 $paymentRecod = OrderData::updateOrderPayment($orderCode, $payId, $uid);
338 if (empty($paymentRecod) || $paymentRecod['code'] != 200) { 338 if (empty($paymentRecod) || $paymentRecod['code'] != 200) {
339 $result['error'] = true; 339 $result['error'] = true;
340 - $result['message'] = '系统繁忙,请稍后再试'; 340 + $result['message'] = isset($paymentRecod['message']) ? $paymentRecod['message'] : '系统繁忙,请稍后再试';
341 break; 341 break;
342 } 342 }
343 $bankRecord = PayData::getBankByOrder($orderCode); 343 $bankRecord = PayData::getBankByOrder($orderCode);
@@ -130,13 +130,8 @@ class PaymentModel @@ -130,13 +130,8 @@ class PaymentModel
130 130
131 // 无需付款 131 // 无需付款
132 if (isset($order["payment_amount"]) && $order["payment_amount"] == 0) { 132 if (isset($order["payment_amount"]) && $order["payment_amount"] == 0) {
133 -  
134 - // ERP提交订单状态  
135 - PayData::submitOrderStatus($orderCode, 0, '', '', 0, '', '', '');  
136 -  
137 - // 更新订单的状态  
138 - PayData::updateOrderStatus($order['order_id'], $uid, 0, 'Y', '');  
139 - 133 + //更新订单状态
  134 + PayData::pcpayNotify($orderCode, 0, 0);
140 $result['notNeedPay'] = true; 135 $result['notNeedPay'] = true;
141 break; 136 break;
142 } 137 }
@@ -332,7 +327,6 @@ class PaymentModel @@ -332,7 +327,6 @@ class PaymentModel
332 $firstGoods = current($orderData['order_goods']); 327 $firstGoods = current($orderData['order_goods']);
333 self::$code = array( 328 self::$code = array(
334 'code' => 200, 329 'code' => 200,
335 - 'message' => '支付成功,请等待发货',  
336 'orderNum' => $orderData['order_code'], 330 'orderNum' => $orderData['order_code'],
337 'amount' => $orderData['payment_amount'], 331 'amount' => $orderData['payment_amount'],
338 'address' => $orderData['address'], 332 'address' => $orderData['address'],