Authored by 郭成尧

order-ensure-ok

... ... @@ -374,9 +374,10 @@ class CartData
* @param string $skuList 购买限购商品时需要传递的参数
* @param string $qhyUnion 友盟有关信息
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @param $times
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnion, $userAgent, $times)
{
$param = Yohobuy::param();
$param['debug'] = 'Y';
... ... @@ -391,6 +392,13 @@ class CartData
$param['delivery_time'] = $deliveryTime;
$param['delivery_way'] = $deliveryWay;
/* tar add 161130 结算优化 */
if ($times === 2) {
$param['is_continue_buy'] = 'Y';
} else {
$param['is_continue_buy'] = 'N';
}
if (!empty($invoices['invoices_type_id'])) {
//发票内容id--图书:1
$param['invoice_content'] = $invoices['invoices_type_id'];
... ... @@ -430,6 +438,23 @@ class CartData
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
/* TODO TAR DELETE!!! */
// return array(
// 'code' => 200,
// 'data' => array(
// 'activityAmount' => 0,
// 'hintInfo' => array(
// 'lastLine' => '继续结算剩余商品',
// 'prefix' => '',
// 'suffix' => '已被抢光',
// 'productName' => 'Life.After Life 字母印花织带休闲裤【吴亦凡亲身试着】'
// ),
// 'isOpenTicket' => 'N',
// 'is_hint' => 'Y',
// 'offline_submit_goods' => array(),
// 'shippingCost' => 0
// )
// );
return Yohobuy::get(API_URL, $param, false, false, 5, $userAgent);
}
... ...
... ... @@ -331,7 +331,7 @@ function submitOrder(times) {
window.setCookie('order-info', '');
window.location.href = url;
} else if (res.code === 409) {
richTip.show(res.msg, res.btns);
richTip.show(res.message, res.buttons);
} else if (res.message) {
tip.show(res.message);
}
... ...
... ... @@ -798,9 +798,10 @@ class CartModel
* @param string $skuList 购买限购商品时需要传递的参数
* @param string $qhyUnio 友盟有关信息
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @param int $times
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio = '', $userAgent = null, $times = 1)
{
$result = array('code' => 400, 'message' => '出错啦');
... ... @@ -816,11 +817,33 @@ class CartModel
UdpLog::info('【结算信息】配送方式参数校验','deliveryWay为空');
$result['code'] = 403;
$result['message'] = '请选择配送方式';
}
else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent);
} else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent, $times);
UdpLog::info('【结算信息】接口返回','orderSubRes'.json_encode($orderSubRes));
if ($orderSubRes && isset($orderSubRes['code'])) {
if (isset($orderSubRes['data'])
&& isset($orderSubRes['data']['is_hint'])
&& $orderSubRes['data']['is_hint'] === 'Y') {
$result['code'] = 409;
if (isset($orderSubRes['data']['hintInfo'])) {
$result['message'] = array(
$orderSubRes['data']['hintInfo']['productName'] . $orderSubRes['data']['hintInfo']['suffix'],
$orderSubRes['data']['hintInfo']['lastLine']
);
}
$result['buttons'] = array(
array(
'href' => Helpers::url('/cart/index'),
'text' => '重新选择商品',
),
array(
'text' => '继续结算',
'class' => 'order-tip-btnred'
));
} else if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
}
}
... ...
... ... @@ -624,22 +624,6 @@ class IndexController extends AbstractAction
*/
public function orderSubAction()
{
/* TODO TAR DELETE THIS !!! */
// $this->echoJson(array(
// 'code' => 409,
// 'msg' => array('XXX 商品已被抢光,', '继续结算剩余商品。'),
// 'btns' => array(
// // array(
// // 'href' => '/',
// // 'text' => '重新选择商品',
// // 'color' => '',
// // ),
// array(
// 'href' => '',
// 'text' => '知道了',
// 'class' => 'order-tip-btnred'
// )),
// ));exit;
if ($this->isAjax()) {
$uid = $this->getUid(true);
$addressId = $this->post('addressId', null);
... ... @@ -654,6 +638,8 @@ class IndexController extends AbstractAction
$yohoCoin = $this->post('yohoCoin', 1);
$skuList = $this->post('skuList', '');
$cookieData = $this->getCookie('order-info', null); //获取电子发票信息
$times = $this->post('times', 1);
//电子发票信息数组
$invoices = array();
if (!empty($cookieData)) {
... ... @@ -692,7 +678,7 @@ class IndexController extends AbstractAction
/* 模拟APP的User-Agent */
$userAgent = isset($unionInfo['client_id']) ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' . $unionInfo['client_id'] . ';uid/' . $uid . ')' : null;
}
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent);
$result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoices, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $unionKey, $userAgent, $times);
$result['data']['unionCookie'] = $unionInfo;
... ... @@ -703,8 +689,8 @@ class IndexController extends AbstractAction
. ',paymentId:' . $paymentId . ',paymentType:' . $paymentType . ',remark:' . $remark . ',couponCode:' . $couponCode . "\n";
error_log($message, 3, '/Data/logs/php/h5_error/order.' . date('Ym') . '.log');
UdpLog::info('【下单】下单异常数据', 'message:' . $message, '返回:' . json_encode($result));
} // 返回数据
else {
} else {
// 返回数据
// 提交成功清除Cookie
$this->setCookie('order-info', null);
... ...