Authored by 毕凯

Merge branch 'hotfix/buynow' into 'master'

Hotfix/buynow



See merge request !697
... ... @@ -154,8 +154,9 @@ class BuyNowController {
* @param {*} next
*/
orderSub(req, res, next) {
let uid = req.user.uid;
let params = {
uid: req.user.uid,
uid: uid,
product_sku: req.body.product_sku,
sku_type: req.body.sku_type,
buy_number: req.body.buy_number,
... ... @@ -170,7 +171,8 @@ class BuyNowController {
product_sku_list: req.body.product_sku_list,
is_print_price: req.body.is_print_price,
remark: req.body.remark,
activity_id: req.body.activity_id
activity_id: req.body.activity_id,
ip: req.yoho.clientIp
};
// 是否开发票
... ... @@ -186,6 +188,13 @@ class BuyNowController {
}
}
if (req.cookies.mkt_code || req.cookies._QYH_UNION) {
let unionInfo = paymentProcess.unionInfoHandle(req.cookies, uid);
params.qhy_union = _.get(unionInfo, 'unionKey', false);
params.userAgent = _.get(unionInfo, 'userAgent', '');
}
co(function * () {
let result = yield req.ctx(BuyNowModel).submit(params);
... ...
... ... @@ -231,7 +231,7 @@ exports.orderSub = (req, res, next) => {
unionKey: unionInfo.unionKey, // 友盟数据
userAgent: unionInfo.userAgent,
isWechat: req.yoho.isWechat,
ip: req.ip || '',
ip: req.yoho.clientIp,
udid: req.cookies._yasvd || 'yoho'
};
... ...
... ... @@ -159,7 +159,16 @@ class BuyNowModel extends global.yoho.BaseModel {
finalParams.promotion_code = params.promotion_code;
}
return api.post('', finalParams, {cache: false});
if (params.qhy_union) {
finalParams.qhy_union = params.qhy_union;
}
return api.post('', finalParams, {
headers: {
'X-Forwarded-For': params.ip || '',
'User-Agent': params.userAgent
}
});
}
/**
... ...
... ... @@ -443,8 +443,10 @@ function unionInfoHandle(cookies, uid) {
}
/* 模拟APP的User-Agent */
userAgent = clientId ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +
clientId + ';uid/' + uid + ')' : null;
let clientIdSub = _.split(clientId, ',')[0];
userAgent = clientIdSub ? 'YOHO!Buy/3.8.2.259(Model/H5;Channel/' +
clientIdSub + ';uid/' + uid + ')' : null;
return {
unionKey: unionKey,
... ...