Authored by 郭成尧

qhy_union

@@ -154,8 +154,9 @@ class BuyNowController { @@ -154,8 +154,9 @@ class BuyNowController {
154 * @param {*} next 154 * @param {*} next
155 */ 155 */
156 orderSub(req, res, next) { 156 orderSub(req, res, next) {
  157 + let uid = req.user.uid;
157 let params = { 158 let params = {
158 - uid: req.user.uid, 159 + uid: uid,
159 product_sku: req.body.product_sku, 160 product_sku: req.body.product_sku,
160 sku_type: req.body.sku_type, 161 sku_type: req.body.sku_type,
161 buy_number: req.body.buy_number, 162 buy_number: req.body.buy_number,
@@ -186,6 +187,10 @@ class BuyNowController { @@ -186,6 +187,10 @@ class BuyNowController {
186 } 187 }
187 } 188 }
188 189
  190 + if (req.cookies.mkt_code || req.cookies._QYH_UNION) {
  191 + params.qhy_union = paymentProcess.unionInfoHandle(req.cookies, uid);
  192 + }
  193 +
189 co(function * () { 194 co(function * () {
190 let result = yield req.ctx(BuyNowModel).submit(params); 195 let result = yield req.ctx(BuyNowModel).submit(params);
191 196
@@ -159,6 +159,10 @@ class BuyNowModel extends global.yoho.BaseModel { @@ -159,6 +159,10 @@ class BuyNowModel extends global.yoho.BaseModel {
159 finalParams.promotion_code = params.promotion_code; 159 finalParams.promotion_code = params.promotion_code;
160 } 160 }
161 161
  162 + if (params.qhy_union) {
  163 + finalParams.qhy_union = params.qhy_union;
  164 + }
  165 +
162 return api.post('', finalParams, {cache: false}); 166 return api.post('', finalParams, {cache: false});
163 } 167 }
164 168
@@ -443,8 +443,10 @@ function unionInfoHandle(cookies, uid) { @@ -443,8 +443,10 @@ function unionInfoHandle(cookies, uid) {
443 } 443 }
444 444
445 /* 模拟APP的User-Agent */ 445 /* 模拟APP的User-Agent */
446 - userAgent = clientId ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +  
447 - clientId + ';uid/' + uid + ')' : null; 446 + let clientIdSub = _.split(clientId, ',')[0];
  447 +
  448 + userAgent = clientIdSub ? 'YOHO!Buy/3.8.2.259(Model/H5;Channel/' +
  449 + clientIdSub + ';uid/' + uid + ')' : null;
448 450
449 return { 451 return {
450 unionKey: unionKey, 452 unionKey: unionKey,