Authored by ccbikai(👎🏻🍜)

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

... ... @@ -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,16 +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 : '') + '}';
unionKey = '{"client_id":' + req.cookies.mkt_code +
(req.cookies.union_data ? ',"union_data":' + req.cookies.union_data : '') + '}';
clientId = req.cookies.mkt_code;
}
/* 检查联盟参数是否有效 */
unionInfo = unionKey ? JSON.parse(unionKey) : {};
/* 模拟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* () {
... ... @@ -251,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);
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-01-03 17:42:41
* @Last Modified by: Targaryen
* @Last Modified time: 2017-02-20 17:46:16
* @Last Modified time: 2017-02-27 16:34:09
*/
'use strict';
... ... @@ -173,7 +173,7 @@ const Wechat = {
ip: ip
});
if (unifiedOrderResult) {
if (unifiedOrderResult && unifiedOrderResult.appid && unifiedOrderResult.prepay_id) {
let nonceStr = common.nonceStr();
let resParams = {
... ...
... ... @@ -45,7 +45,10 @@ const handleBrandList = origin => {
}
_.forEach(value, function(subValue) {
subValue.brandUrl = '//m.yohobuy.com/product/index/brand?domain=' + subValue.brand_domain + '&app_type=1';
subValue.brandUrl = helpers.urlFormat('/', {
query: subValue.brand_domain,
app_type: 1
}, 'search');
subValue.name = subValue.brand_name_en || subValue.brand_name_cn || subValue.brand_name;
subValue.domain = subValue.brand_domain;
});
... ...
... ... @@ -22,6 +22,7 @@ const shop = {
let brandLogo = {};
let title = '';
let uid = req.user.uid || 0;
let shopEnter;
if (req.query.shop_id) {
return shop.shop(req, res, next);
... ... @@ -73,7 +74,14 @@ const shop = {
if (brandId === 0) {
params.query = domain;
}
if (brandShop.length > 0 || brandLogo) {
if (req.query.app_type && parseInt(req.query.app_type, 10) === 1) {
shopEnter = false;
} else {
shopEnter = true;
}
if (brandShop.length > 0 || brandLogo && shopEnter) {
params = _.assign({
brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
search: {
... ...
... ... @@ -69,11 +69,18 @@ const list = (req, res, next) => {
// 跳转到品牌商品列表页
if (domain !== null && !params.shop_id) {
let url = helpers.urlFormat('', {
let urlPro = {
from: 'search',
query: query
}
if (req.query.app_type) {
urlPro = _.assign(urlPro, {
app_type: req.query.app_type
})
}
}, domain);
let url = helpers.urlFormat('', urlPro, domain);
return res.redirect(url);
}
... ...
... ... @@ -26,10 +26,10 @@ const tool = {
// dest.virtualGoods = (origin.attribute * 1 === 3);
// 活动促销短语
origin.market_phrase && (dest.marketPhrase = origin.market_phrase);
origin.market_phrase && origin.market_phrase !== ' ' && (dest.marketPhrase = origin.market_phrase);
// 商品促销短语
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
origin.sales_phrase && origin.sales_phrase !== ' ' && (dest.goodsSubtitle = origin.sales_phrase);
// 商品标签
if (origin.tags) {
... ...
... ... @@ -8,7 +8,7 @@ require('channel/home.page.css');
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper2'),
Swiper = require('yoho-swiper'),
lazyLoad = require('yoho-jquery-lazyload'),
fastclick = require('yoho-fastclick'),
noticeScroll = require('../plugin/notice-scroll'),
... ...
... ... @@ -12,6 +12,7 @@ const isApp = /yohobuy/i.test(u) ||
const isiOS = /(iPhone|iPad|iPod|iOS)/i.test(u); // ios终端
const isAndroid = /Android/i.test(u); // android终端
const isWechatDevtool = /wechatdevtools/i.test(u); // 微信开发者工具
// const iOSVersion = parseInt((u.match(/OS (\d+)_(\d+)_?(\d+)?/i) || [])[1], 10); // iOS 版本
... ... @@ -47,7 +48,7 @@ const getMktcBySeo = function() {
};
const canOpenApp = () => {
if (isApp || isFromYOHO || nodownload || qs.nodownload || qs.no_openapp || blackCheck) {
if (isWechatDevtool || isApp || isFromYOHO || nodownload || qs.nodownload || qs.no_openapp || blackCheck) {
return false;
}
return isAndroid || isiOS || qs.openapp;
... ...
... ... @@ -388,4 +388,22 @@
.discount-gray {
background-color: #e0e0e0;
}
.hover {
position: fixed;
width: 100%;
background-color: black;
height: 100%;
top: 0;
left: 0;
right: 0;
border: 0;
z-index: 999;
align-items: center;
display: flex;
img {
width: 100%;
}
}
}
... ...
... ... @@ -212,7 +212,7 @@
}
.want {
max-height: 300px;
max-height: 250px;
overflow: hidden;
}
}
... ...
... ... @@ -28,7 +28,7 @@ const formatPromotionTitle = (promo) => {
let match = regPromoTitle.exec(promo.promotion_title);
let promotionTitle = match !== null && match.length > 1 ? match[1] : promo.promotion_title;
promotionTitle = promotionTitle.replace('¥', '¥');
promotionTitle = promotionTitle.replace(/¥/g, '¥');
return `${title}${promotionTitle}】`;
};
const formatPromotionOpt = (promo) => {
... ... @@ -300,7 +300,7 @@ const procCartData = (data, isAdvanceCart) => {
result.giftHasStorage = _.some(result.freebie, freebie => freebie.status === 10);
// 加价购
result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => advanceBuy.status !== 30 && advanceBuy.status !== 0);
result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => advanceBuy.status !== 30 && advanceBuy.status !== 0);// eslint-disable-line
result.selectAdvanceBuy = result.advanceBuy.filter(advanceBuy => advanceBuy.status === 10);
result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => advanceBuy.status === 10);
}
... ... @@ -341,7 +341,7 @@ const procCartData = (data, isAdvanceCart) => {
result.formulaPrice = data.shopping_cart_data.promotion_formula;
result.count = data.shopping_cart_data.selected_goods_count;
result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);
result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);// eslint-disable-line
result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount);
result.hasNoSaleGoods = result.notValidGoods.length || result.offShelveGoods.length;
... ...