Authored by ccbikai(👎🏻🍜)

Merge branch 'gray'

'use strict';
const model = require('../models/individuation');
exports.productLst = function(req, res, next) {
let params = {
uid: req.query.uid,
udid: req.query.udid,
pid: req.query.pid
};
if (req.query.sort) {
params.sort = req.query.sort;
} else if (req.query.brand) {
params.brand = req.query.brand;
}
if (req.query.enum) {
params.specified_sort = req.query.enum;
}
if (req.query.limit) {
params.limit = req.query.limit;
}
model.productLst(params).then((result) => {
res.jsonp(result);
}).catch(next);
};
\ No newline at end of file
... ...
... ... @@ -39,18 +39,29 @@ exports.wechatShare = (req, res, next) => {
// 活动页保存相应cookie的值
exports.feature = (req, res) => {
let mktCode = req.query.mkt_code || false;
// 下载浮层,下载按钮会用到该参数
let mktCode = req.query.mkt_code || req.query.union_type || false;
let expires = req.query.expires;
if (mktCode) {
res.cookie('mkt_code', mktCode, {
domain: '.yohobuy.com',
res.cookie('unionTypeYas', mktCode, { // 下载浮层
path: '/'
});
res.cookie('unionTypeYas', mktCode, {
// 下单使用
let options = {
domain: '.yohobuy.com',
path: '/'
});
}
};
expires && (options.expires = new Date(Date.now() + Number(expires)));
if (req.yoho.isWechat) {
// 微信中,不管是否已经种入cookie,直接覆盖
res.cookie('mkt_code', mktCode, options);
} else if (!req.cookies.mkt_code) {
// 如果没有种入mtk_code则种入
res.cookie('mkt_code', mktCode, options);
}
}
res.json({mktCode: mktCode});
};
... ...
const api = global.yoho.API;
module.exports = {
productLst: function(params) {
return api.get('', Object.assign({
method: 'app.search.newPromotion'
}, params)).then(res => {
var data = [],
lst = (res.data && res.data.product_list) || [];
lst.forEach(function(o) {
data.push({
brand_domain: o.brand_domain,
brand_name: o.brand_name,
product_id: o.product_id,
product_name: o.product_name,
product_skn: o.product_skn,
market_price: o.market_price,
sales_price: o.sales_price,
cn_alphabet: o.cn_alphabet,
default_images: o.default_images,
goods_id: Array.isArray(o.goods_list) && o.goods_list.length ? o.goods_list[0].goods_id : ''
});
});
return data;
});
}
};
\ No newline at end of file
... ...
... ... @@ -28,6 +28,7 @@ const singleDay = require(`${cRoot}/single-day`);
const share = require(`${cRoot}/share`);
const aliCloud = require(`${cRoot}/ali-cloud`);
const studentMarket = require(`${cRoot}/student-market`);
const individuation = require(`${cRoot}/individuation`);
const redbag = require(`${cRoot}/redbag`);
... ... @@ -132,4 +133,7 @@ router.get('/student-market', student.getUser, studentMarket.index);
router.get('/redbag/2017', redbag.index);
// 获取活动页面个性化推荐商品数据
router.get('/individuation', individuation.productLst);
module.exports = router;
... ...
... ... @@ -20,7 +20,7 @@ const list = (req, res, next) => {
cartUrl: helpers.urlFormat('/cart/index/index')
}, req.query);
let title = '';
let query = req.query.query;
let query = decodeURIComponent(req.query.query);
let isQueryFirstClass = false; // 标识用户搜的是不是一级品类
let isQuerySecondClass = false; // 标识用户搜的是不是二级品类
let domain = null;
... ...
... ... @@ -12,7 +12,9 @@
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.yoho.cn/yas-jssdk/2.0.0/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.1.0/yas.js', '_yas'));
var _hmt = _hmt || [];
(function() {
function getUid() {
... ... @@ -37,14 +39,13 @@
}
function queryString() {
var vars = [],
var vars = {},
hash,
i;
var hashes = window.location.search.slice(1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
... ... @@ -55,7 +56,23 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.0.0', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '2.1.0', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
if (!uid) {
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
}());
</script>
... ...
{
"name": "m-yohobuy-node",
"version": "5.3.11",
"version": "5.3.12",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -71,8 +71,9 @@ chHammer.on('tap', function() {
// 跳到搜索页
function goSearch(query) {
// 保存搜索的内容
writeSearch.setHistoryValFun(query);
document.location.href = searchUrl + '?query=' + query;
document.location.href = searchUrl + '?query=' + encodeURIComponent(query);
}
// 搜索输入联动
... ... @@ -175,11 +176,11 @@ $('.search-items .search-group').on('click', 'li', function(event) {
var query = '';
if (event.target.nodeName === 'A') {
query = $(event.target).html();
query = $(event.target).text();
}
if (event.target.nodeName === 'LI') {
query = $(event.target).find('a').html();
query = $(event.target).find('a').text();
}
if ($(this).parents('.search-group').hasClass('history-search')) {
... ... @@ -210,8 +211,8 @@ $('.search-items .search-group').on('click', 'li', function(event) {
});
$('.hot-term').on('click', function(event) {
var Hotquery = '',
POS_ID = 2,
var Hotquery = '';
POS_ID = 2;
FLR_INDEX = 2;
if (event.target.nodeName === 'A') {
... ...