Showing 100 changed files with 968 additions and 606 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -8,7 +8,6 @@
"es2015"
],
"plugins": [
"transform-runtime",
"transform-regenerator",
"transform-runtime"
]
}
... ...
{
"buildDistPath": "./public/dist",
"targetKeyPrefix": ""
}
... ...
... ... @@ -151,6 +151,7 @@ try {
// YOHO 前置中间件
app.use(setYohoData());
app.use(riskManagement());
app.use(seo());
app.use(htaccess());
app.use(subDomain());
app.use(mobileRefer());
... ... @@ -162,7 +163,6 @@ try {
app.use(require('./doraemon/middleware/limiter'));
}
app.use(seo());
app.use(setPageInfo());
app.use(layoutTools());
app.use(pageCache());
... ...
... ... @@ -82,8 +82,8 @@ const wwwXmlData = (page) => {// eslint-disable-line
return Promise.all([keywordsPage(page),
getStaticUrls(_.get(staticUrls, 'www')),
getArticleUrls()]).then(result => {
return _.concat(result[1], result[0], result[2]);
});
return _.concat(result[1], result[0], result[2]);
});
}
};
... ...
... ... @@ -13,7 +13,7 @@ const auth = require(`${global.middleware}/auth`);
const captcha = require('../passport/controllers/captcha');
const ads = require(`${cRoot}/ads`); // 第三方广告平台对接
const robot = require(`${cRoot}/robot-check`); // 机器人检查
const robot = require(`${cRoot}/robot-check`); // 机器人检查
const materialController = require(`${cRoot}/material`);
const activate = require(`${cRoot}/activate`); // 激活点击统计
const questionnaire = require(`${cRoot}/questionnaire`);
... ...
... ... @@ -79,7 +79,7 @@ function getCouponData(channel, params) {
}
});
}
while (false);
while (false); // eslint-disable-line
return result;
})();
}
... ... @@ -119,7 +119,7 @@ function getCouponStatus(params) {
}
});
}
while (false);
while (false); // eslint-disable-line
return result;
})();
}
... ...
... ... @@ -114,7 +114,7 @@ module.exports = class extends global.yoho.BaseModel {
(subValue.src.match(/(\S*)imageView2/)[1] +
'imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/' +
'background/d2hpdGU=/position/center/quality/80'),
136, 57), 136, 57),
136, 57), 136, 57),
url: subValue.url
});
});
... ... @@ -379,7 +379,7 @@ module.exports = class extends global.yoho.BaseModel {
}
if (resource.data && resource.code === 200) {
items[0] = {name: '所有品牌', src: '', url: helpers.urlFormat('/brands',
{channel: channel}), brandType: ''};
{channel: channel}), brandType: ''};
items[1] = {name: '设计新潮', src: '', url: '', brandType: 4};
items[2] = {name: '潮流经典', src: '', url: '', brandType: 1};
items[3] = {name: '明星潮牌', src: '', url: '', brandType: 2};
... ...
... ... @@ -234,8 +234,8 @@ const cartAdd = (req, res) => {
let cartDelList = helper.getCartDelList(req, res, null, isReAdd ? productSku : null);
let result = yield req.ctx(service).addToCart(productSku, buyNumber,
goodsType, isEdit, promotionId,
uid, shoppingKey, cartDelList);
goodsType, isEdit, promotionId,
uid, shoppingKey, cartDelList);
// 设置加入购物车凭证到客户端浏览器
if (!shoppingKey && result && result.data && result.data.shopping_key) {
... ... @@ -320,7 +320,7 @@ const modifyProductNum = (req, res, next) => {
});
}
})
.catch(next);
.catch(next);
}
return req.ctx(service).modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey, cartDelList)
... ...
... ... @@ -70,16 +70,16 @@ module.exports = class extends global.yoho.BaseModel {
} else {
return addressApiModel.addAddressAsync(uid, info.consignee, info.areaCode, info.address, info.mobile,
info.phone, info.zipCode, info.email).then(result => {
if (result.code === 200) {
let d = result.data;
if (result.code === 200) {
let d = result.data;
d.id = d.address_id;
delete d.address_id;
delete d.uid;
}
d.id = d.address_id;
delete d.address_id;
delete d.uid;
}
return result;
});
return result;
});
}
}
... ...
... ... @@ -9,13 +9,13 @@ const md5 = require('md5');
const logger = global.yoho.logger;
const PROMOTION_TYPE_TAG_MAP = {
Cashreduce: '满减', // 满减
Degressdiscount: '折扣', // 分件折扣
Cheapestfree: '满减', // 满X免1
Discount: '折扣', // 打折
Cashreduce: '满减', // 满减
Degressdiscount: '折扣', // 分件折扣
Cheapestfree: '满减', // 满X免1
Discount: '折扣', // 打折
Gift: '赠品',
Needpaygift: '加价购',
SpecifiedAmount: '满减', // X件X元
SpecifiedAmount: '满减', // X件X元
FreeShippingCost: '免运费',
VipFreeShippingCost: '免运费',
Payment: '折扣' // apple pay
... ... @@ -140,7 +140,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
yohoIcon: Number(it.get_yoho_coin) || 0,
productSubtotal: transPrice(it.last_vip_price * it.buy_number),
promotionId: it.promotion_id || 0,
isLimitSkn: it.is_limit_skn === 'Y', // is_limit_skn=Y 不支持7天无理由退货
isLimitSkn: it.is_limit_skn === 'Y', // is_limit_skn=Y 不支持7天无理由退货
isAdvance: isAdvanceCart
};
... ... @@ -163,7 +163,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
goods.isTipNoStore = true;
goods.tipMessage = '库存不足';
goods.isOffShelve = true;
} else if (!inValid) { // 有效
} else if (!inValid) { // 有效
if (goods.productNum > goods.storageNum) {
goods.isTipNoStore = true; // 是否在结算时候显示库存不足
goods.tipMessage = '库存不足';
... ... @@ -177,7 +177,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
// advanceBuy=>是否加价购,soldOut=>失效商品;
if (!it.goods_type) {
goods.inValid = true;
} else if (it.goods_type === 'gift') { // gift=>是否赠品 && it.isAdvanceBuy
} else if (it.goods_type === 'gift') { // gift=>是否赠品 && it.isAdvanceBuy
goods.isGift = true;
goods.productPrice = transPrice(it.last_price);
goods.linePrice = transPrice(it.sales_price); // 划线的价格
... ... @@ -187,7 +187,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
goods.productPrice = transPrice(it.last_price);
goods.linePrice = transPrice(it.sales_price); // 划线的价格
goods.productSubtotal = it.subtotal ? transPrice(it.subtotal) : goods.productPrice;
} else if (it.real_price === 0) { // 免单
} else if (it.real_price === 0) { // 免单
goods.productPrice = transPrice(it.sales_price);
goods.xForOne = true;
... ... @@ -245,13 +245,13 @@ const formatShoppingCartData = (sc) => {
return {};
}
return {
discountAmount: sc.discount_amount, // 活动价
discountAmount: sc.discount_amount, // 活动价
fastShoppingCost: sc.fast_shopping_cost,
gainYohoCoin: sc.gain_yoho_coin, // 获赠有货币个数
gainYohoCoin: sc.gain_yoho_coin, // 获赠有货币个数
goodsCount: sc.goods_count,
isMultiPackage: sc.is_multi_package,
lastOrderAmount: (parseFloat(sc.last_order_amount)).toFixed(2), // 商品金额总计
orderAmount: sc.order_amount, // 商品总价
lastOrderAmount: (parseFloat(sc.last_order_amount)).toFixed(2), // 商品金额总计
orderAmount: sc.order_amount, // 商品总价
// package_list,[],
promotionFormula: sc.promotion_formula,
promotionFormulaList: _.map(sc.promotion_formula_list, it => {
... ... @@ -391,23 +391,23 @@ const formatPromotion = (it, selectedGiftsList) => {
let tsPromotionIds = (it.ts_promotion_ids && it.ts_promotion_ids.join(',')) || it.promotion_id || '';
let info = {
status: status,
conditionUnit: it.condition_unit, // 0满足,1 件,2金额
conditionUnit: it.condition_unit, // 0满足,1 件,2金额
conditionValue: it.condition_value,
giftPrice: it.gift_price, // 赠品或加价购商品价格
giftGoodsList: formatCartGoods(it.gift_goods_List), // 可供选择的赠品或加价购商品列表
giftPrice: it.gift_price, // 赠品或加价购商品价格
giftGoodsList: formatCartGoods(it.gift_goods_List), // 可供选择的赠品或加价购商品列表
promotionId: tsPromotionIds, // 促销id
promotionDesc: identIconReplace(it.promotion_desc),
promotionType: it.promotion_type, // 促销类型
promotionType: it.promotion_type, // 促销类型
// list.yohobuy.com?psp_id=10408
promotionPageUrl: helpers.urlFormat('/list', {psp_id: tsPromotionIds}),
tag: PROMOTION_TYPE_TAG_MAP[it.promotion_type],
isGift: it.promotion_type === 'Gift',
isPriceGift: it.promotion_type === 'Needpaygift',
isNotReach: status === 0, // 未满足
isReach: status === 10 || status === 30 || status === 20, // 满足条件
isEmpty: status === 20, // 已售完
isSelected: status === 30 // 已选择,可更换
isNotReach: status === 0, // 未满足
isReach: status === 10 || status === 30 || status === 20, // 满足条件
isEmpty: status === 20, // 已售完
isSelected: status === 30 // 已选择,可更换
};
// 判断赠品/加价购商品,是否被选中
... ... @@ -542,12 +542,12 @@ const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => {
let analysisData = {
ids: [],
criteo: []
}; // 存放分析用的数据
}; // 存放分析用的数据
let result = {
isEmpty: false,
isLogin: !!uid,
searchUrl: helpers.urlFormat('', null, 'search'), // 搜索链接(再逛逛)
searchUrl: helpers.urlFormat('', null, 'search'), // 搜索链接(再逛逛)
listUrl: helpers.urlFormat('/list'),
viewOrderUrl: helpers.urlFormat('/home/orders', {
t: new Date().getTime()
... ...
... ... @@ -766,7 +766,7 @@ module.exports = class extends global.yoho.BaseModel {
alt: it.product_name,
price: '¥' + chelper.transPrice(it.sales_price),
marketPrice: (it.market_price && +it.market_price > +it.sales_price) ?
'¥' + chelper.transPrice(it.market_price) : ''
'¥' + chelper.transPrice(it.market_price) : ''
};
item.href = helpers.getUrlBySkc(it.product_skn);
... ... @@ -839,7 +839,7 @@ module.exports = class extends global.yoho.BaseModel {
price: '¥' + chelper.transPrice(it.sales_price),
href: helpers.getUrlBySkc(it.product_skn),
marketPrice: (it.market_price && +it.market_price > +it.sales_price) ?
'¥' + chelper.transPrice(it.market_price) : ''
'¥' + chelper.transPrice(it.market_price) : ''
};
}));
... ... @@ -927,7 +927,7 @@ module.exports = class extends global.yoho.BaseModel {
let promotionGifts = yield cartApiModel.queryPromotionGift(promotionId);
let cartDataRet = yield cartApiModel.cartData(uid, shoppingKey);
let selectedGift = chelper.formatCartGoods(_.get(cartDataRet, 'data.ordinary_cart_data.goods_list'));
let currentProduct = null; // 默认展示第一个商品
let currentProduct = null; // 默认展示第一个商品
if (promotionGifts && promotionGifts.code === 200) {
let promotionList = chelper.formatPriceGifts(_.get(promotionGifts, 'data.arrays', []));
... ... @@ -1012,8 +1012,8 @@ module.exports = class extends global.yoho.BaseModel {
let comSoldOuts = _.get(comCart, 'sold_out_goods_list');
let goodsList = _(advGoodsList).concat(comGoodsList, subsGoodsList,
advOffShe, comOffShe,
advSoldOuts, comSoldOuts);
advOffShe, comOffShe,
advSoldOuts, comSoldOuts);
goodsList = _.filter(goodsList.value(), it => !!it);
... ...
... ... @@ -138,16 +138,16 @@ module.exports = class extends global.yoho.BaseModel {
return new EnsureApi(this.ctx).orderSubmitAsync(uid, cartType, p.addressId, p.deliveryTime,
p.deliveryWay, p.paymentType, p.paymentId, p.printPrice, p, remoteIp).then(result => {
if (result.code === 200) {
let d = result.data;
d.url = helper.urlFormat('/shopping/newpay', {
ordercode: d.order_code
});
}
if (result.code === 200) {
let d = result.data;
return result;
d.url = helper.urlFormat('/shopping/newpay', {
ordercode: d.order_code
});
}
return result;
}
);
}
};
... ...
... ... @@ -48,7 +48,7 @@ module.exports = class extends global.yoho.BaseModel {
Object.assign(result, new OrderEnsureHandle(this.ctx).handleUseYohoCoin(
_.get(ticketInfo, 'data.shopping_cart_data', {}
)));
)));
return result;
});
... ...
... ... @@ -18,7 +18,7 @@ const ensure = require(`${cRoot}/order-ensure`);
const ticket = require(`${cRoot}/ticket`);
router.get('/index/getProductInfo', cart.getProductInfo);
router.post('/cart/detailAdd', auth, cart.cartAddIndex); // 加入购物车 商品详情页
router.post('/cart/detailAdd', auth, cart.cartAddIndex); // 加入购物车 商品详情页
router.get('/coupon/list', cart.getCoupons); // 优惠券列表
... ...
... ... @@ -299,8 +299,6 @@
{{#each promotion_formula_list}}
<li class="promotion-item">
{{#if @first}}
<a class="gain-coin-tip" href="/help/detail?id=105&contId=233" target="_blank"></a>
<span class="back-coin">共返有货币:{{../gain_yoho_coin}}</span>
<span class="total-num"><i>{{../selected_goods_count}}</i>件商品</span>
{{/if}}
<span class="promotion-name">{{promotion}}</span>
... ...
... ... @@ -54,7 +54,7 @@ module.exports = class extends global.yoho.BaseModel {
};
}
// 获取可用的标题
// 获取可用的标题
_getText(data) {
let text = data.split(' ')[0];
const regResult = /\w+/.exec(text);
... ... @@ -1055,10 +1055,10 @@ module.exports = class extends global.yoho.BaseModel {
*/
formatIndexGuideData(data) {
let channels = {
boys: {gender: '1,3', limit: 1},
girls: {gender: '2,3', limit: 1},
lifestyle: {msort: 10, misort: '266,280,101,103,259', limit: 1},
kids: {msort: 365, limit: 1}
boys: {yh_channel: 1, limit: 1},
girls: {yh_channel: 2, limit: 1},
lifestyle: {yh_channel: 4, limit: 1},
kids: {yh_channel: 3, limit: 1}
};
let formatData = [];
let promiseArr = [];
... ...
... ... @@ -22,7 +22,7 @@ const getSearchCacheKey = params => {
const saveCache = (key, kv, cacheTime) => {
cache.set(key, kv, cacheTime)
.catch(err => logger.debug(`product query save cache data fail:${err.toString()}`));
.catch(err => logger.debug(`product query save cache data fail:${err.toString()}`));
};
module.exports = class extends global.yoho.BaseModel {
... ...
... ... @@ -3,39 +3,39 @@
* @author: lcy<chuanyang.liu@yoho.cn>
* @date: 2016/08/31
*/
'use strict';
'use strict';
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var app = express();
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.disable('x-powered-by');
app.disable('x-powered-by');
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(require('./helpers/pager'), require('./helpers/pager-seo'), global.yoho.helpers),
cb: hbsEvent.cb
}));
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(require('./helpers/pager'), require('./helpers/pager-seo'), global.yoho.helpers),
cb: hbsEvent.cb
}));
// require('./helpers/json');
// require('./helpers/page');
// require('./helpers/json');
// require('./helpers/page');
// router
app.use(require('./router'));
app.use(require('./router'));
module.exports = app;
module.exports = app;
... ...
... ... @@ -21,19 +21,19 @@ const getGenderByCookie = (req) => {
switch (channel) {
case 'boys':
{
gender = '1,3';
break;
}
{
gender = '1,3';
break;
}
case 'girls':
{
gender = '2,3';
break;
}
{
gender = '2,3';
break;
}
default:
{
gender = '1,2,3';
}
{
gender = '1,2,3';
}
}
return gender;
... ... @@ -66,7 +66,7 @@ const getUdid = (req, res) => {
*/
const getArticleUrl = (url, id) => {
/* 格式由url:{url:'aaa'} 更改为 url: 'aaa'
/* 格式由url:{url:'aaa'} 更改为 url: 'aaa'
try {
let urlObj = JSON.parse(url);
... ...
... ... @@ -666,7 +666,7 @@ module.exports = class extends global.yoho.BaseModel {
desc: d.article_summary,
authorId: d.author_id,
weixinUrl: d.url,
tag: d.tag, // tags 的字符串
tag: d.tag, // tags 的字符串
tags: tags
};
}
... ... @@ -856,7 +856,7 @@ module.exports = class extends global.yoho.BaseModel {
}
return redisData;
}).then(res => { // 内容内推荐的商品
}).then(res => { // 内容内推荐的商品
let gpromises = [], ggpromises = [];
... ...
... ... @@ -13,7 +13,7 @@ const guangController = require(`${cRoot}/index`);
const sitemap = require('../3party/controllers/sitemap');
router.get(['/', '/index/index'], guangController.index);
router.get(['/detail/:id', '/info/index'], guangController.detail); // guang/info/index
router.get(['/detail/:id', '/info/index'], guangController.detail); // guang/info/index
router.get(/^\/([\d]+)(.*)/, guangController.detail);
router.get('/tags/index', guangController.tags);
router.get('/tags/:query-p:page', guangController.tags); // tags 伪静态路由
... ...
... ... @@ -70,7 +70,7 @@ exports.detail = (req, res, next) => {
return next();
}
if (!(typeof (newData.nav) === 'undefined')) {
if (!(typeof(newData.nav) === 'undefined')) {
nav = nav.concat(newData.nav);
}
... ...
... ... @@ -3,36 +3,36 @@
* @author: lcy<chuanyang.liu@yoho.cn>
* @date: 2016/08/31
*/
'use strict';
'use strict';
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var app = express();
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.disable('x-powered-by');
app.disable('x-powered-by');
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(require('./helper'), global.yoho.helpers),
cb: hbsEvent.cb
}));
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(require('./helper'), global.yoho.helpers),
cb: hbsEvent.cb
}));
// router
app.use(require('./router'));
app.use(require('./router'));
module.exports = app;
module.exports = app;
... ...
... ... @@ -28,7 +28,7 @@ module.exports = class extends global.yoho.BaseModel {
});
}
// 获取首页帮助分类以及常见问题
// 获取首页帮助分类以及常见问题
gethomeCategoryFaq() {
let data = {
... ...
... ... @@ -66,7 +66,7 @@ exports.userPwd = (req, res, next) => {
};
/**
/**
* 个人中心-邮箱验证身份-page1/2/3
*/
exports.userEmail = (req, res, next) => {
... ... @@ -97,7 +97,7 @@ exports.userEmail = (req, res, next) => {
};
/**
/**
* 个人中心-手机验证身份-page1/2/3
*/
exports.userMobile = (req, res, next) => {
... ... @@ -233,7 +233,7 @@ exports.modifyEmail = (req, res, next) => {
}).catch(next);
};
/**
/**
* 个人中心-邮箱验证身份-邮件发送成功过渡页
*/
exports.sendEmailSuccess = (req, res, next) => {
... ...
... ... @@ -27,7 +27,7 @@ exports.index = (req, res, next) => {
}).catch(next);
};
/**
/**
* 编辑修改地址
*/
exports.editAddress = (req, res, next) => {
... ... @@ -43,7 +43,7 @@ exports.editAddress = (req, res, next) => {
}).catch(next);
};
/**
/**
* 添加保存地址
*/
exports.saveAddress = (req, res, next) => {
... ... @@ -55,7 +55,7 @@ exports.saveAddress = (req, res, next) => {
}).catch(next);
};
/**
/**
* 删除地址
*/
exports.delAddress = (req, res, next) => {
... ... @@ -74,7 +74,7 @@ exports.delAddress = (req, res, next) => {
}).catch(next);
};
/**
/**
* 设置默认地址
*/
exports.defaultAddress = (req, res, next) => {
... ...
... ... @@ -68,7 +68,7 @@ exports.saveComment = (req, res, next) => {
goodsId: req.body.goodsId,
orderId: req.body.orderId,
erpSkuId: req.body.erpSkuId,
anonymous: false, // 是否匿名评价
anonymous: false, // 是否匿名评价
satisfied: Number(req.body.satisfied),
url: req.body.url,
size: req.body.size,
... ...
... ... @@ -54,12 +54,12 @@ const del = (req, res, next) => {
const modifyAddress = (req, res, next) => {
let uid = req.user.uid;
let orderId = req.body.orderCode || ''; // 订单号
let userName = req.body.userName || ''; // 收货人
let areaCode = req.body.areaCode || ''; // 区号
let address = req.body.address || ''; // 地址
let mobile = req.body.mobile || ''; // 手机号码
let phoneNum = req.body.phoneNum || ''; // 固定电话
let orderId = req.body.orderCode || ''; // 订单号
let userName = req.body.userName || ''; // 收货人
let areaCode = req.body.areaCode || ''; // 区号
let address = req.body.address || ''; // 地址
let mobile = req.body.mobile || ''; // 手机号码
let phoneNum = req.body.phoneNum || ''; // 固定电话
let phoneCode = req.body.phoneCode || ''; // 电话编号
let phone = (function() {
if (phoneNum) {
... ...
... ... @@ -6,6 +6,14 @@
const helpers = global.yoho.helpers;
const returnsModel = require('../models/returns');
// 退货时传退货收件地址
const GOODS_BACK_ADDRESS = {
address: '江苏南京市江宁经济开发区苏源大道87号YOHO!有货物流中心东一楼',
name: 'YOHO!有货仓库',
phone: '400-889-9646',
postcode: '211106'
};
/**
* 我的退换货-列表页
*/
... ... @@ -57,12 +65,7 @@ const refundSuccess = (req, res) => {
type: '退货',
ordersHref: helpers.urlFormat('/home/orders'),
returnsHref: helpers.urlFormat('/home/returns'),
refund: {// 退货时传退货收件地址
address: '南京市江宁区江宁经济技术开发区苏源大道87号YOHO!有货物流中心东一楼',
name: 'YOHO!有货',
phone: '400-889-9646',
postcode: '211106'
}
refund: GOODS_BACK_ADDRESS
}
};
... ... @@ -92,7 +95,8 @@ const refundDetail = (req, res, next) => {
const uid = req.user.uid;
let resData = {
module: 'home',
page: 'returns'
page: 'returns',
backAddress: GOODS_BACK_ADDRESS
};
req.ctx(returnsModel).getRefundDetail(code, uid).then(result => {
... ...
... ... @@ -46,16 +46,18 @@ module.exports = class extends global.yoho.BaseModel {
let tabs = {90: '最近3个月明细', 180: '最近半年明细', 360: '最近一年明细'};
for (let name in tabs) {
if (condition.queryType) {
paramUrl.type = condition.queryType;
}
paramUrl.beginTime = that.convertUnitTime(new Date() / 1000 - parseInt(name, 10) * 3600 * 24);
if (tabs.hasOwnProperty(name)) {
if (condition.queryType) {
paramUrl.type = condition.queryType;
}
paramUrl.beginTime = that.convertUnitTime(new Date() / 1000 - parseInt(name, 10) * 3600 * 24);
result.push({
url: helpers.urlFormat('/home/currency', paramUrl),
name: tabs[name],
selected: condition.beginTime && paramUrl.beginTime === condition.beginTime ? true : false
});
result.push({
url: helpers.urlFormat('/home/currency', paramUrl),
name: tabs[name],
selected: condition.beginTime && paramUrl.beginTime === condition.beginTime ? true : false
});
}
}
return result;
}
... ...
... ... @@ -70,6 +70,7 @@ module.exports = class extends global.yoho.BaseModel {
'/home/account/modifymobile'
]},
{name: '地址管理', href: '/home/address'},
// {name: '兑换礼品卡', href: '/home/gift'} // @韩施超-产品让注释的
]
}
... ...
... ... @@ -208,7 +208,7 @@ module.exports = class extends global.yoho.BaseModel {
return;
}
let href = `/home/message/detail?id=${value.id}&page=${page}`;
let href = 'javascript:;'; // eslint-disable-line
href += type ? `&type=${type}` : '';
switch (value.type) {
... ...
... ... @@ -15,12 +15,12 @@ module.exports = class extends global.yoho.BaseModel {
super(ctx);
this.ORDER_TYPE = {
all: 1, // 全部
waitingForPay: 2, // 待付款
waitingForSend: 3, // 待发货
waitingForReceive: 4, // 待收货
completed: 5, // 已完成
canceled: 7 // 已取取消
all: 1, // 全部
waitingForPay: 2, // 待付款
waitingForSend: 3, // 待发货
waitingForReceive: 4, // 待收货
completed: 5, // 已完成
canceled: 7 // 已取取消
};
this.ORDER_EMPTY_DESC = {
... ... @@ -387,7 +387,7 @@ module.exports = class extends global.yoho.BaseModel {
Object.assign(newOrder, {
invoiceOperation: {unsupportSupply: true},
unsupportSupplyTip: +order.refund_status === 1 ?
'订单商品已申请退货,暂无发票信息' : '换货订单暂不支持补开发票'
'订单商品已申请退货,暂无发票信息' : '换货订单暂不支持补开发票'
});
}
... ... @@ -650,8 +650,8 @@ module.exports = class extends global.yoho.BaseModel {
}
_getOrderDetailOp(orderId, payment, status,
isCancel, paymentStatus, paymentType,
orderType, attribute, refundStatus, links) {
isCancel, paymentStatus, paymentType,
orderType, attribute, refundStatus, links) {
let operation = {};
if (attribute === 9 || attribute === 11) {
... ...
... ... @@ -372,7 +372,8 @@ module.exports = class extends global.yoho.BaseModel {
id: _.get(data, 'notice.express_id', ''),
company: _.get(data, 'notice.express_company', ''),
number: _.get(data, 'notice.express_number', ''),
title: _.get(data, 'notice.title', '')
title: _.get(data, 'notice.title', ''),
titleClass: 'red'
};
}
... ...
... ... @@ -13,11 +13,6 @@
<b id="{{id}}">({{count}})</b>
{{/ messages}}
{{#unless @root.pc.user.removeStudentIdentification}}
{{#if certifiedName}}
<a href="{{certifiedUrl}}" target="_blank">{{certifiedName}}</a>
{{/if}}
{{/unless}}
<span id="close-message" class="close iconfont">&#xe60d;</span>
</p>
{{/if}}
... ...
... ... @@ -31,10 +31,30 @@
<div class="detail-container">
{{# express}}
{{#if title}}
<h2>{{title}}</h2>
<h2 class="{{titleClass}}">{{title}}</h2>
{{else}}
<h2>请填写寄回快递单号,以便我们查询</h2>
{{/if}}
{{# @root.backAddress}}
<div class="back-info clearfix">
<div class="left-address left">
<p><span class="lt">寄回地址</span>{{address}}</p>
<p><span class="lt">收件人</span>{{name}}</p>
<p><span class="lt">联系电话</span>{{phone}}</p>
<p><span class="lt">邮编</span>{{postcode}}</p>
</div>
<div class="right-mind left">
<p class="mind-title">注意事项</p>
<ul>
<li>确保商品及其附件(如吊牌、包装盒等)完好,未使用</li>
<li>邮政平邮或者到付件仓库无法签收,请勿寄送哦</li>
<li class="red">发货单随同商品一并寄回;如发货单遗失,请以便签附上订单 编号、收货人姓名及手机号</li>
</ul>
</div>
</div>
{{/ @root.backAddress}}
<div class="courier-code{{#unless id}} in-edit{{/unless}}">
<ul style="display: none;">
{{# expressList}}
... ... @@ -70,7 +90,7 @@
{{#unless isChange}}
<th class="yoho-coin">
返有货币
<a target="_blank" href="//www.yohobuy.com/help/detail?id=105"></a>
<a target="_blank" href="//www.yohobuy.com/help/detail?id=198&contId=233"></a>
</th>
{{/unless}}
<th class="num">数量</th>
... ... @@ -117,7 +137,7 @@
{{/goods}}
<tr>
<td colspan="5">
<p class="re-tips">{{#if return_amount}}退款总金额:¥{{return_amount}} {{#if return_asset_desc}}({{return_asset_desc}}){{/if}}<span class="iconfont icon-tip-help">&#xe6d6;</span>{{/if}}</p>
<p class="re-tips">{{#if return_amount}}退款总金额:¥{{return_amount}} <span class="iconfont icon-tip-help">&#xe6d6;</span>{{/if}} {{#if return_asset_desc}}<span class="gray">{{return_asset_desc}}</span>{{/if}}</p>
</td>
</tr>
</table>
... ...
... ... @@ -3,15 +3,6 @@
<h2 class="sub-title">
<div class="more"><a class="btn-edit" title="修改"></a></div>
{{subTitle}}
{{#unless @root.pc.user.removeStudentIdentification}}
{{#if certified}}
<span class="sub-tips">学生身份已验证通过啦,赶紧去体验下<a class="tips-url" href="{{tipsUrl}}" target="_blank">我们的专属特权</a>吧!</span>
{{else}}
<span class="sub-tips"> 校园潮流季-我们的专属特权,进行学生身份验证即有惊喜哦,</span>
<a class="tips-url" href="{{tipsUrl}}" target="_blank">立即进行身份验证</a>
{{/if}}
{{/unless}}
</h2>
<form action="" {{# firstBox}}class="first" {{/firstBox}}>
<div class="box">
... ...
... ... @@ -3,36 +3,36 @@
* @author: xiaoxiao<xiaoxiao.hao@yoho.cn>
* @date: 2017/10/13
*/
'use strict';
'use strict';
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var express = require('express'),
path = require('path'),
hbsEvent = require('../../config/hbsevent');
var app = express();
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.disable('x-powered-by');
app.disable('x-powered-by');
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(global.yoho.helpers),
cb: hbsEvent.cb
}));
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(global.yoho.helpers),
cb: hbsEvent.cb
}));
// router
app.use(require('./router'));
app.use(require('./router'));
module.exports = app;
module.exports = app;
... ...
... ... @@ -488,38 +488,38 @@ const modPwdByCodeAPI = (req, res, next) => {
};
module.exports = {
index, // 首页
getUserInfoAPI, // 通过邮箱或手机号获得用户信息
sendCodePage, // 发送验证码到邮箱或者手机,然后跳转页面
saveInSession, // 保存状态到session中
index, // 首页
getUserInfoAPI, // 通过邮箱或手机号获得用户信息
sendCodePage, // 发送验证码到邮箱或者手机,然后跳转页面
saveInSession, // 保存状态到session中
sendEmailPage, // 发送邮件成功的页面
sendEmailPage, // 发送邮件成功的页面
verifyCodeByMobilePage, // 验证手机验证码的页面
verifyCodeByMobileAPI, // 验证手机验证码
sendBackMobileAPI, // 重新发送验证码到手机
verifyCodeByMobilePage, // 验证手机验证码的页面
verifyCodeByMobileAPI, // 验证手机验证码
sendBackMobileAPI, // 重新发送验证码到手机
resetPasswordPage, // 重设密码页面
updatePwdAPI, // 重设密码接口
validateMobileAPI, // 验证手机号是否合法
resetPwdSuccessPage, // 重设密码成功页面
resetPasswordPage, // 重设密码页面
updatePwdAPI, // 重设密码接口
validateMobileAPI, // 验证手机号是否合法
resetPwdSuccessPage, // 重设密码成功页面
validateInputAPI, // 验证用户输入的邮箱或者手机是否合法,返回是json
validateInputPage, // 验证用户输入的邮箱或者手机是否合法,跳转是页面
validateInputAPI, // 验证用户输入的邮箱或者手机是否合法,返回是json
validateInputPage, // 验证用户输入的邮箱或者手机是否合法,跳转是页面
validateEmailInSession, // 验证邮箱是否在session中
validateMobileInSession, // 验证手机是否在session中
validateEmailInSession, // 验证邮箱是否在session中
validateMobileInSession, // 验证手机是否在session中
validateCodeByEmailPage, // 验证邮箱验证码
validateCodeByMobilePage, // 验证手机验证码
validateCodeByEmailPage, // 验证邮箱验证码
validateCodeByMobilePage, // 验证手机验证码
validateSuccessStatusPage, // 验证重设密码状态
validateExistCodePage, // 验证参数是否存在code
validateSuccessStatusPage, // 验证重设密码状态
validateExistCodePage, // 验证参数是否存在code
validatePwdPage, // 验证密码是否合法
validatePwdPage, // 验证密码是否合法
weakPasswordPage, // 弱密码页面
weakPwdSuccessPage, // 弱密码重置成功页面
modPwdByCodeAPI // 弱密码重置接口
weakPasswordPage, // 弱密码页面
weakPwdSuccessPage, // 弱密码重置成功页面
modPwdByCodeAPI // 弱密码重置接口
};
... ...
... ... @@ -531,7 +531,7 @@ const douban = {
let callbackType = Fn.compose(Fn.nth(1), Fn.split('::'))(req.query.state);
if (callbackType === 'bind') { // 个人中心,第三方账号绑定
if (callbackType === 'bind') { // 个人中心,第三方账号绑定
if (err) {
log.error(`douban authenticate error : ${JSON.stringify(err)}`);
... ...
... ... @@ -84,7 +84,7 @@ let index = (req, res, next) => {
location: area || '+86',
defaultMobile: mobile,
captchaUrl: helpers.urlFormat('/passport/imagesNode', {t: Date.now()}),
itemUrl: helpers.urlFormat('/help/detail', {id: 103, contId: 197}),
itemUrl: helpers.urlFormat('/help/detail', {id: 150, contId: 197}),
referUrl: refer,
loginUrl: helpers.urlFormat('/signin.html', {refer: refer}),
coverHref: result.url,
... ...
... ... @@ -30,8 +30,8 @@ router.post('/passport/login/sms/send', captcha.requiredAPI, login.local.sms.sen
router.post('/passport/login/sms/auth', login.local.sms.auth); // 验证短信验证码
// 二维码登录
router.post('/passport/login/qrcode/refresh', login.local.qrcode.refresh); // 刷新二维码
router.post('/passport/login/qrcode/check', login.local.qrcode.check); // 验证二维码的状态
router.post('/passport/login/qrcode/refresh', login.local.qrcode.refresh); // 刷新二维码
router.post('/passport/login/qrcode/check', login.local.qrcode.check); // 验证二维码的状态
router.get('/passport/login', login.common.beforeLogin, captcha.required, login.local.loginPage);
router.post('/passport/login/auth', captcha.passwordRequired, login.local.login);
... ... @@ -68,7 +68,7 @@ router.post('/passport/autouserinfo/sendBindMsg', captcha.requiredAPI, bind.send
router.post('/passport/autouserinfo/bindMobile', bind.bindMobile);
// 未实名认证的老邮箱用户登录绑定手机号
router.get('/passport/cert/index', captcha.required, cert.index); /** 输入手机号码页面 **/
router.get('/passport/cert/index', captcha.required, cert.index); /** 输入手机号码页面 **/
router.get('/passport/cert/success', cert.success); /** 成功提示页面 **/
router.post('/passport/cert/check', cert.check);
router.post('/passport/cert/sendCertMsg', captcha.requiredAPI, cert.sendCertMsg);
... ... @@ -99,7 +99,7 @@ router.get('/passport/reg/success', reg.success);
/**
* 找回密码首页信息
*/
// 找回密码首页
// 找回密码首页
router.get('/passport/back/index', captcha.required, back.index);
// 验证输入是否正确
... ... @@ -125,7 +125,7 @@ router.post('/passport/back/mobile',
/**
* 邮件找回密码
*/
// 发送邮件成功页面
// 发送邮件成功页面
router.get('/passport/back/sendEmail',
back.validateEmailInSession,
back.sendEmailPage);
... ... @@ -133,7 +133,7 @@ router.get('/passport/back/sendEmail',
/**
* 短信找回密码
*/
// 验证手机短信页面
// 验证手机短信页面
router.get('/passport/back/verification',
captcha.required,
back.validateMobileInSession,
... ...
... ... @@ -82,14 +82,14 @@ const detailHeader = (req, res, next) => {
}
return req.ctx(service).getDetailHeader(
{skn: skn}, uid, req.user.isStudent, vipLevel, dataMd5, saveCurrentGoodsInCookies
).then((result) => {
if (result.code === 200) {
return res.render('product/detail-header', Object.assign({layout: false}, result.data));
} else {
res.status(204).end();
}
}).catch(next);
{skn: skn}, uid, req.user.isStudent, vipLevel, dataMd5, saveCurrentGoodsInCookies
).then((result) => {
if (result.code === 200) {
return res.render('product/detail-header', Object.assign({layout: false}, result.data));
} else {
res.status(204).end();
}
}).catch(next);
};
/**
... ...
... ... @@ -33,8 +33,8 @@ exports.list = (req, res, next) => {
exports.detail = (req, res, next) => {
req.ctx(globalModel).getGlobalProductDetailData(req.params[0], req.yoho.channelNum,
req.yoho.channel).then(result => {
res.render('global/detail', Object.assign({
page: 'detail'
}, result));
}).catch(next);
res.render('global/detail', Object.assign({
page: 'detail'
}, result));
}).catch(next);
};
... ...
... ... @@ -43,30 +43,30 @@ exports.index = (req, res, next) => {
req.ctx(list).getListData(Object.assign(req.query, {uid: req.user.uid, prid: req.user.prid}),
req.yoho.channel).then(result => {
Object.assign(resData, result, {
pageClass: 'static-list-page'
});
Object.assign(resData, result, {
pageClass: 'static-list-page'
});
if (qs) {
Object.assign(resData, listSeoMap[qs] || {});
}
if (qs) {
Object.assign(resData, listSeoMap[qs] || {});
}
// 查询结果为空则不cache
if (_.isEmpty(_.get(resData, 'list.goods', []))) {
res.set('Cache-Control', 'no-cache');
}
// 查询结果为空则不cache
if (_.isEmpty(_.get(resData, 'list.goods', []))) {
res.set('Cache-Control', 'no-cache');
}
// 商品详情页跳转过来带参数
if (req.query.phrase) {
try {
resData.list.phrase = decodeURIComponent(req.query.phrase);
} catch (e) {
resData.list.phrase = '';
}
// 商品详情页跳转过来带参数
if (req.query.phrase) {
try {
resData.list.phrase = decodeURIComponent(req.query.phrase);
} catch (e) {
resData.list.phrase = '';
}
}
res.render('list/index', resData);
}).catch(next);
res.render('list/index', resData);
}).catch(next);
};
/**
... ...
... ... @@ -26,16 +26,20 @@ const index = (req, res, next) => {
let params = req.query;
let resData = {};
req.ctx(search).getKeyActivity(params.query).then(activityUrl => {
let queryKey = params.query;
queryKey && (queryKey = queryKey.replace(/(<|>)/g, ''));
req.ctx(search).getKeyActivity(queryKey).then(activityUrl => {
if (activityUrl) {
activityUrl = encodeURI(activityUrl);
res.redirect(activityUrl);
return;
}
return req.ctx(search).getSearchDataPre(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}),
return req.ctx(search).getSearchDataPre(Object.assign(params,
{uid: req.user.uid, prid: req.user.prid, query: queryKey}),
req.yoho.channel).then(result => {
let queryKey = req.query.query;
Object.assign(resData, result);
... ... @@ -211,7 +215,7 @@ const keyword = (req, res, next) => {
title: `${query}价格_图片_品牌_怎么样-YOHO!BUY有货`,
keywords: `${query},${query}价格,${query}图片,${query}怎么样,${query}品牌,YOHO!BUY有货`,
description: `YOHO!BUY有货网yohobuy.com是国内专业的${query}网上潮流购物商城,为您找到${_.get(result,
'search.totalCount', 0)}${query}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${query},就上YOHO!BUY有货`
'search.totalCount', 0)}${query}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${query},就上YOHO!BUY有货`
});
if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) {
... ... @@ -250,7 +254,7 @@ const keyId = (req, res, next) => {
'search.totalCount', 0)}${query}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${query},就上YOHO!BUY有货`,
pageFooterSeo: {
description: `YOHO!BUY有货网yohobuy.com是国内专业的<b>${query}</b>网上潮流购物商城,为您找到<b>${_.get(result,
'search.totalCount', 0)}</b>条<b>${query}</b>、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买<b>` +
'search.totalCount', 0)}</b>条<b>${query}</b>、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买<b>` +
`${query}</b>,就上YOHO!BUY有货!`,
queryKey: query,
wapUrl: helpers.urlFormat(`/chanpin/${id}.html`, null, 'm')
... ... @@ -266,7 +270,7 @@ module.exports = {
suggest,
suggest4Old,
searchFilterBrands,
searchHistory, // 搜索历史记录
searchHistory, // 搜索历史记录
searchLessRecommend,
keyword,
keyId
... ...
/*
* @Author: yyq
* @Date: 2018-05-07
*/
'use strict';
const seoModel = require('../models/seo-service'); // seo 页 model
const hot = (req, res, next) => {
return req.ctx(seoModel).getHotKeywordDate(req.params.id, req.query, req.yoho.channel).then(result => {
res.render('seo/hot', result);
}).catch(next);
};
module.exports = {
hot
};
... ...
... ... @@ -28,19 +28,19 @@ const getGenderByCookie = (req) => {
switch (channel) {
case 'boys':
{
gender = '1,3';
break;
}
{
gender = '1,3';
break;
}
case 'girls':
{
gender = '2,3';
break;
}
{
gender = '2,3';
break;
}
default:
{
gender = '1,2,3';
}
{
gender = '1,2,3';
}
}
return gender;
... ...
... ... @@ -26,7 +26,7 @@ function _cacheGet(key) {
});
}
const ONE_HOUR = 60 * 60; // 一小时
const ONE_HOUR = 60 * 60; // 一小时
const ONE_DAY = ONE_HOUR * 24; // 一天
const HALF_MONTH = ONE_DAY * 15; // 半个月
... ...
... ... @@ -702,9 +702,9 @@ function _getProductModelCard(sortId, sizeInfo) {
}
const TYPE_SORT = {
1: ['height', 'weight', 'shoulderWidth', 'bust', 'waist', 'dressSize'], // 上衣
1: ['height', 'weight', 'shoulderWidth', 'bust', 'waist', 'dressSize'], // 上衣
3: ['height', 'weight', 'waist', 'hip', 'downDressSize'], // 裤子
4: ['height', 'weight', 'waist', 'hip', 'downDressSize'] // 裙子
4: ['height', 'weight', 'waist', 'hip', 'downDressSize'] // 裙子
};
const local_ = {
... ... @@ -1459,7 +1459,7 @@ function getDetailHeader(id, uid, isStudent, vipLevel, dataMd5, cookie) {
.then(currentUserProductInfo)
.then((result) => {
return {
code: 200, // 改变数据
code: 200, // 改变数据
data: result
};
});
... ... @@ -1506,10 +1506,10 @@ function showMainAsync(req, data) {
);
let requestData = yield Promise.all([
HeaderModel.requestHeaderData(data.channel), // 通用头部数据
_getProductIntroAsync.call(this, productId, productSkn), // 商品详细介绍
curUserProduct.call(this, productData), // 商品详细价格
tdk('skn', data.skn, req) // seo
HeaderModel.requestHeaderData(data.channel), // 通用头部数据
_getProductIntroAsync.call(this, productId, productSkn), // 商品详细介绍
curUserProduct.call(this, productData), // 商品详细价格
tdk('skn', data.skn, req) // seo
]);
let navigatorHeader = requestData[0];
... ...
... ... @@ -15,29 +15,29 @@ const getHomeChannelNav = (channel) => {
switch (channel) {
case 'boys':
{
home = helpers.urlFormat('', '', 'default');
break;
}
{
home = helpers.urlFormat('', '', 'default');
break;
}
case 'girls':
{
home = helpers.urlFormat('/woman', '', 'new');
break;
}
{
home = helpers.urlFormat('/woman', '', 'new');
break;
}
case 'lifestyle':
{
home = helpers.urlFormat('/lifestyle', '', 'new');
break;
}
{
home = helpers.urlFormat('/lifestyle', '', 'new');
break;
}
case 'kids':
{
home = helpers.urlFormat('/kids', '', 'new');
break;
}
{
home = helpers.urlFormat('/kids', '', 'new');
break;
}
default:
{
home = helpers.urlFormat('', '', 'default');
}
{
home = helpers.urlFormat('', '', 'default');
}
}
... ...
... ... @@ -351,7 +351,7 @@ class FilterTools {
} else if (k === 'style') {
const styleids = _.split(params.style, ',');
const styleFinds = _.filter(filter.style,
style => _.some(styleids, id => _.parseInt(id) === style.style_id));
style => _.some(styleids, id => _.parseInt(id) === style.style_id));
if (styleFinds.length) {
condition.name = styleFinds.length >= 2 ?
... ... @@ -379,7 +379,7 @@ class FilterTools {
if (pStandar) {
const cStandar = _.find(pStandar.sub,
s => _.parseInt(s.standard_id) === _.parseInt(standardids[1]));
s => _.parseInt(s.standard_id) === _.parseInt(standardids[1]));
if (cStandar) {
const clearParams = Object.assign({}, params, { [k]: '' });
... ...
... ... @@ -49,7 +49,7 @@ const _proListHandler = (data, params) => {
// 页码
let footPager = searchHandler.handlePagerData(total,
Object.assign(params, {limit: _.get(data, 'page_size', '50')}), true);
Object.assign(params, {limit: _.get(data, 'page_size', '50')}), true);
// 商品列表
_.forEach(proList, pro => {
... ...
... ... @@ -344,7 +344,7 @@ exports.handleSaleOptsData = (params, total, extra, baseUrl) => {
// 上一页下一页
let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
parseInt(params.page, 10) - 1 : 1;
parseInt(params.page, 10) - 1 : 1;
let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
const pageHref = handleStaticFilterUrl(baseUrl, params, {page: '{page}'});
... ...
... ... @@ -585,7 +585,7 @@ function getSaleSpecialData(id, params, channel) {
params.limit = params.limit || limitNum;
const limit = params.limit - 1; // 最后一个商品是翻页
const limit = params.limit - 1; // 最后一个商品是翻页
return this.saleApi.getSaleSpecialAsync(id).then(special => {
let resData = {
... ...
... ... @@ -27,8 +27,8 @@ const UNUSEDKEY = ['page', 'limit', 'need_filter', 'order'];
function getSearchCacheKey(params) {
const paramList = Object.keys(params)
.filter(k => !_.some(UNUSEDKEY, key => key === k))
.sort();
.filter(k => !_.some(UNUSEDKEY, key => key === k))
.sort();
const paramsStr = _.join(_.map(paramList, k => `${k}_${params[k] || ''}`), '_');
return 'search_custom_' + md5(paramsStr);
... ...
... ... @@ -821,7 +821,7 @@ exports.handleFilterData = (origin, params, total) => {
dest.ageLevel.push(ageLevel);
});
} while (false);
} while (false); // eslint-disable-line
}
// 清除所有选中数据
... ...
... ... @@ -288,6 +288,14 @@ const getProductDetailSeo = (goodsInfo, navs) => {
};
};
const getHotKeywordsSeo = (keyword, num) => {
return {
title: `${keyword}_${keyword}【图片,新款,价格,折扣,搭配】-YOHO!BUY有货`,
keywords: keyword,
description: `YOHO!BUY 有货网是国内专业的${keyword}网上潮流购物商城,为您找到${num}${keyword}产品的品牌、图片、款式、价格、折扣等信息。买正品${keyword},就上YOHO!BUY有货!` // eslint-disable-line
};
};
module.exports = {
getSeoCheckedParamsName,
getListSeo,
... ... @@ -296,6 +304,7 @@ module.exports = {
getGlobalListSeo,
getShopHomeSeo,
getShopListSeo,
getProductDetailSeo
getProductDetailSeo,
getHotKeywordsSeo
};
... ...
const redis = global.yoho.redis;
const helpers = global.yoho.helpers;
const logger = global.yoho.logger;
const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header');
const SearchApi = require('./search-api');
const searchHandler = require('./search-handler');
const seoHandler = require('./seo-handler');
const utils = '../../../utils';
const productProcess = require(`${utils}/product-process-simple`);
const _setHotKeywordData = (result, params, channel) => {
let changeQuery = Object.assign({}, params);
let finalResult = {
headerData: Object.assign(result[0].headerData, {
header: true
})
};
_.unset(changeQuery, 'query');
// 获取商品数据和顶部筛选条件
if (result[1].code === 200) {
let data = result[1].data;
let goodsList = productProcess.processProductList(data.product_list,
Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params));
goodsList.map(goods => {
goods.productTitle = `${params.query}|${goods.product_name}`;
return goods;
});
Object.assign(finalResult,
searchHandler.handlePathNavData({total: data.total}, params, 'search', channel),
{
product: {
opts: searchHandler.handleOptsData(changeQuery, data.total),
totalCount: data.total,
footPager: searchHandler.handlePagerData(data.total, changeQuery),
goods: goodsList,
hasNextPage: searchHandler.handleNextPage(changeQuery, data.total)
}
}
);
finalResult.hotBrands = _.get(data, 'filter.brand', []);
finalResult.hotBrands.forEach((val) => {
val.href = helpers.urlFormat(`/list/bd${val.id}.html`);
return val;
});
finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))};
}
if (result[2].code === 200) {
let data = result[2].data;
finalResult.latestWalkExtra = [{
extraTabName: '相关推荐',
active: true,
extraGoodsList: productProcess.processProductList(data.product_list,
Object.assign({showDiscount: false, from: {type: 'hot', params: params}}, params))
}, {
extraTabName: '最近预览',
latestWalk: 5
}];
}
return finalResult;
};
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.searchApi = new SearchApi(ctx);
}
getSearchProduct(params, channel) {
let searchParams = searchHandler.getSearchParams(params);
switch (channel) {
case 'boys':
searchParams.physical_channel = 1;
break;
case 'girls':
searchParams.physical_channel = 2;
break;
case 'kids':
searchParams.physical_channel = 3;
break;
case 'lifestyle':
searchParams.physical_channel = 4;
break;
default:
break;
}
searchParams.need_filter = 'yes';
return Promise.all([
headerModel.requestHeaderData(channel, true),
this.searchApi.getSeoProductList(searchParams, 'fuzzySearch'),
this.searchApi.getSeoProductList(Object.assign(searchParams, {
order: 's_n_desc',
limit: 5
}), 'fuzzySearch'),
]).then(result => {
return _setHotKeywordData(result, params, channel);
});
}
getHotKeywordDate(id, params, channel) {
return redis.all([
['get', `global:yoho:seo:hot:keywords:id:${id}`]
]).then(redisData => {
let keyword = redisData[0];
try {
keyword = JSON.parse(keyword);
} catch (e) {
logger.debug('getProductList cache data parse fail.');
}
if (!_.get(keyword, 'name')) {
return Promise.reject(`cannot find hot keywords by id(${id})`);
}
params.query = keyword.name;
return this.getSearchProduct(params, channel).then(result => {
let hotKeys = (keyword.data || []).map(val => {
val.href = helpers.urlFormat(`/hot/${val.id}.html`);
return val;
});
let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
keyword.list = _.take(hotKeys, 6);
keyword.describe = keyword.describe || seoTDK.description;
Object.assign(result, {
hotKeys: _.drop(hotKeys, 6),
keyword: keyword
}, seoTDK);
return result;
});
});
}
};
... ...
... ... @@ -397,7 +397,7 @@ function getShopInfoAsync(domain, channel, params) {
// 没有店铺id的情况下跳转至domain-id.html
return {
redirect: helpers.urlFormat(`/shop/${domain}-${data.shop_id}.html`,
_.isEmpty(params) ? null : params),
_.isEmpty(params) ? null : params),
redirectType: 301
};
}
... ...
... ... @@ -53,6 +53,9 @@ const globalCtrl = require(`${cRoot}/global`);
// 店铺controller
const shop = require(`${cRoot}/shop`);
// seo controller
const seo = require(`${cRoot}/seo`);
// 商品促销routers
router.get('/sale', sale.index); // sale 首页
router.get('/sale/vip', sale.vip); // VIP 活动专区
... ... @@ -78,27 +81,27 @@ router.get('/outlets/:channel', outlets.channel); // 奥莱频道页
router.get('/outletslist', outletsList.index);
router.get(/^\/([\d]+)(.*)/, detail.showMain); // 新的商品详情routers
router.get(/\/p([\d]+)(.*)/, detail.showMainBack); // 老的商品详情routers
router.get('/detail/header', detail.productHeader); // 价格数据重新获取接口
router.get('/detail/comment', detail.indexComment); // 商品评论
router.get('/detail/consult', detail.indexConsult); // 商品咨询
router.post('/detail/consult', auth, detail.createConsult); // 创建咨询
router.get('/detail/consult/like/:id', auth, detail.likeConsult); // 咨询喜欢
router.get('/detail/consult/useful/:id', auth, detail.usefulConsult); // 咨询有用
router.get('/detail/hotarea', detail.indexHotArea); // 商品热区
router.post('/index/favoriteBrand', favorite.changeFavoriteBrand); // 收藏品牌
router.post('/item/togglecollect', favorite.collectProduct); // 收藏商品
router.get('/detail/return', detail.detailReturn); // 特殊商品退换货
router.get('/detail/recommend', detail.recommend); // 推荐商品
router.get('/index/isfav', favorite.isFavoriteBrand); // 品牌收藏状态
router.get('/index/favnum', favorite.num); // 收藏数量(先店铺,后品牌)
router.get('/detail/coupon', auth, coupon.acquire); // 获得优惠券
router.get('/detail/getPacakge', detail.getPackage); // 获取套餐
router.get('/detail/notify/status', auth, notify.show); // 到货通知状态
router.post('/detail/notify/add', auth, notify.add); // 增加到货通知
router.post('/detail/notify/cancel', auth, notify.cancel); // 删除到货通知
router.get(/^\/([\d]+)(.*)/, detail.showMain); // 新的商品详情routers
router.get(/\/p([\d]+)(.*)/, detail.showMainBack); // 老的商品详情routers
router.get('/detail/header', detail.productHeader); // 价格数据重新获取接口
router.get('/detail/comment', detail.indexComment); // 商品评论
router.get('/detail/consult', detail.indexConsult); // 商品咨询
router.post('/detail/consult', auth, detail.createConsult); // 创建咨询
router.get('/detail/consult/like/:id', auth, detail.likeConsult); // 咨询喜欢
router.get('/detail/consult/useful/:id', auth, detail.usefulConsult); // 咨询有用
router.get('/detail/hotarea', detail.indexHotArea); // 商品热区
router.post('/index/favoriteBrand', favorite.changeFavoriteBrand); // 收藏品牌
router.post('/item/togglecollect', favorite.collectProduct); // 收藏商品
router.get('/detail/return', detail.detailReturn); // 特殊商品退换货
router.get('/detail/recommend', detail.recommend); // 推荐商品
router.get('/index/isfav', favorite.isFavoriteBrand); // 品牌收藏状态
router.get('/index/favnum', favorite.num); // 收藏数量(先店铺,后品牌)
router.get('/detail/coupon', auth, coupon.acquire); // 获得优惠券
router.get('/detail/getPacakge', detail.getPackage); // 获取套餐
router.get('/detail/notify/status', auth, notify.show); // 到货通知状态
router.post('/detail/notify/add', auth, notify.add); // 增加到货通知
router.post('/detail/notify/cancel', auth, notify.cancel); // 删除到货通知
// 全球购routers
router.get('/list/global', '/list/global', globalCtrl.list); // 全球购列表页
... ... @@ -118,6 +121,7 @@ router.get('/search/history', search.searchHistory); // 搜索历史提示
router.get('/search/less/recommend', search.searchLessRecommend);// 搜索少或无 有可能喜欢
router.get('/search/keyword/:id', search.keyword);
router.get('/search/chanpin/:id', search.keyId);
router.get('/search/hot/:id.html', '/hot/:id.html', seo.hot);
// 新品到着
router.get('/list/new', list.newWithChannel);
... ...
<div class="yoho-page product-page seo-hot-page product-list-page">
{{> common/path-nav}}
<div class="clearfix">
<div class="left-content">
<div class="hot-sort">
{{# keyword}}
<div class="sort-intro">
<div class="inline">
<div class="name">
<h1 class="cn">{{name}}</h1>
{{# nameEn}}<span class="en">{{.}}</span>{{/ nameEn}}
</div>
{{# describe}}<p class="desc">{{.}}</p>{{/ describe}}
{{#if list}}
<ul class="key">
{{# list}}
<li><a href="{{href}}" title="{{keyword}}">{{keyword}}</a></li>
{{/ list}}
</ul>
{{/if}}
</div>
</div>
<img class="thumb" src="{{image2 goods_img}}" alt="{{name}}">
{{/ keyword}}
</div>
{{# product}}
{{> product/standard-content}}
{{/ product}}
</div>
<div class="right-content">
{{#if hotKeys}}
<div class="hot-block">
<h3 class="title">热门关键词</h3>
<p class="hot-key">
{{# hotKeys}}
<a href="{{href}}" title="{{keyword}}">{{keyword}}</a>
{{/ hotKeys}}
</p>
</div>
{{/if}}
<div class="hot-block">
<h3 class="title">热门品牌</h3>
{{# hotBrands}}
<a href="{{href}}" class="brand-item" target="_blank" title="{{brand_name_cn}}">
<img src="{{image2 brand_ico w=138 h=70}}" alt="{{brand_name_cn}} {{brand_keyword}}">
</a>
{{/ hotBrands}}
</div>
</div>
</div>
{{> product/latest-walk goodsInfo=@root.recommendGoodsInfo}}
</div>
... ...
... ... @@ -13,11 +13,11 @@ const cRoot = './controllers';
const client = require(`${cRoot}/client`);
// 在线客服
router.get('/client', auth, client.index); // 在线客服
router.get('/domains', auth, client.domains); // 域名配置
router.post('/history', auth, client.history); // 消息记录
router.post('/evaluate', auth, client.saveEval); // 评价
router.post('/leaveMsg', auth, client.saveMessage); // 留言
router.get('/client', auth, client.index); // 在线客服
router.get('/domains', auth, client.domains); // 域名配置
router.post('/history', auth, client.history); // 消息记录
router.post('/evaluate', auth, client.saveEval); // 评价
router.post('/leaveMsg', auth, client.saveMessage); // 留言
router.post('/queryReason', auth, client.queryReason);// 评价原因
module.exports = router;
... ...
... ... @@ -29,9 +29,9 @@ module.exports = class extends global.yoho.BaseModel {
};
params.v_md5info = md5(
`${params.v_amount}${params.v_moneytype}${params.v_oid}` +
`${params.v_amount}${params.v_moneytype}${params.v_oid}` +
`${params.v_mid}${params.v_url}${payParams.merchant_key}`
).toUpperCase();
).toUpperCase();
return {
code: 200,
data: Object.assign({reqType: PAY_URL}, params)
... ... @@ -65,8 +65,8 @@ module.exports = class extends global.yoho.BaseModel {
}
signText = md5(
`${data.v_oid}${data.v_pstatus}${data.v_amount}${data.v_moneytype}${payParams.merchant_key}`
).toUpperCase();
`${data.v_oid}${data.v_pstatus}${data.v_amount}${data.v_moneytype}${payParams.merchant_key}`
).toUpperCase();
return data.v_md5str === signText;
}
... ...
... ... @@ -365,7 +365,8 @@ module.exports = class extends global.yoho.BaseModel {
data: {
order: Object.assign(
orderInfo,
this._execOrderData(orderInfo, procData[1] && procData[1].data || {}, payId)
this._execOrderData(orderInfo, procData[1] && procData[1].data || {}, payId),
_.get(procData, '[2].data', {})
)
}
};
... ... @@ -390,7 +391,9 @@ module.exports = class extends global.yoho.BaseModel {
orderInfo.package_title = _.get(procData, '[1].data.notice');
}
return Object.assign(orderInfo, this._execOrderData(orderInfo, _.get(procData, '[0].data', {}), payId));
return Object.assign(orderInfo,
this._execOrderData(orderInfo, _.get(procData, '[0].data', {}), payId),
_.get(procData, '[1].data', {}));
});
}
... ...
... ... @@ -9,7 +9,7 @@
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);
const pay = require(`${cRoot}/pay`); // 支付
const pay = require(`${cRoot}/pay`); // 支付
// 支付
router.get('/newpay', auth, pay.online);
... ...
... ... @@ -12,12 +12,13 @@
<li><span class="l-b">订单号: {{order_code}}</span></li>
<li><span class="l-b">订单金额: {{payment_amount}}</span></li>
<li>
<span class="l-b back-yoho-coin">共返有货币:{{yoho_give_coin}}</span>
<a href="{{yohoCoinUrl}}" class="notice-link" target="_blank">有货币能做什么>></a>
<span class="l-b back-yoho-coin">返有货币:{{gain_yoho_coin}}</span>
</li>
<li>
<span class="l-b">获得VIP累计金额:{{payment_amount}}</span>
<a href="{{vipUrl}}" class="notice-link" target="_blank">查看VIP特权>></a>
<span class="l-b">返成长值:{{growth_value}}</span>
{{# msg}}
<span class="notice-text"><em class="iconfont">&#xe6c2;</em>{{.}}</span>
{{/ msg}}
</li>
<li class="opt-btns">
<a href="{{detailUrl}}">查看订单详情</a>
... ...
... ... @@ -20,8 +20,8 @@ module.exports = app => {
app.use(require('./apps/passport')); // 登录注册
app.use('/home', require('./apps/home')); // 会员中心
app.use(require('./apps/brands')); // 品牌一览
app.use('/guang/news', require('./apps/news')); // seo-潮流资讯页
app.use('/guang', require('./apps/guang')); // 逛
app.use('/guang/news', require('./apps/news')); // seo-潮流资讯页
app.use('/guang', require('./apps/guang')); // 逛
app.use('/cart', require('./apps/cart'));// 购物车
app.use('/help', require('./apps/help'));// 帮助中心
app.use(require('./apps/about')); // 关于有货
... ...
... ... @@ -2,9 +2,15 @@
wordir=$2
cd $wordir
rm -rf yohobuy-node.tar.gz
yarn
yarn --production=false
if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]]
then
yarn build
fi
tar -czvf yohobuy-node.tar.gz *
\ No newline at end of file
if [[ $1 == "yoho-gray" ]]
then
rm -rf public/dist
yarn build
yarn upload -f
fi
tar -czvf yohobuy-node.tar.gz *
... ...
... ... @@ -51,7 +51,7 @@ exports.notFound = () => {
* @return {[type]}
*/
exports.serverError = () => {
return async (err, req, res, next) => {
return async(err, req, res, next) => {
forceNoCache(res);
const uid = req.user ? req.user.uid : 0;
... ...
... ... @@ -209,6 +209,7 @@ module.exports = [
return '/product/index/about';
}
},
// {
// type: TYPE.rewrite,
// origin: /^\/(list|search|new|sale|shop)((\/|\?)(.*)|())$/,
... ...
... ... @@ -4,7 +4,9 @@ const _ = require('lodash');
const logger = global.yoho.logger;
const ip = require('./rules/ip-list');
const userAgent = require('./rules/useragent');
const ipWhiteList = require('./rules/ip-white-list');
const qpsLimiter = require('./rules/qps-limit');
const co = Promise.coroutine;
// const asynchronous = require('./rules/asynchronous');
// const fakerLimiter = require('./rules/faker-limit');
... ... @@ -13,12 +15,23 @@ const captchaPolicy = require('./policies/captcha');
// const reporterPolicy = require('./policies/reporter');
const IP_WHITE_LIST = [
'106.38.38.146',
'106.38.38.147',
'106.39.86.227',
'218.94.75.58',
'218.94.75.50',
'218.94.77.166'
'106.38.38.146', // 北京办公区域
'106.38.38.147', // 北京办公区域
'106.39.86.227', // 北京办公区域
'218.94.75.58', // 南京办公区域
'218.94.75.50', // 南京办公区域
'218.94.77.166', // 南京办公区域
// '222.73.196.18', // B站合作方单击次数快加白名单
'123.206.73.107', // 腾讯云出口IP
'139.199.35.21', // 腾讯云出口IP
'139.199.29.44', // 腾讯云出口IP
'123.206.21.19' // 腾讯云出口IP
];
const IP_WHITE_SEGMENT = [
'10.66.', // 内网IP段
'192.168.' // 内网IP段
];
const PATH_WHITE_LIST = [
... ... @@ -36,30 +49,45 @@ const limiter = (rule, policy, context) => {
return rule(context, policy);
};
module.exports = (req, res, next) => {
let remoteIp = req.get('X-Yoho-Real-IP') || req.get('X-Forwarded-For') || req.get('X-Real-IP') || '';
// 排除条件:ip白名单/路径白名单/异步请求/登录用户
const _excluded = (req) => {
let remoteIp = req.yoho.clientIp || '';
let remoteIpSegment = `${remoteIp.split('.').slice(0, 2).join('.')}.`;
return co(function* () {
let atWhiteList = yield ipWhiteList(remoteIp);
return Boolean(
atWhiteList ||
_.includes(IP_WHITE_LIST, remoteIp) ||
_.includes(IP_WHITE_SEGMENT, remoteIpSegment) ||
_.includes(PATH_WHITE_LIST, req.path) ||
req.xhr ||
!_.isEmpty(_.get(req, 'user.uid'))
);
})();
};
if (remoteIp.indexOf(',') > 0) {
let arr = remoteIp.split(',');
module.exports = (req, res, next) => {
const remoteIp = req.yoho.clientIp || '';
const enabled = !_.get(req.app.locals, 'pc.sys.noLimiter');
remoteIp = arr[arr.length - 1];
// 开关为关或者未获取到remoteIp,放行
if (!enabled || !remoteIp) {
logger.debug(`request remote ip: ${remoteIp}; enabled: ${enabled}`);
return next();
}
remoteIp = _.trim(remoteIp);
return co(function* () {
let excluded = yield _excluded(req);
if (_.startsWith(remoteIp, '10.66.')) {
remoteIp = req.get('X-Real-IP');
}
logger.debug(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`);
// 排除条件:ip白名单/路径白名单/异步请求/登录用户
const excluded = _.includes(IP_WHITE_LIST, remoteIp) ||
_.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid'));
const enabled = !_.get(req.app.locals, 'pc.sys.noLimiter');
logger.debug(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`);
// 白名单,放行
if (excluded) {
return next();
}
// 判断获取remoteIp成功,并且开关未关闭
if (enabled && remoteIp && !excluded) {
const context = {
req: req,
res: res,
... ... @@ -67,42 +95,40 @@ module.exports = (req, res, next) => {
remoteIp: remoteIp
};
Promise.all([
let results = yield Promise.all([
limiter(userAgent, captchaPolicy, context),
limiter(ip, captchaPolicy, context),
limiter(qpsLimiter, captchaPolicy, context)
// limiter(asynchronous, captchaPolicy, context)
// limiter(fakerLimiter, reporterPolicy, context)
]).then((results) => {
let allPass = true, exclusion = false, policy = null;
logger.debug('limiter result: ' + JSON.stringify(results));
_.forEach(results, (result) => {
if (typeof result === 'object' && !exclusion) {
exclusion = result.exclusion;
}
if (typeof result === 'function') {
allPass = false;
policy = result;
}
});
if (exclusion) {
return next();
} else if (!allPass && policy) {
policy(req, res, next);
} else {
return next();
]);
let allPass = true, exclusion = false, policy = null;
logger.debug('limiter result: ' + JSON.stringify(results));
_.forEach(results, (result) => {
if (typeof result === 'object' && !exclusion) {
exclusion = result.exclusion;
}
}).catch((err) => {
logger.error(err);
return next();
if (typeof result === 'function') {
allPass = false;
policy = result;
}
});
} else {
if (exclusion) {
return next();
} else if (!allPass && policy) {
policy(req, res, next);
} else {
return next();
}
})().catch((err) => {
logger.error(err);
return next();
}
});
};
... ...
... ... @@ -27,7 +27,7 @@ module.exports = (limiter, policy) => {
return Promise.resolve(true);
}
} else {
cache.setAsync(key, 1, ONE_DAY); // 设置key,1m失效
cache.setAsync(key, 1, ONE_DAY); // 设置key,1m失效
return Promise.resolve(true);
}
});
... ...
const co = Promise.coroutine;
const logger = global.yoho.logger;
const cache = global.yoho.cache.master;
const WHITE_LIST_KEY = 'whitelist:ip:';
module.exports = (remoteIp) => {
let key = `${WHITE_LIST_KEY}${remoteIp}`;
return co(function* () {
let result = Boolean(yield cache.getAsync(key));
logger.debug(key, result);
return result;
})();
};
... ...
... ... @@ -15,8 +15,23 @@ module.exports = (limiter, policy) => {
cache.getAsync(blackKey),
cache.getAsync(whiteKey)
]).then((args) => {
const blacklist = args[0] || [],
whitelist = args[1] || [];
let blacklist = [];
let whitelist = [];
try {
blacklist = JSON.parse(args[0]);
} catch (error) {
logger.error(error);
}
try {
whitelist = JSON.parse(args[1]);
} catch (error) {
logger.error(error);
}
blacklist = blacklist || [];
whitelist = whitelist || [];
if (blacklist.length === 0 && whitelist.length === 0) {
return Promise.resolve(true);
... ...
... ... @@ -11,7 +11,7 @@ const seoMap = require('./seoConfig');
module.exports = () => {
return (req, res, next) => {
if (!req.xhr) {
Object.assign(res.locals, seoMap[req.path] || seoMap['/']);
Object.assign(res.locals, seoMap[req.path] || seoMap.default);
}
next();
};
... ...
... ... @@ -11,7 +11,7 @@ const seoMap = require('./seoConfig');
module.exports = () => {
return (req, res, next) => {
if (!req.xhr) {
Object.assign(res.locals, seoMap[req.path] || seoMap['/']);
Object.assign(res.locals, seoMap[req.path] || seoMap.default);
}
next();
};
... ...
... ... @@ -2,6 +2,11 @@
const siteName = 'YOHO!BUY有货';
const seoMap = {
/* eslint-disable */
'default': {
title: 'YOHO!BUY 有货',
keywords: '潮流,时尚潮流,潮流服饰,潮流购物网,潮流网站',
description: '【YOHO!BUY有货】,年轻人潮流购物中心,中国潮流商品购物网站。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和国内流行商品,★全场品牌正品保证,支持货到付款★'
},
'/': {
title: 'YOHO!BUY 有货-潮流服饰购物网站,中国时尚潮流购物风向标',
keywords: '潮流,时尚潮流,潮流服饰,潮流购物网,潮流网站',
... ...
... ... @@ -10,6 +10,7 @@ const uuid = require('uuid');
const _ = require('lodash');
const config = global.yoho.config;
const helpers = global.yoho.helpers;
const net = require('net');
const _getGender = (channel) => {
switch (channel) {
... ... @@ -64,15 +65,27 @@ module.exports = () => {
// client ip
yoho.clientIp = (function() {
let remoteIp = req.get('X-Yoho-Real-IP') || req.get('X-Forwarded-For') || req.get('X-Real-IP') || req.ip;
let remoteIp = req.get('X-Yoho-Real-IP') || req.get('X-Forwarded-For') || req.get('X-Real-IP') || req.ip || ''; // eslint-disable-line
if (remoteIp.indexOf(',') > 0) {
let arr = remoteIp.split(',');
remoteIp = arr[arr.length - 1];
remoteIp = _.trim(arr[0]);
}
return _.trim(remoteIp);
if (_.startsWith(remoteIp, '10.66.')) {
remoteIp = req.get('X-Real-IP');
}
remoteIp = _.trim(remoteIp);
if (!net.isIPv4(remoteIp)) {
let ipv6String = remoteIp.split(':');
remoteIp = ipv6String[ipv6String.length - 1];
}
return remoteIp;
}());
... ...
... ... @@ -38,7 +38,7 @@ module.exports = () => {
}
break;
}
case 'search': // 搜索
case 'search': // 搜索
{ // eslint-disable-line
let searchReg = /^\/product\//;
... ...
... ... @@ -30,9 +30,9 @@ module.exports = () => {
let getVip = Fn.nth(2);
let getToken = Fn.nth(3);
req.user.name = getName(userInfo); // 0
req.user.vip = getVip(userInfo); // 2
req.user.token = getToken(userInfo); // 3
req.user.name = getName(userInfo); // 0
req.user.vip = getVip(userInfo); // 2
req.user.token = getToken(userInfo); // 3
req.user.mobile = req.session.USER_MOBILE;
req.user.isStudent = req.cookies.isStudent || 0;
... ...
... ... @@ -19,8 +19,6 @@
{{#dnsPrefetch.hosts}}
<link rel="dns-prefetch" href="{{this}}">
{{/dnsPrefetch.hosts}}
<script src="https://js.fundebug.cn/fundebug.0.3.4.min.js"
apikey="7ed21c1f98779074668264be211e847b0aff71d9ab45486d4c6684384ee26aa3"></script>
<!--[if lt IE 9]>
<script src="//cdn.yoho.cn/yohobuy-node/static/json2.js"></script>
<![endif]-->
... ...
... ... @@ -240,11 +240,7 @@
</ul>
<div class="account-info-footer">
<a href="//www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料
{{#unless @root.pc.user.removeStudentIdentification}}
<span>(学生认证)</span>
{{/unless}}
</a>
<a href="//www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料</a>
</div>
</script>
... ...
... ... @@ -7,6 +7,9 @@
<span class="about tab-item">相关推荐</span>
{{/if}}
{{# latestWalkExtra}}
<span class="tab-item extra-tab-item{{#if active}} bottom-cur{{/if}}" data-key="{{@index}}">{{extraTabName}}</span>
{{/ latestWalkExtra}}
<div class="bottom-line"></div>
</div>
<div class="bottom-tab-cont">
... ... @@ -39,5 +42,48 @@
</p>
</div>
{{/if}}
{{# latestWalkExtra}}
<div class="latest-walk-extra-area extra-area-{{@index}}{{#if active}} active{{/if}}">
{{#if extraGoodsList}}
<div class="goods clearfix">
{{# extraGoodsList}}
<div class="good">
<a href="{{url}}" target="_blank" title="{{product_name}}">
<img class="lazy" data-original="{{image2 thumb w=280 h=382}}" alt="{{product_name}}" />
</a>
<a class="name" href="{{url}}" target="_blank">{{product_name}}</a>
<p class="price">
{{#if market_price}}
<span class="market-price">¥{{round market_price 2}}</span>
{{/ if}}
<span class="sale-price">¥{{round sales_price 2}}</span>
</p>
</div>
{{/ extraGoodsList}}
</div>
{{/if}}
{{#if latestWalk}}
<div class="latest-walk-area">
<input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
<div class="latest-walk">
<div id="latest-walk-goods" class="goods clearfix"></div>
<p class="null-data">
无最近浏览的商品
</p>
</div>
{{> product/latest-walk-tpl}}
<div class="lazy-load-object">
<textarea class="latest-walk-datalazyload" style="visibility: hidden;">
<script> fetchLatestWalk(); </script>
</textarea>
</div>
</div>
{{/if}}
</div>
{{/ latestWalkExtra}}
</div>
{{/unless}}
... ...
{
"name": "yohobuy-node",
"version": "6.5.24",
"version": "6.6.0",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -12,6 +12,7 @@
"dev": "nodemon -e js,hbs -i public/ app.js",
"static": "webpack-dev-server --config ./public/build/webpack.dev.config.js",
"build": "webpack --config ./public/build/webpack.prod.config.js",
"upload": "yo-cli upload",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint-js": "eslint -c .eslintrc --cache --fix .",
... ... @@ -39,7 +40,6 @@
"md5": "^2.1.0",
"moment": "^2.14.1",
"morgan": "^1.7.0",
"oneapm": "^1.2.20",
"passport": "^0.3.2",
"passport-douban": "0.0.1",
"passport-local": "^1.0.0",
... ... @@ -57,61 +57,59 @@
"sitemap": "^1.12.1",
"urlencode": "^1.1.0",
"uuid": "^2.0.2",
"yo-cli": "^1.0.5",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "=0.6.11",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"autoprefixer": "^8.3.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-runtime": "^6.26.0",
"bootstrap": "^3.3.7",
"css-loader": "^0.27.3",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"eslint": "^3.16.0",
"eslint": "^4.19.1",
"eslint-config-yoho": "^1.0.9",
"eslint-loader": "^1.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"handlebars": "4.0.5",
"handlebars-loader": "^1.4.0",
"happypack": "^3.0.3",
"handlebars-loader": "^1.7.0",
"husky": "^0.11.4",
"jquery-ui": "^1.12.1",
"nodemon": "1.9.2",
"postcss-assets": "^4.0.1",
"postcss-cachebuster": "^0.1.3",
"postcss-calc": "^5.3.1",
"nodemon": "^1.17.3",
"postcss": "^6.0.21",
"postcss-assets": "^5.0.0",
"postcss-calc": "^6.0.1",
"postcss-center": "^1.0.0",
"postcss-clearfix": "^1.0.0",
"postcss-clearfix": "^2.0.1",
"postcss-crip": "^2.0.1",
"postcss-import": "^9.1.0",
"postcss-loader": "^1.3.1",
"postcss-opacity": "^4.0.0",
"postcss-position": "^0.5.0",
"postcss-pxtorem": "^4.0.0",
"postcss-scss": "^1.0.2",
"postcss-short": "^3.0.3",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.4",
"postcss-opacity": "^5.0.0",
"postcss-position": "^1.0.0",
"postcss-scss": "^1.0.5",
"postcss-short": "^4.1.0",
"postcss-sprites": "^4.2.0",
"postcss-use": "^2.3.0",
"precss": "^1.4.0",
"regenerator-runtime": "^0.11.1",
"postcss-use": "^3.0.0",
"precss": "2.0.0",
"rewire": "^2.5.1",
"shelljs": "^0.7.0",
"style-loader": "^0.16.0",
"stylelint": "^8.4.0",
"stylelint-config-yoho": "^1.2.11",
"shelljs": "^0.8.1",
"style-loader": "^0.21.0",
"stylelint": "^9.2.0",
"stylelint-config-yoho": "^1.3.0",
"stylelint-formatter-table": "^1.0.3",
"stylelint-webpack-plugin": "^0.7.0",
"webpack": "^2.3.1",
"webpack-dev-server": "^2.4.2",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15",
"webpack-dev-server": "^3.1.3",
"yoho-eventproxy": "^0.3.6",
"yoho-handlebars": "^4.0.5",
"yoho-handlebars": "^4.0.6",
"yoho-jquery": "^1.12.4",
"yoho-jquery-dotdotdot": "0.0.1",
"yoho-jquery-dotdotdot": "0.0.2",
"yoho-jquery-lazyload": "1.9.7",
"yoho-jquery-pjax": "0.0.1",
"yoho-jquery-placeholder": "^2.3.1",
... ...
... ... @@ -6,20 +6,14 @@
'use strict';
const os = require('os');
const path = require('path');
const shelljs = require('shelljs');
const _ = require('lodash');
const webpack = require('webpack');
const HappyPack = require('happypack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const scss = require('postcss-scss');
const postcssConfig = require('./postcss.config.js');
const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
size: os.cpus().length
});
const hbsLoader = {
loader: 'handlebars-loader',
options: {
... ... @@ -59,16 +53,6 @@ const cssLoader = (env, type) => {
const getEntries = () => {
const entries = {
libs: [
'yoho-handlebars',
'yoho-jquery',
'yoho-jquery-lazyload',
'yoho-slider',
'yoho-jquery-pjax',
'yoho-jquery-dotdotdot',
'regenerator-runtime/runtime',
path.join(__dirname, '../js/global.js')
],
base: path.join(__dirname, '../scss/base.css')
};
... ... @@ -88,13 +72,24 @@ const getEntries = () => {
// Important
// 生成规则:module.page: './js/module/xx.page.js'
entries[`${dir[0]}.${dir[1].match(/(.*).page.js/)[1]}`] = path.join(__dirname, `../js/${dir.join('/')}`);
entries[`${dir[0]}.${dir[1].match(/(.*).page.js/)[1]}`] = [path.join(__dirname, '../js/global.js'),
path.join(__dirname, `../js/${dir.join('/')}`)];
});
return entries;
};
module.exports = (env) => {
const libs = [
'yoho-handlebars',
'yoho-jquery',
'yoho-jquery-lazyload',
'yoho-slider',
'yoho-jquery-pjax',
'yoho-jquery-dotdotdot',
path.join(__dirname, '../js/global.js')
];
return {
entry: getEntries(),
output: {
... ... @@ -104,34 +99,17 @@ module.exports = (env) => {
devtool: 'hidden-source-map',
module: {
rules: [{
test: /\.vue$/,
use: [{
loader: 'vue-loader',
options: {
postcss: {
plugins: postcssConfig.postcssPlugin(env),
parser: scss
},
autoprefixer: false,
loaders: {
css: cssLoader(env, 'vue')
}
}
}]
}, {
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: 'happypack/loader?id=js'
loader: 'babel-loader'
}]
}, {
test: /\.css$/,
use: cssLoader(env, 'css')
}, {
test: /\.hbs$/,
use: [{
loader: 'happypack/loader?id=hbs'
}]
use: hbsLoader
}]
},
resolve: {
... ... @@ -151,20 +129,34 @@ module.exports = (env) => {
stats: {
children: false
},
optimization: {
splitChunks: {
cacheGroups: {
default: false,
libs: {
test: (file) => {
if (libs.indexOf(file.rawRequest) >= 0) {
return true;
}
return false;
},
name: 'libs',
chunks: 'all',
enforce: true
}
}
}
},
performance: {
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
plugins: [
new HappyPack({
id: 'js',
threadPool: happyThreadPool,
loaders: ['babel-loader'],
}),
new HappyPack({
id: 'hbs',
threadPool: happyThreadPool,
loaders: [hbsLoader]
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'libs',
filename: 'libs.js'
new webpack.LoaderOptionsPlugin({
options: {
handlebarsLoader: {}
}
}),
new webpack.ProvidePlugin({
$: 'yoho-jquery',
... ...
... ... @@ -10,10 +10,15 @@ let baseConfig = require('./webpack.base.config.js');
baseConfig = baseConfig('dev');
_.mergeWith(baseConfig, {
mode: 'development',
devtool: '#cheap-module-source-map',
output: {
publicPath: devInfo.publicPath
},
performance: {
maxEntrypointSize: 2048000,
maxAssetSize: 2048000
},
devServer: {
host: '127.0.0.1',
port: devInfo.port,
... ...
'use strict';
const os = require('os');
const path = require('path');
const shelljs = require('shelljs');
const _ = require('lodash');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('../../package.json');
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);
... ... @@ -18,34 +16,12 @@ shelljs.cp('-R', path.join(__dirname, '../font/'), distDir);
baseConfig = baseConfig('pro');
_.mergeWith(baseConfig, {
mode: 'production',
output: {
path: distDir
},
plugins: [
new ExtractTextPlugin('[name].css'),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
workers: os.cpus().length,
ie8: true,
compress: {
screw_ie8: false,
properties: false,
warnings: false
},
output: {
screw_ie8: false,
keep_quoted_props: true
},
mangle: {
screw_ie8: false
},
comments: false,
sourceMap: true
})
new ExtractTextPlugin('[name].css')
]
}, function customizer(objValue, srcValue) {
if (_.isArray(objValue)) {
... ...
{{#if return_amount}}退款总金额:¥{{return_amount}} {{#if return_asset_desc}}({{return_asset_desc}}){{/if}}<span class="iconfont icon-tip-help">&#xe6d6;</span>{{/if}}
{{#if return_amount}}退款总金额:¥{{return_amount}} <span class="iconfont icon-tip-help">&#xe6d6;</span>{{/if}} {{#if return_asset_desc}}<span class="gray">{{return_asset_desc}}</span>{{/if}}
... ...
... ... @@ -186,7 +186,7 @@ Cart = {
}
item.push({
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
batch_no: batchNo,
activity_id: poolId,
product_sku: $(this).data('id'),
... ... @@ -205,7 +205,7 @@ Cart = {
return capi.choiceOut({
product_sku: $pitem.data('id'),
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
buy_number: $pitem.data('productnum'),
goods_type: $pitem.data('goodstype'),
promotion_id: $pitem.data('promotionid') ? $pitem.data('promotionid') : 0
... ... @@ -592,18 +592,18 @@ Cart = {
cartScroll.init(); // 购物车页面滚动
$cartListWrap.on('click', 'li[data-role="pitem"] .cart-item-check', Cart.toggleSelectOne); // 单选
$cartListWrap.on('click', '[data-role=cart-del-btn]', Cart.del); // 删除商品
$cartListWrap.on('click', '[data-role=cart-mov2fav-btn]', Cart.toFav); // 移入收藏夹
$cartListWrap.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$cartListWrap.on('click', 'li[data-role="pitem"] .cart-item-check', Cart.toggleSelectOne); // 单选
$cartListWrap.on('click', '[data-role=cart-del-btn]', Cart.del); // 删除商品
$cartListWrap.on('click', '[data-role=cart-mov2fav-btn]', Cart.toFav); // 移入收藏夹
$cartListWrap.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$cartListWrap.on('click', '.cart-title .cart-item-check', Cart.toggleSelectAll); // 全选
$cartListWrap.on('click', '#cbSelAllGoods', Cart.toggleSelectAll); // 全选
$cartListWrap.on('click', '.pre-sell-title .cart-item-check', Cart.togglePreAll); // 预售全选
$cartListWrap.on('click', '.ord-sell-title .cart-item-check', Cart.toggleOrdAll); // 预售全选
$cartListWrap.on('click', '.cart-fixed-submit .delete-all-sel', Cart.delAll); // 批量删除商品
$cartListWrap.on('click', '.cart-fixed-submit .remove-all-2fav', Cart.toFavAll); // 批量移入收藏夹商品
$cartListWrap.on('click', '.cart-fixed-submit .delete-all-sel', Cart.delAll); // 批量删除商品
$cartListWrap.on('click', '.cart-fixed-submit .remove-all-2fav', Cart.toFavAll); // 批量移入收藏夹商品
$cartListWrap.on('click', '.cart-fixed-submit .clean-all-disable', Cart.cleanAllDisable);
$cartListWrap.on('click', '#Y_SubmitBtn', Cart.submit); // 结算
$cartListWrap.on('click', '#Y_SubmitBtn', Cart.submit); // 结算
$cartListWrap.on('click', '#Y_CartSelectDialog .btn-account', Cart.submitSingle);
// 重新加入购物车
... ...
... ... @@ -221,7 +221,7 @@ function cartItemDel(items, type, cookieList, isReFav) {
// 购物车商品增减
cartItemNumChg = (function() {
var countBusy = false; // 保证一次只请求完成前不能再次发起
var countBusy = false; // 保证一次只请求完成前不能再次发起
return function(data) {
... ... @@ -250,7 +250,7 @@ cartItemNumChg = (function() {
function getProductInfo(pid, skn) {
return $.ajax({
type: 'GET',
url: '/cart/cart/getProductData', // '/product/item/getProductInfo',
url: '/cart/cart/getProductData', // '/product/item/getProductInfo',
data: {
productId: pid,
skn: skn
... ...
... ... @@ -182,7 +182,7 @@ GoodsWinAction = {
var $detailBigpic = $detail.find('.detail-bigpic');
var $curSize = $sizes.eq(idx);
var $curDetailBig = $detailBigpic.eq(idx);
var bigPicIndex = 0; // 默认显示大图中的第一个图
var bigPicIndex = 0; // 默认显示大图中的第一个图
$curDetailBig.data('_index', bigPicIndex);
... ...
... ... @@ -252,11 +252,11 @@ $paySum.on('click', '.btn-account', function() {
// if ($('.zp').length > 0 && !$(this).attr('title')) {
// $(this).attr('title', '1');
// new Confirm({
// className: 'shopCart-del-dialog',
// content: '<h4><i class="iconfont">&#xe6c2;</i>您还未选择赠品</h4>' +
// '<small>是否去选择赠品?</small>',
// }).show();
// new Confirm({
// className: 'shopCart-del-dialog',
// content: '<h4><i class="iconfont">&#xe6c2;</i>您还未选择赠品</h4>' +
// '<small>是否去选择赠品?</small>',
// }).show();
// } else {
// if ($('input:checked').length > 0) {
... ...
... ... @@ -115,13 +115,13 @@ function validateAddress(data) {
data = data || {};
for (i in data) {
if (data.hasOwnProperty(i) &&
regx[i] &&
!regx[i].test(data[i])) {
pass = false;
}
if (i === 'consignee' && stringHandle.chinese2(data[i]) > 20) {
pass = false;
if (data.hasOwnProperty(i)) {
if (regx[i] && !regx[i].test(data[i])) {
pass = false;
}
if (i === 'consignee' && stringHandle.chinese2(data[i]) > 20) {
pass = false;
}
}
}
return pass;
... ...
... ... @@ -14,13 +14,13 @@ require('../../common');
if ($('.order-easypay-page').length) {
qs = window.queryString();
if (qs.sku && qs.skn && qs.limitcode) { // sku,skn,limitcode 同时存在时为限定商品
if (qs.sku && qs.skn && qs.limitcode) { // sku,skn,limitcode 同时存在时为限定商品
queryInfo = {
sku: qs.sku,
skn: qs.skn,
limitcode: qs.limitcode
};
} else if (qs.sku && qs.bundle) { // sku,bundle 同时存在时为套餐商品
} else if (qs.sku && qs.bundle) { // sku,bundle 同时存在时为套餐商品
queryInfo = {
sku: qs.sku,
bundle: qs.bundle
... ...
... ... @@ -104,8 +104,8 @@ if (mChannel !== '') {
});
// 最新速报
// 左1+中6
// 最新速报
// 左1+中6
$('.new-report .report-list li > a').click(function() {
var $header = $('.new-report .floor-header');
var floorId = $header.attr('floorid'),
... ... @@ -123,7 +123,7 @@ if (mChannel !== '') {
});
});
// 右1
// 右1
$('.new-report .last-item > a').click(function() {
var $header = $('.new-report .floor-header');
var floorId = $header.attr('floorid'),
... ... @@ -140,7 +140,7 @@ if (mChannel !== '') {
});
});
// logo列表
// logo列表
$('.logo-brand > ul li > a').click(function() {
var $header;
var floorId, floorName, url, content, index;
... ... @@ -171,7 +171,7 @@ if (mChannel !== '') {
});
});
// 广告位
// 广告位
$('.floor-ad > a').click(function() {
var $header = $('.floor-ad').prev().prev();
var floorId = $header.attr('floorid'),
... ... @@ -188,8 +188,8 @@ if (mChannel !== '') {
});
});
// 左一右六埋点
// 左一
// 左一右六埋点
// 左一
$('.tpl-left-pic > a').click(function() {
var $topic = $(this).closest('.topic'),
$header = $topic.prev(),
... ... @@ -221,7 +221,7 @@ if (mChannel !== '') {
}
});
// 右六
// 右六
$('.tpl-types > ul li > a').click(function() {
var $topic = $(this).closest('.topic'),
$header = $topic.prev(),
... ... @@ -255,7 +255,7 @@ if (mChannel !== '') {
}
});
// 7个品类
// 7个品类
$('.seven-product .tpl-products > ul li > a').click(function() {
var floorId = $(this).closest('.tpl-products').attr('floorid'),
url = $(this).attr('href'),
... ... @@ -270,8 +270,8 @@ if (mChannel !== '') {
});
});
// 最新上架
// more链接
// 最新上架
// more链接
$('.commodity .floor-header .header-navs li > a').click(function() {
var $header = $(this).closest('.floor-header'),
name = $header.find('.floor-title').html(),
... ... @@ -291,21 +291,21 @@ if (mChannel !== '') {
});
});
// 商品列表
// 商品列表
$('.commodity .goods-container').on('click', '.good-info .good-detail-img > a,' +
'.good-info .good-detail-text > a', function() {
var $header = $('.commodity .floor-header'),
name = $header.find('.floor-title').html(),
url = $(this).attr('href'),
index = parseInt($(this).closest('.good-info').index(), 10) + 1;
yas.givePoint('YB_JK_PAV_FLR_C', {
F_ID: $header.attr('floorid'),
F_NAME: name,
F_URL: url,
F_INDEX: 6,
I_INDEX: index + 10
});
var $header = $('.commodity .floor-header'),
name = $header.find('.floor-title').html(),
url = $(this).attr('href'),
index = parseInt($(this).closest('.good-info').index(), 10) + 1;
yas.givePoint('YB_JK_PAV_FLR_C', {
F_ID: $header.attr('floorid'),
F_NAME: name,
F_URL: url,
F_INDEX: 6,
I_INDEX: index + 10
});
});
}
... ...
... ... @@ -24,7 +24,7 @@
};
var shownum = options.shownum ? options.shownum : // eslint-disable-line
$.fn.slider2.defaults.shownum;
$.fn.slider2.defaults.shownum;
var isCircle = 'isCircle' in options ? options.isCircle : // eslint-disable-line
$.fn.slider2.defaults.isCircle;
... ...
... ... @@ -76,7 +76,7 @@ var address = {
nId = val.value;
selecter = '';
if (typeof (allCode) !== 'undefined' && allCode !== 0 &&
if (typeof(allCode) !== 'undefined' && allCode !== 0 &&
nId === allCode.substr(0, nId.length)) {
selecter = 'selected';
}
... ...
... ... @@ -12,7 +12,7 @@ function getDynamicById(id) {
id: id
};
// //guang.yohobuy.com/guang/info/detailData
// //guang.yohobuy.com/guang/info/detailData
return $.getJSON('/guang/info/detailData', param);
}
... ...
... ... @@ -59,8 +59,8 @@ Scroller.prototype = {
},
scroll: function() {
if (this.element.scrollTop < this.maxHeight) {
this.element.scrollTop ++;
this.counter ++;
this.element.scrollTop++;
this.counter++;
} else {
this.element.scrollTop = 0;
this.counter = 0;
... ...