Authored by 毕凯

Merge branch 'hotfix/unionData' into 'release/5.4.1'

下单 client_id 独立出来



See merge request !322
... ... @@ -207,6 +207,7 @@ exports.orderSub = (req, res, next) => {
let userAgent = null;
let unionKey = '';
let unionInfo = {};
let clientId = null;
if (req.cookies.mkt_code || req.cookies._QYH_UNION) {
/* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理,
... ... @@ -222,24 +223,24 @@ exports.orderSub = (req, res, next) => {
unionKey = testQyhUnion.client_id ? encryData : '';
}
try {
unionInfo = JSON.parse(unionKey);
} catch (e) {
unionInfo = {};
logger.error(`orderEnsure: _QYH_UNION:${req.cookies._QYH_UNION}`);
}
clientId = unionInfo && unionInfo.client_id;
} else {
unionKey = '{"client_id":' + req.cookies.mkt_code +
(req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}';
clientId = req.cookies.mkt_code;
}
/* 检查联盟参数是否有效 */
try {
unionInfo = JSON.parse(unionKey);
} catch (e) {
unionInfo = {};
logger.error(`orderEnsure: mkt_code:${req.cookies.mkt_code}, union_data:${req.cookies.union_data}`);
}
unionInfo = unionKey ? unionInfo : {};
/* 模拟APP的User-Agent */
userAgent = unionInfo.client_id ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +
unionInfo.client_id + ';uid/' + uid + ')' : null;
userAgent = clientId ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +
clientId + ';uid/' + uid + ')' : null;
}
return co(function* () {
... ... @@ -259,13 +260,6 @@ exports.orderSub = (req, res, next) => {
yohoCoin, skuList, unionKey, userAgent, null, null, ip);
}
if (unionInfo && result.data) {
result.data.unionCookie = unionInfo;
} else {
logger.info(`orderEnsure: unionInfo:${JSON.stringify(unionInfo)},
result data:${JSON.stringify(result.data)}`);
}
// 提交成功清除Cookie
orderInfo = {};
res.cookie('order-info', null, actCkOpthn);
... ...