Authored by ccbikai(👎🏻🍜)

Merge remote-tracking branch 'origin/release/5.4.1' into gray

@@ -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,16 +223,24 @@ exports.orderSub = (req, res, next) => { @@ -222,16 +223,24 @@ exports.orderSub = (req, res, next) => {
222 223
223 unionKey = testQyhUnion.client_id ? encryData : ''; 224 unionKey = testQyhUnion.client_id ? encryData : '';
224 } 225 }
225 - } else {  
226 - unionKey = '{"client_id":' + req.cookies.mkt_code + (req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}'; 226 +
  227 + try {
  228 + unionInfo = JSON.parse(unionKey);
  229 + } catch (e) {
  230 + unionInfo = {};
  231 + logger.error(`orderEnsure: _QYH_UNION:${req.cookies._QYH_UNION}`);
227 } 232 }
228 233
229 - /* 检查联盟参数是否有效 */  
230 - unionInfo = unionKey ? JSON.parse(unionKey) : {}; 234 + clientId = unionInfo && unionInfo.client_id;
  235 + } else {
  236 + unionKey = '{"client_id":' + req.cookies.mkt_code +
  237 + (req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}';
  238 + clientId = req.cookies.mkt_code;
  239 + }
231 240
232 /* 模拟APP的User-Agent */ 241 /* 模拟APP的User-Agent */
233 - userAgent = unionInfo.client_id ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +  
234 - unionInfo.client_id + ';uid/' + uid + ')' : null; 242 + userAgent = clientId ? 'YOHO!Buy/3.8.2.259(Model/PC;Channel/' +
  243 + clientId + ';uid/' + uid + ')' : null;
235 } 244 }
236 245
237 return co(function* () { 246 return co(function* () {
@@ -251,13 +260,6 @@ exports.orderSub = (req, res, next) => { @@ -251,13 +260,6 @@ exports.orderSub = (req, res, next) => {
251 yohoCoin, skuList, unionKey, userAgent, null, null, ip); 260 yohoCoin, skuList, unionKey, userAgent, null, null, ip);
252 } 261 }
253 262
254 - if (unionInfo && result.data) {  
255 - result.data.unionCookie = unionInfo;  
256 - } else {  
257 - logger.info(`orderEnsure: unionInfo:${JSON.stringify(unionInfo)},  
258 - result data:${JSON.stringify(result.data)}`);  
259 - }  
260 -  
261 // 提交成功清除Cookie 263 // 提交成功清除Cookie
262 orderInfo = {}; 264 orderInfo = {};
263 res.cookie('order-info', null, actCkOpthn); 265 res.cookie('order-info', null, actCkOpthn);
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-01-03 17:42:41 3 * @Date: 2017-01-03 17:42:41
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-02-20 17:46:16 5 + * @Last Modified time: 2017-02-27 16:34:09
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
@@ -173,7 +173,7 @@ const Wechat = { @@ -173,7 +173,7 @@ const Wechat = {
173 ip: ip 173 ip: ip
174 }); 174 });
175 175
176 - if (unifiedOrderResult) { 176 + if (unifiedOrderResult && unifiedOrderResult.appid && unifiedOrderResult.prepay_id) {
177 let nonceStr = common.nonceStr(); 177 let nonceStr = common.nonceStr();
178 178
179 let resParams = { 179 let resParams = {
@@ -45,7 +45,10 @@ const handleBrandList = origin => { @@ -45,7 +45,10 @@ const handleBrandList = origin => {
45 } 45 }
46 46
47 _.forEach(value, function(subValue) { 47 _.forEach(value, function(subValue) {
48 - subValue.brandUrl = '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1'; 48 + subValue.brandUrl = helpers.urlFormat('/', {
  49 + query: subValue.brand_domain,
  50 + app_type: 1
  51 + }, 'search');
49 subValue.name = subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name; 52 subValue.name = subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name;
50 subValue.domain = subValue.brand_domain; 53 subValue.domain = subValue.brand_domain;
51 }); 54 });
@@ -22,6 +22,7 @@ const shop = { @@ -22,6 +22,7 @@ const shop = {
22 let brandLogo = {}; 22 let brandLogo = {};
23 let title = ''; 23 let title = '';
24 let uid = req.user.uid || 0; 24 let uid = req.user.uid || 0;
  25 + let shopEnter;
25 26
26 if (req.query.shop_id) { 27 if (req.query.shop_id) {
27 return shop.shop(req, res, next); 28 return shop.shop(req, res, next);
@@ -73,7 +74,14 @@ const shop = { @@ -73,7 +74,14 @@ const shop = {
73 if (brandId === 0) { 74 if (brandId === 0) {
74 params.query = domain; 75 params.query = domain;
75 } 76 }
76 - if (brandShop.length > 0 || brandLogo) { 77 +
  78 + if (req.query.app_type && parseInt(req.query.app_type, 10) === 1) {
  79 + shopEnter = false;
  80 + } else {
  81 + shopEnter = true;
  82 + }
  83 +
  84 + if (brandShop.length > 0 || brandLogo && shopEnter) {
77 params = _.assign({ 85 params = _.assign({
78 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop, 86 brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
79 search: { 87 search: {
@@ -69,11 +69,18 @@ const list = (req, res, next) => { @@ -69,11 +69,18 @@ const list = (req, res, next) => {
69 69
70 // 跳转到品牌商品列表页 70 // 跳转到品牌商品列表页
71 if (domain !== null && !params.shop_id) { 71 if (domain !== null && !params.shop_id) {
72 - let url = helpers.urlFormat('', { 72 + let urlPro = {
73 from: 'search', 73 from: 'search',
74 query: query 74 query: query
  75 + }
  76 +
  77 + if (req.query.app_type) {
  78 + urlPro = _.assign(urlPro, {
  79 + app_type: req.query.app_type
  80 + })
  81 + }
75 82
76 - }, domain); 83 + let url = helpers.urlFormat('', urlPro, domain);
77 84
78 return res.redirect(url); 85 return res.redirect(url);
79 } 86 }
@@ -26,10 +26,10 @@ const tool = { @@ -26,10 +26,10 @@ const tool = {
26 // dest.virtualGoods = (origin.attribute * 1 === 3); 26 // dest.virtualGoods = (origin.attribute * 1 === 3);
27 27
28 // 活动促销短语 28 // 活动促销短语
29 - origin.market_phrase && (dest.marketPhrase = origin.market_phrase); 29 + origin.market_phrase && origin.market_phrase !== ' ' && (dest.marketPhrase = origin.market_phrase);
30 30
31 // 商品促销短语 31 // 商品促销短语
32 - origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase); 32 + origin.sales_phrase && origin.sales_phrase !== ' ' && (dest.goodsSubtitle = origin.sales_phrase);
33 33
34 // 商品标签 34 // 商品标签
35 if (origin.tags) { 35 if (origin.tags) {
@@ -8,7 +8,7 @@ require('channel/home.page.css'); @@ -8,7 +8,7 @@ require('channel/home.page.css');
8 8
9 9
10 var $ = require('yoho-jquery'), 10 var $ = require('yoho-jquery'),
11 - Swiper = require('yoho-swiper2'), 11 + Swiper = require('yoho-swiper'),
12 lazyLoad = require('yoho-jquery-lazyload'), 12 lazyLoad = require('yoho-jquery-lazyload'),
13 fastclick = require('yoho-fastclick'), 13 fastclick = require('yoho-fastclick'),
14 noticeScroll = require('../plugin/notice-scroll'), 14 noticeScroll = require('../plugin/notice-scroll'),
@@ -12,6 +12,7 @@ const isApp = /yohobuy/i.test(u) || @@ -12,6 +12,7 @@ const isApp = /yohobuy/i.test(u) ||
12 12
13 const isiOS = /(iPhone|iPad|iPod|iOS)/i.test(u); // ios终端 13 const isiOS = /(iPhone|iPad|iPod|iOS)/i.test(u); // ios终端
14 const isAndroid = /Android/i.test(u); // android终端 14 const isAndroid = /Android/i.test(u); // android终端
  15 +const isWechatDevtool = /wechatdevtools/i.test(u); // 微信开发者工具
15 16
16 // const iOSVersion = parseInt((u.match(/OS (\d+)_(\d+)_?(\d+)?/i) || [])[1], 10); // iOS 版本 17 // const iOSVersion = parseInt((u.match(/OS (\d+)_(\d+)_?(\d+)?/i) || [])[1], 10); // iOS 版本
17 18
@@ -47,7 +48,7 @@ const getMktcBySeo = function() { @@ -47,7 +48,7 @@ const getMktcBySeo = function() {
47 }; 48 };
48 49
49 const canOpenApp = () => { 50 const canOpenApp = () => {
50 - if (isApp || isFromYOHO || nodownload || qs.nodownload || qs.no_openapp || blackCheck) { 51 + if (isWechatDevtool || isApp || isFromYOHO || nodownload || qs.nodownload || qs.no_openapp || blackCheck) {
51 return false; 52 return false;
52 } 53 }
53 return isAndroid || isiOS || qs.openapp; 54 return isAndroid || isiOS || qs.openapp;
@@ -388,4 +388,22 @@ @@ -388,4 +388,22 @@
388 .discount-gray { 388 .discount-gray {
389 background-color: #e0e0e0; 389 background-color: #e0e0e0;
390 } 390 }
  391 +
  392 + .hover {
  393 + position: fixed;
  394 + width: 100%;
  395 + background-color: black;
  396 + height: 100%;
  397 + top: 0;
  398 + left: 0;
  399 + right: 0;
  400 + border: 0;
  401 + z-index: 999;
  402 + align-items: center;
  403 + display: flex;
  404 +
  405 + img {
  406 + width: 100%;
  407 + }
  408 + }
391 } 409 }
@@ -212,7 +212,7 @@ @@ -212,7 +212,7 @@
212 } 212 }
213 213
214 .want { 214 .want {
215 - max-height: 300px; 215 + max-height: 250px;
216 overflow: hidden; 216 overflow: hidden;
217 } 217 }
218 } 218 }
@@ -28,7 +28,7 @@ const formatPromotionTitle = (promo) => { @@ -28,7 +28,7 @@ const formatPromotionTitle = (promo) => {
28 let match = regPromoTitle.exec(promo.promotion_title); 28 let match = regPromoTitle.exec(promo.promotion_title);
29 let promotionTitle = match !== null && match.length > 1 ? match[1] : promo.promotion_title; 29 let promotionTitle = match !== null && match.length > 1 ? match[1] : promo.promotion_title;
30 30
31 - promotionTitle = promotionTitle.replace('¥', '¥'); 31 + promotionTitle = promotionTitle.replace(/¥/g, '¥');
32 return `${title}${promotionTitle}】`; 32 return `${title}${promotionTitle}】`;
33 }; 33 };
34 const formatPromotionOpt = (promo) => { 34 const formatPromotionOpt = (promo) => {
@@ -300,7 +300,7 @@ const procCartData = (data, isAdvanceCart) => { @@ -300,7 +300,7 @@ const procCartData = (data, isAdvanceCart) => {
300 result.giftHasStorage = _.some(result.freebie, freebie => freebie.status === 10); 300 result.giftHasStorage = _.some(result.freebie, freebie => freebie.status === 10);
301 301
302 // 加价购 302 // 加价购
303 - result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => advanceBuy.status !== 30 && advanceBuy.status !== 0); 303 + result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => advanceBuy.status !== 30 && advanceBuy.status !== 0);// eslint-disable-line
304 result.selectAdvanceBuy = result.advanceBuy.filter(advanceBuy => advanceBuy.status === 10); 304 result.selectAdvanceBuy = result.advanceBuy.filter(advanceBuy => advanceBuy.status === 10);
305 result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => advanceBuy.status === 10); 305 result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => advanceBuy.status === 10);
306 } 306 }
@@ -341,7 +341,7 @@ const procCartData = (data, isAdvanceCart) => { @@ -341,7 +341,7 @@ const procCartData = (data, isAdvanceCart) => {
341 341
342 result.formulaPrice = data.shopping_cart_data.promotion_formula; 342 result.formulaPrice = data.shopping_cart_data.promotion_formula;
343 result.count = data.shopping_cart_data.selected_goods_count; 343 result.count = data.shopping_cart_data.selected_goods_count;
344 - result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0); 344 + result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);// eslint-disable-line
345 result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount); 345 result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount);
346 result.hasNoSaleGoods = result.notValidGoods.length || result.offShelveGoods.length; 346 result.hasNoSaleGoods = result.notValidGoods.length || result.offShelveGoods.length;
347 347