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) => { @@ -207,6 +207,7 @@ exports.orderSub = (req, res, next) => {
207 let userAgent = null; 207 let userAgent = null;
208 let unionKey = ''; 208 let unionKey = '';
209 let unionInfo = {}; 209 let unionInfo = {};
  210 + let clientId = null;
210 211
211 if (req.cookies.mkt_code || req.cookies._QYH_UNION) { 212 if (req.cookies.mkt_code || req.cookies._QYH_UNION) {
212 /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理, 213 /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理,
@@ -222,24 +223,24 @@ exports.orderSub = (req, res, next) => { @@ -222,24 +223,24 @@ exports.orderSub = (req, res, next) => {
222 223
223 unionKey = testQyhUnion.client_id ? encryData : ''; 224 unionKey = testQyhUnion.client_id ? encryData : '';
224 } 225 }
  226 +
  227 + try {
  228 + unionInfo = JSON.parse(unionKey);
  229 + } catch (e) {
  230 + unionInfo = {};
  231 + logger.error(`orderEnsure: _QYH_UNION:${req.cookies._QYH_UNION}`);
  232 + }
  233 +
  234 + clientId = unionInfo && unionInfo.client_id;
225 } else { 235 } else {
226 unionKey = '{"client_id":' + req.cookies.mkt_code + 236 unionKey = '{"client_id":' + req.cookies.mkt_code +
227 (req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}'; 237 (req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}';
  238 + clientId = req.cookies.mkt_code;
228 } 239 }
229 240
230 - /* 检查联盟参数是否有效 */  
231 - try {  
232 - unionInfo = JSON.parse(unionKey);  
233 - } catch (e) {  
234 - unionInfo = {};  
235 - logger.error(`orderEnsure: mkt_code:${req.cookies.mkt_code}, union_data:${req.cookies.union_data}`);  
236 - }  
237 -  
238 - unionInfo = unionKey ? unionInfo : {};  
239 -  
240 /* 模拟APP的User-Agent */ 241 /* 模拟APP的User-Agent */
241 - userAgent = unionInfo.client_id ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +  
242 - unionInfo.client_id + ';uid/' + uid + ')' : null; 242 + userAgent = clientId ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +
  243 + clientId + ';uid/' + uid + ')' : null;
243 } 244 }
244 245
245 return co(function* () { 246 return co(function* () {
@@ -259,13 +260,6 @@ exports.orderSub = (req, res, next) => { @@ -259,13 +260,6 @@ exports.orderSub = (req, res, next) => {
259 yohoCoin, skuList, unionKey, userAgent, null, null, ip); 260 yohoCoin, skuList, unionKey, userAgent, null, null, ip);
260 } 261 }
261 262
262 - if (unionInfo && result.data) {  
263 - result.data.unionCookie = unionInfo;  
264 - } else {  
265 - logger.info(`orderEnsure: unionInfo:${JSON.stringify(unionInfo)},  
266 - result data:${JSON.stringify(result.data)}`);  
267 - }  
268 -  
269 // 提交成功清除Cookie 263 // 提交成功清除Cookie
270 orderInfo = {}; 264 orderInfo = {};
271 res.cookie('order-info', null, actCkOpthn); 265 res.cookie('order-info', null, actCkOpthn);