Authored by 郝肖肖
Committed by 郭成尧

联盟下单修复

@@ -189,22 +189,18 @@ exports.orderSub = (req, res, next) => { @@ -189,22 +189,18 @@ exports.orderSub = (req, res, next) => {
189 /* 189 /*
190 *1、http://union.yohobuy.com/go?client_id=3415&aid=0118&channel=3415&cid=3601&wi=NDgwMDB8dGVzdA==&target=http://m.yohobuy.com/ 190 *1、http://union.yohobuy.com/go?client_id=3415&aid=0118&channel=3415&cid=3601&wi=NDgwMDB8dGVzdA==&target=http://m.yohobuy.com/
191 *2、http://union.yoho.cn/union/jump?channel_id=51fanli&u_id=6&tracking_code=fanli123&target_url=http%3a%2f%2fm.yohobuy.com%3funion_type%3d3063%26utm_source%3dmfanli%26utm_medium%3dcps%26utm_campaign%3dmpfanli 191 *2、http://union.yoho.cn/union/jump?channel_id=51fanli&u_id=6&tracking_code=fanli123&target_url=http%3a%2f%2fm.yohobuy.com%3funion_type%3d3063%26utm_source%3dmfanli%26utm_medium%3dcps%26utm_campaign%3dmpfanli
  192 + *3、union.yohobuy.com/go/proxy?utm_medium=none&utm_campaign=none&client_id=991002&ads_code=&go_url=https%253A%252F%252Fm.yohobuy.com%252F%253Futm_source%253Dhyyx%2526utm_medium%253Dnone%2526utm_campaign%253Dnone%2526union_type%253D991002&channel_code=hyyx&append=&mbr_name=&u_id=&aid=&channel=cps&cid=&wi=
192 **/ 193 **/
193 /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理, 194 /* tar modified 161108 添加新的联盟数据处理逻辑,兼容原有联盟数据处理,
194 区别是旧的北京写 cookie 加密过来,新的 node 写 cookie,没有加密 */ 195 区别是旧的北京写 cookie 加密过来,新的 node 写 cookie,没有加密 */
195 if (req.cookies._QYH_UNION) { 196 if (req.cookies._QYH_UNION) {
196 - try { 197 + unionKey = authcode(req.cookies._QYH_UNION, 'q_union_yohobuy');
  198 +
  199 + if (!unionKey) {
197 let encryData = crypto.decrypt('', decodeURIComponent(req.cookies._QYH_UNION)); 200 let encryData = crypto.decrypt('', decodeURIComponent(req.cookies._QYH_UNION));
198 encryData = encryData.substr(0, encryData.lastIndexOf('}') + 1); 201 encryData = encryData.substr(0, encryData.lastIndexOf('}') + 1);
199 - testQyhUnion = JSON.parse(encryData);  
200 - } catch (e) {  
201 - testQyhUnion = {};  
202 - }  
203 -  
204 - if (testQyhUnion.client_id) {  
205 - unionKey = encryData;  
206 - } else {  
207 - unionKey = authcode(req.cookies._QYH_UNION, 'q_union_yohobuy'); 202 + let testQyhUnion = JSON.parse(encryData);
  203 + unionKey = testQyhUnion.client_id ? encryData : '';
208 } 204 }
209 } else { 205 } else {
210 unionKey = '{"client_id":' + req.cookies.mkt_code + '}'; 206 unionKey = '{"client_id":' + req.cookies.mkt_code + '}';