Merge branch 'gray'
Showing
23 changed files
with
134 additions
and
64 deletions
@@ -17,6 +17,7 @@ exports.productLst = function(req, res, next) { | @@ -17,6 +17,7 @@ exports.productLst = function(req, res, next) { | ||
17 | specified_sort: req.query.enum, | 17 | specified_sort: req.query.enum, |
18 | stocknumber: req.query.sn, | 18 | stocknumber: req.query.sn, |
19 | p_d: req.query.pd, | 19 | p_d: req.query.pd, |
20 | + noDup: req.query.noDup, | ||
20 | limit: req.query.limit || 10 | 21 | limit: req.query.limit || 10 |
21 | }; | 22 | }; |
22 | 23 |
@@ -27,7 +27,9 @@ module.exports = { | @@ -27,7 +27,9 @@ module.exports = { | ||
27 | productLst: function(params) { | 27 | productLst: function(params) { |
28 | return api.get('', Object.assign({ | 28 | return api.get('', Object.assign({ |
29 | method: 'app.search.newPromotion' | 29 | method: 'app.search.newPromotion' |
30 | - }, params)).then(res => { | 30 | + }, params), { |
31 | + cache: true | ||
32 | + }).then(res => { | ||
31 | var data = [], | 33 | var data = [], |
32 | lst = (res.data && res.data.product_list) || []; | 34 | lst = (res.data && res.data.product_list) || []; |
33 | 35 |
apps/api/controllers/apple.js
0 → 100644
1 | +/** | ||
2 | + * 唤起苹果 app 配置文件 | ||
3 | + */ | ||
4 | + | ||
5 | +'use strict'; | ||
6 | +let configFile = ` | ||
7 | +{ | ||
8 | + "applinks": { | ||
9 | + "apps": [], | ||
10 | + "details": [ | ||
11 | + { | ||
12 | + "appID": "6U82P566A4.com.yoho.buy", | ||
13 | + "paths": [ "*"] | ||
14 | + }, | ||
15 | + { | ||
16 | + "appID": "EX33S4LRW7.com.yoho.buy", | ||
17 | + "paths": [ "*" ] | ||
18 | + } | ||
19 | + ] | ||
20 | + } | ||
21 | +} | ||
22 | +`; | ||
23 | + | ||
24 | +const appSiteAssociation = (req, res) => { | ||
25 | + res.set('Content-Disposition', 'attachment; filename="apple-app-site-association"'); | ||
26 | + res.send(configFile); | ||
27 | +}; | ||
28 | + | ||
29 | +module.exports = { | ||
30 | + appSiteAssociation | ||
31 | +}; |
@@ -13,12 +13,13 @@ var multipart = require('connect-multiparty'); | @@ -13,12 +13,13 @@ var multipart = require('connect-multiparty'); | ||
13 | var multipartMiddleware = multipart(); | 13 | var multipartMiddleware = multipart(); |
14 | 14 | ||
15 | const uploadApi = require(cRoot + '/upload.js'); | 15 | const uploadApi = require(cRoot + '/upload.js'); |
16 | - | ||
17 | const hotfix = require(`${cRoot}/hotfix`); | 16 | const hotfix = require(`${cRoot}/hotfix`); |
17 | +const apple = require(`${cRoot}/apple`); | ||
18 | 18 | ||
19 | // routers | 19 | // routers |
20 | - | ||
21 | router.post('/api/upload/image', multipartMiddleware, uploadApi.uploadImg); | 20 | router.post('/api/upload/image', multipartMiddleware, uploadApi.uploadImg); |
22 | router.post('/hf/v1', hotfix.v1); | 21 | router.post('/hf/v1', hotfix.v1); |
23 | 22 | ||
23 | +router.get('/.well-known/apple-app-site-association', apple.appSiteAssociation); | ||
24 | + | ||
24 | module.exports = router; | 25 | module.exports = router; |
@@ -83,8 +83,7 @@ const getDetailData = (req, res, next) => { | @@ -83,8 +83,7 @@ const getDetailData = (req, res, next) => { | ||
83 | let udid = req.sessionID || 'yoho'; | 83 | let udid = req.sessionID || 'yoho'; |
84 | let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3'; | 84 | let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3'; |
85 | let isApp = req.query.app_version || req.query.appVersion || false; | 85 | let isApp = req.query.app_version || req.query.appVersion || false; |
86 | - let clientType = req.body.client_type || ''; | ||
87 | - let version = req.body.app_version || ''; | 86 | + let clientType = (req.body.client_type || '').toLowerCase(); |
88 | let userAgent = req.get('User-Agent'); | 87 | let userAgent = req.get('User-Agent'); |
89 | let isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问 | 88 | let isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问 |
90 | 89 | ||
@@ -96,9 +95,9 @@ const getDetailData = (req, res, next) => { | @@ -96,9 +95,9 @@ const getDetailData = (req, res, next) => { | ||
96 | uid = req.user.uid; | 95 | uid = req.user.uid; |
97 | } | 96 | } |
98 | 97 | ||
99 | - if (clientType.toLowerCase() === 'ios' && version) { | 98 | + if (clientType === 'ios' && isApp) { |
100 | clientType = 'iphone'; | 99 | clientType = 'iphone'; |
101 | - } else if (clientType.toLowerCase() === 'android' && version) { | 100 | + } else if (clientType === 'android' && isApp) { |
102 | clientType = 'android'; | 101 | clientType = 'android'; |
103 | } else { | 102 | } else { |
104 | clientType = 'h5'; | 103 | clientType = 'h5'; |
@@ -31,7 +31,6 @@ const getAuthor = (id) => { | @@ -31,7 +31,6 @@ const getAuthor = (id) => { | ||
31 | }); | 31 | }); |
32 | }; | 32 | }; |
33 | 33 | ||
34 | - | ||
35 | /** | 34 | /** |
36 | * 逛分类 | 35 | * 逛分类 |
37 | */ | 36 | */ |
@@ -108,27 +107,21 @@ const getPageData = (gender, sortId, uid, udid, page, tag, authorId, isApp, show | @@ -108,27 +107,21 @@ const getPageData = (gender, sortId, uid, udid, page, tag, authorId, isApp, show | ||
108 | 107 | ||
109 | // 广告列表 | 108 | // 广告列表 |
110 | if (isTab && adList) { | 109 | if (isTab && adList) { |
111 | - let build = []; | ||
112 | - | ||
113 | - adList.forEach(ad => { | ||
114 | - build.push({ | 110 | + result.swiper = adList.map(function(ad) { |
111 | + return { | ||
115 | url: guangProcess.getFilterUrl(ad.url), | 112 | url: guangProcess.getFilterUrl(ad.url), |
116 | img: helpers.image(ad.src, 830, 327) | 113 | img: helpers.image(ad.src, 830, 327) |
117 | - }); | 114 | + }; |
118 | }); | 115 | }); |
119 | - result.swiper = build; | ||
120 | } | 116 | } |
121 | 117 | ||
122 | /* 构建资讯文章内容 */ | 118 | /* 构建资讯文章内容 */ |
123 | - let build = []; | ||
124 | let artList = article.data.list.artList; | 119 | let artList = article.data.list.artList; |
125 | 120 | ||
126 | - artList.forEach(art => { | ||
127 | - build.push(guangProcess.formatArticle(art, true, isApp, showAuthor, uid)); | ||
128 | - | ||
129 | - // build.push(guangProcess.formatArticle(art, true, isApp, true, uid)); | 121 | + result.infos = artList.map(function(art) { |
122 | + return guangProcess.formatArticle(art, true, isApp, showAuthor, uid); | ||
130 | }); | 123 | }); |
131 | - result.infos = build; | 124 | + |
132 | return result; | 125 | return result; |
133 | }); | 126 | }); |
134 | }; | 127 | }; |
@@ -227,7 +227,7 @@ const getNewProduct = (brandId, gender, url, isApp) => { | @@ -227,7 +227,7 @@ const getNewProduct = (brandId, gender, url, isApp) => { | ||
227 | }); | 227 | }); |
228 | }; | 228 | }; |
229 | 229 | ||
230 | -// 相关资讯 | 230 | +// 相关资讯--不能加cache,否则点赞有缓存. |
231 | const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => { | 231 | const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => { |
232 | 232 | ||
233 | return serviceAPI.get('guang/service/v1/article/getArticleByBrand', { | 233 | return serviceAPI.get('guang/service/v1/article/getArticleByBrand', { |
@@ -324,12 +324,11 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | @@ -324,12 +324,11 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
324 | 324 | ||
325 | list.brand_ico = imageProcess.getSourceUrl(list.brand_ico, 'brandLogo'); | 325 | list.brand_ico = imageProcess.getSourceUrl(list.brand_ico, 'brandLogo'); |
326 | 326 | ||
327 | - return Promise.all([getRelatedEditorial(brandId, uid, udid, clientType, isApp), getNewProduct(brandId, gender, url, isApp)]).then((result) => { | 327 | + return getNewProduct(brandId, gender, url, isApp).then((result) => { |
328 | 328 | ||
329 | - list = _.assign(list, { | 329 | + return _.assign(list, { |
330 | isLike: false, | 330 | isLike: false, |
331 | - infos: result[0], | ||
332 | - newArrival: result[1], | 331 | + newArrival: result, |
333 | jumpToApp: jumpToApp, | 332 | jumpToApp: jumpToApp, |
334 | shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id, | 333 | shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id, |
335 | shareTitle: list.brand_name, | 334 | shareTitle: list.brand_name, |
@@ -337,8 +336,6 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | @@ -337,8 +336,6 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
337 | shareDesc: htmlProcess.removeHtml(list.brand_intro), | 336 | shareDesc: htmlProcess.removeHtml(list.brand_intro), |
338 | clientType: clientType | 337 | clientType: clientType |
339 | }); | 338 | }); |
340 | - | ||
341 | - return list; | ||
342 | }); | 339 | }); |
343 | 340 | ||
344 | } else { | 341 | } else { |
@@ -25,25 +25,25 @@ | @@ -25,25 +25,25 @@ | ||
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | - {{# newArrival}} | 28 | + {{#if newArrival.naList}} |
29 | <div class="new-arrival ps-block"> | 29 | <div class="new-arrival ps-block"> |
30 | <div class="floor-header-more"> | 30 | <div class="floor-header-more"> |
31 | <h2>NEW ARRIVAL</h2> | 31 | <h2>NEW ARRIVAL</h2> |
32 | - <a class="more-btn iconfont buriedpoint" href="{{moreUrl}}" data-bp-id="shop_more_btn_0"></a> | 32 | + <a class="more-btn iconfont buriedpoint" href="{{newArrival.moreUrl}}" data-bp-id="shop_more_btn_0"></a> |
33 | </div> | 33 | </div> |
34 | <div class="new-arrival-content clearfix"> | 34 | <div class="new-arrival-content clearfix"> |
35 | - {{# naList}} | 35 | + {{# newArrival.naList}} |
36 | {{> good}} | 36 | {{> good}} |
37 | - {{/ naList}} | 37 | + {{/ newArrival.naList}} |
38 | </div> | 38 | </div> |
39 | <div class="more-goods-container"> | 39 | <div class="more-goods-container"> |
40 | - <a class="mg-text" href="{{moreUrl}}"> | 40 | + <a class="mg-text" href="{{newArrival.moreUrl}}"> |
41 | 更多商品 | 41 | 更多商品 |
42 | <span class="more-prods iconfont"></span> | 42 | <span class="more-prods iconfont"></span> |
43 | </a> | 43 | </a> |
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | - {{/ newArrival}} | 46 | + {{/if}} |
47 | <div class="related-infos data-bind ps-block"> | 47 | <div class="related-infos data-bind ps-block"> |
48 | <div> | 48 | <div> |
49 | <h2 class="related-info-title">相关资讯</h2> | 49 | <h2 class="related-info-title">相关资讯</h2> |
@@ -24,7 +24,7 @@ const bind = { | @@ -24,7 +24,7 @@ const bind = { | ||
24 | indexPage: (req, res) => { | 24 | indexPage: (req, res) => { |
25 | // 如果没有originalUrl,判定为非法链接 | 25 | // 如果没有originalUrl,判定为非法链接 |
26 | if (req.session.originalUrl !== 'true') { | 26 | if (req.session.originalUrl !== 'true') { |
27 | - res.redirect('//m.yohobuy.com'); | 27 | + return res.redirect('//m.yohobuy.com'); |
28 | } | 28 | } |
29 | let refer = req.get('Referer'); | 29 | let refer = req.get('Referer'); |
30 | 30 |
@@ -221,24 +221,23 @@ const category = (req, res, next) => { | @@ -221,24 +221,23 @@ const category = (req, res, next) => { | ||
221 | JSON.stringify(appParams) + | 221 | JSON.stringify(appParams) + |
222 | '}'; | 222 | '}'; |
223 | 223 | ||
224 | + let uid = req.user.uid || 0; | ||
225 | + | ||
224 | // 获取第一页数据做服务端渲染 | 226 | // 获取第一页数据做服务端渲染 |
225 | let initialData = _.assign({ | 227 | let initialData = _.assign({ |
226 | gender: params.gender, | 228 | gender: params.gender, |
227 | - sort: parseInt(params.sort) || '', | 229 | + sort: parseInt(params.sort, 10) || '', |
228 | type: 'default', | 230 | type: 'default', |
229 | order: '0', | 231 | order: '0', |
230 | page: 1, | 232 | page: 1, |
231 | limit: 12, | 233 | limit: 12, |
232 | }, params); | 234 | }, params); |
233 | 235 | ||
236 | + if (uid) { | ||
237 | + initialData.uid = uid; | ||
238 | + } | ||
239 | + | ||
234 | searchModel.getSearchData(initialData).then((firstScreenGoodsList) => { | 240 | searchModel.getSearchData(initialData).then((firstScreenGoodsList) => { |
235 | - if (firstScreenGoodsList && firstScreenGoodsList.list) { | ||
236 | - _.forEach(firstScreenGoodsList.list, function(item) { | ||
237 | - if (item && item.default_images) { | ||
238 | - item.default_images = item.default_images.replace(/quality\/80/g, 'quality/70'); | ||
239 | - } | ||
240 | - }); | ||
241 | - } | ||
242 | res.render('search/goods-list', { | 241 | res.render('search/goods-list', { |
243 | _noLazy: true, // 首屏不使用lazyload | 242 | _noLazy: true, // 首屏不使用lazyload |
244 | module: 'product', | 243 | module: 'product', |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | 'use strict'; | 5 | 'use strict'; |
6 | const mRoot = '../models'; | 6 | const mRoot = '../models'; |
7 | - | 7 | +const utils = '../../../utils'; |
8 | const listModel = require(`${mRoot}/list`); | 8 | const listModel = require(`${mRoot}/list`); |
9 | const searchModel = require(`${mRoot}/search`); | 9 | const searchModel = require(`${mRoot}/search`); |
10 | const redsShopModel = require(`${mRoot}/popular-shop`); | 10 | const redsShopModel = require(`${mRoot}/popular-shop`); |
@@ -21,6 +21,7 @@ const shop = { | @@ -21,6 +21,7 @@ const shop = { | ||
21 | let brandId = 0; | 21 | let brandId = 0; |
22 | let brandLogo = {}; | 22 | let brandLogo = {}; |
23 | let title = ''; | 23 | let title = ''; |
24 | + let uid = req.user.uid || 0; | ||
24 | 25 | ||
25 | if (req.query.shop_id) { | 26 | if (req.query.shop_id) { |
26 | return shop.shop(req, res, next); | 27 | return shop.shop(req, res, next); |
@@ -55,6 +56,10 @@ const shop = { | @@ -55,6 +56,10 @@ const shop = { | ||
55 | limit: 4, | 56 | limit: 4, |
56 | }, params); | 57 | }, params); |
57 | 58 | ||
59 | + if (uid) { | ||
60 | + searchParam.uid = uid; | ||
61 | + } | ||
62 | + | ||
58 | if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) { | 63 | if (req.query.from !== 'search' && brandLogo.type === '2' && brandLogo.shopId) { |
59 | req.query.shop_id = brandLogo.shopId; | 64 | req.query.shop_id = brandLogo.shopId; |
60 | shop.shop(req, res, next); | 65 | shop.shop(req, res, next); |
@@ -98,7 +103,6 @@ const shop = { | @@ -98,7 +103,6 @@ const shop = { | ||
98 | }); | 103 | }); |
99 | } | 104 | } |
100 | }).then((isBrand) => { | 105 | }).then((isBrand) => { |
101 | - // console.log(params); | ||
102 | if (isBrand) { | 106 | if (isBrand) { |
103 | res.render('newshop/brand', { | 107 | res.render('newshop/brand', { |
104 | module: 'product', | 108 | module: 'product', |
@@ -165,6 +169,10 @@ const shop = { | @@ -165,6 +169,10 @@ const shop = { | ||
165 | let shopInfo = shopInfoResult; | 169 | let shopInfo = shopInfoResult; |
166 | let seoResult = listModel.getBrandShopSeo(channel, shopInfoResult, req.query); | 170 | let seoResult = listModel.getBrandShopSeo(channel, shopInfoResult, req.query); |
167 | 171 | ||
172 | + if (uid) { | ||
173 | + searchParam.uid = uid; | ||
174 | + } | ||
175 | + | ||
168 | /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ | 176 | /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ |
169 | if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) { | 177 | if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) { |
170 | return Promise.all([listModel.getBaseShopData(req.query, shopInfo), searchModel.getSearchData(searchParam)]).then(fResult => { | 178 | return Promise.all([listModel.getBaseShopData(req.query, shopInfo), searchModel.getSearchData(searchParam)]).then(fResult => { |
@@ -214,6 +214,10 @@ let search = (req, res, next) => { | @@ -214,6 +214,10 @@ let search = (req, res, next) => { | ||
214 | }); | 214 | }); |
215 | } | 215 | } |
216 | 216 | ||
217 | + if (uid) { | ||
218 | + params.uid = uid; | ||
219 | + } | ||
220 | + | ||
217 | saleModel.getSearchData(params, uid).then((result) => { | 221 | saleModel.getSearchData(params, uid).then((result) => { |
218 | let vipLevel = result[1].cur_level; | 222 | let vipLevel = result[1].cur_level; |
219 | let vipObj = {}; | 223 | let vipObj = {}; |
@@ -22,10 +22,11 @@ const list = (req, res, next) => { | @@ -22,10 +22,11 @@ const list = (req, res, next) => { | ||
22 | cartUrl: helpers.urlFormat('/cart/index/index') | 22 | cartUrl: helpers.urlFormat('/cart/index/index') |
23 | }, req.query); | 23 | }, req.query); |
24 | let title = ''; | 24 | let title = ''; |
25 | - let query = req.query.query; | 25 | + let query = (req.query.query || '').toString(); |
26 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 | 26 | let isQueryFirstClass = false; // 标识用户搜的是不是一级品类 |
27 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 | 27 | let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 |
28 | let domain = null; | 28 | let domain = null; |
29 | + let uid = req.user.uid || 0; | ||
29 | 30 | ||
30 | if (params.shop_id) { | 31 | if (params.shop_id) { |
31 | params.shopId = params.shop_id; | 32 | params.shopId = params.shop_id; |
@@ -52,6 +53,10 @@ const list = (req, res, next) => { | @@ -52,6 +53,10 @@ const list = (req, res, next) => { | ||
52 | query = query.toLowerCase(); | 53 | query = query.toLowerCase(); |
53 | } | 54 | } |
54 | 55 | ||
56 | + if (uid) { | ||
57 | + initialData.uid = uid; | ||
58 | + } | ||
59 | + | ||
55 | /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */ | 60 | /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */ |
56 | return Promise.all([ | 61 | return Promise.all([ |
57 | searchModel.getBrandDomain(query), | 62 | searchModel.getBrandDomain(query), |
@@ -183,16 +188,26 @@ let fuzzyDatas = (req, res, next) => { | @@ -183,16 +188,26 @@ let fuzzyDatas = (req, res, next) => { | ||
183 | * ajax 商品数据请求 | 188 | * ajax 商品数据请求 |
184 | */ | 189 | */ |
185 | const search = (req, res, next) => { | 190 | const search = (req, res, next) => { |
186 | - res.header('Access-Control-Allow-Origin', '*'); | 191 | + let allowOrigin = _.get(req, 'headers.origin', null) ? |
192 | + req.headers.origin : req.protocol + '://' + req.headers.host; | ||
193 | + | ||
194 | + res.setHeader('Access-Control-Allow-Origin', allowOrigin); | ||
195 | + res.setHeader('Access-Control-Allow-Credentials', 'true'); | ||
187 | 196 | ||
188 | let params = Object.assign({}, req.query); | 197 | let params = Object.assign({}, req.query); |
198 | + let uid = req.user.uid || 0; | ||
199 | + | ||
200 | + if (uid) { | ||
201 | + params.uid = uid; | ||
202 | + } | ||
189 | 203 | ||
190 | params.isApp = req.yoho.isApp; | 204 | params.isApp = req.yoho.isApp; |
191 | params.limit = 24; | 205 | params.limit = 24; |
206 | + | ||
192 | searchModel.getSearchData(params).then((result) => { | 207 | searchModel.getSearchData(params).then((result) => { |
193 | 208 | ||
194 | if (result && result.list && | 209 | if (result && result.list && |
195 | - parseInt(params.page) === 1 && parseInt(params.start) > 0) { | 210 | + parseInt(params.page, 10) === 1 && parseInt(params.start, 10) > 0) { |
196 | // 首屏渲染时,使用 'start' 参数裁减已渲染数据 | 211 | // 首屏渲染时,使用 'start' 参数裁减已渲染数据 |
197 | result.list = result.list.slice(params.start || 0); | 212 | result.list = result.list.slice(params.start || 0); |
198 | } | 213 | } |
@@ -126,11 +126,16 @@ const _getShopInfo = (shopId, uid) => { | @@ -126,11 +126,16 @@ const _getShopInfo = (shopId, uid) => { | ||
126 | * @param {int} shopId | 126 | * @param {int} shopId |
127 | */ | 127 | */ |
128 | const getShopIntro = (shopId, uid) => { | 128 | const getShopIntro = (shopId, uid) => { |
129 | - return api.get('', { | 129 | + let params = { |
130 | method: 'app.shops.getIntro', | 130 | method: 'app.shops.getIntro', |
131 | - shop_id: shopId, | ||
132 | - uid: uid | ||
133 | - }, {code: 200}).then(result => { | 131 | + shop_id: shopId |
132 | + }; | ||
133 | + | ||
134 | + if (uid) { | ||
135 | + params.uid = uid; | ||
136 | + } | ||
137 | + | ||
138 | + return api.get('', params, {code: 200}).then(result => { | ||
134 | return result && result.data; | 139 | return result && result.data; |
135 | }); | 140 | }); |
136 | }; | 141 | }; |
@@ -15,7 +15,7 @@ const cachePage = { | @@ -15,7 +15,7 @@ const cachePage = { | ||
15 | // 自定义频道 | 15 | // 自定义频道 |
16 | '/channel/:id.html': 1 * MINUTE, | 16 | '/channel/:id.html': 1 * MINUTE, |
17 | 17 | ||
18 | - //ajax获取频道页楼层 | 18 | + // ajax获取频道页楼层 |
19 | '/channel/getResourceContent': 30 * MINUTE, | 19 | '/channel/getResourceContent': 30 * MINUTE, |
20 | 20 | ||
21 | // 商品分类 | 21 | // 商品分类 |
@@ -30,10 +30,12 @@ const cachePage = { | @@ -30,10 +30,12 @@ const cachePage = { | ||
30 | // 店铺推荐 | 30 | // 店铺推荐 |
31 | '/product/detail/preference': 5 * MINUTE, | 31 | '/product/detail/preference': 5 * MINUTE, |
32 | '/product/detail/intro/:productskn': 15 * MINUTE, | 32 | '/product/detail/intro/:productskn': 15 * MINUTE, |
33 | + | ||
33 | // 店铺人气单品 | 34 | // 店铺人气单品 |
34 | '/product/new/shop/hotlist': 5 * MINUTE, | 35 | '/product/new/shop/hotlist': 5 * MINUTE, |
36 | + | ||
35 | // 店铺简介 | 37 | // 店铺简介 |
36 | - '/product/index/intro' : 15 * MINUTE, | 38 | + '/product/index/intro': 15 * MINUTE, |
37 | 39 | ||
38 | // 逛 | 40 | // 逛 |
39 | '/guang/': 1 * MINUTE, | 41 | '/guang/': 1 * MINUTE, |
@@ -49,17 +51,17 @@ const cachePage = { | @@ -49,17 +51,17 @@ const cachePage = { | ||
49 | // '/guang/plustar/brandinfo': 1 * MINUTE, | 51 | // '/guang/plustar/brandinfo': 1 * MINUTE, |
50 | '/guang/star': 1 * MINUTE, | 52 | '/guang/star': 1 * MINUTE, |
51 | 53 | ||
52 | - | ||
53 | // 领券中心 | 54 | // 领券中心 |
54 | '/activity/coupon/floor': 1 * MINUTE, | 55 | '/activity/coupon/floor': 1 * MINUTE, |
55 | 56 | ||
56 | // 商品列表 | 57 | // 商品列表 |
58 | + '/product/search/filter': 1 * MINUTE, | ||
59 | + /* 筛选默认须要添加uid参数 | ||
57 | '/product/list/index': 1 * MINUTE, | 60 | '/product/list/index': 1 * MINUTE, |
58 | '/product/index/index': 1 * MINUTE, | 61 | '/product/index/index': 1 * MINUTE, |
59 | '/product/index/brand': 1 * MINUTE, | 62 | '/product/index/brand': 1 * MINUTE, |
60 | - | ||
61 | - '/product/search/filter': 1 * MINUTE, | ||
62 | '/product/search/search': 1 * MINUTE, | 63 | '/product/search/search': 1 * MINUTE, |
64 | + */ | ||
63 | 65 | ||
64 | '/product/new': 1 * MINUTE, | 66 | '/product/new': 1 * MINUTE, |
65 | 67 |
@@ -76,7 +76,7 @@ module.exports = { | @@ -76,7 +76,7 @@ module.exports = { | ||
76 | port: '4444' // influxdb port | 76 | port: '4444' // influxdb port |
77 | }, | 77 | }, |
78 | console: { | 78 | console: { |
79 | - level: 'info', | 79 | + level: 'debug', |
80 | colorize: 'all', | 80 | colorize: 'all', |
81 | prettyPrint: true | 81 | prettyPrint: true |
82 | } | 82 | } |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | a.async = 1; | 12 | a.async = 1; |
13 | a.src = j; | 13 | a.src = j; |
14 | m.parentNode.insertBefore(a, m); | 14 | m.parentNode.insertBefore(a, m); |
15 | - }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.4/yas.js', '_yas')); | 15 | + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.5/yas.js', '_yas')); |
16 | 16 | ||
17 | var _hmt = _hmt || []; | 17 | var _hmt = _hmt || []; |
18 | 18 | ||
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | uid = uid === 0 ? '' : uid; | 56 | uid = uid === 0 ? '' : uid; |
57 | window._ozuid = uid; // 暴露ozuid | 57 | window._ozuid = uid; // 暴露ozuid |
58 | if (window._yas) { | 58 | if (window._yas) { |
59 | - window._yas(1 * new Date(), '2.2.2', 'yohobuy_m', uid, '', ''); | 59 | + window._yas(1 * new Date(), '2.2.5', 'yohobuy_m', uid, '', ''); |
60 | } | 60 | } |
61 | 61 | ||
62 | setTimeout(function() { | 62 | setTimeout(function() { |
@@ -406,7 +406,7 @@ function search(opt) { | @@ -406,7 +406,7 @@ function search(opt) { | ||
406 | if (nav.reload) { | 406 | if (nav.reload) { |
407 | page = 1; | 407 | page = 1; |
408 | } else if (nav.end) { | 408 | } else if (nav.end) { |
409 | - | 409 | + $('.search-divide').remove(); |
410 | // 不需要重新加载并且数据请求结束 | 410 | // 不需要重新加载并且数据请求结束 |
411 | return; | 411 | return; |
412 | } | 412 | } |
@@ -532,6 +532,9 @@ function search(opt) { | @@ -532,6 +532,9 @@ function search(opt) { | ||
532 | type: 'GET', | 532 | type: 'GET', |
533 | url: location.protocol + '//m.yohobuy.com/product/search/search', | 533 | url: location.protocol + '//m.yohobuy.com/product/search/search', |
534 | data: setting, | 534 | data: setting, |
535 | + xhrFields: { | ||
536 | + withCredentials: true | ||
537 | + }, | ||
535 | success: function(data) { | 538 | success: function(data) { |
536 | var num, | 539 | var num, |
537 | $container, | 540 | $container, |
@@ -580,7 +583,6 @@ function search(opt) { | @@ -580,7 +583,6 @@ function search(opt) { | ||
580 | 583 | ||
581 | if (data === '' || (data.list && data.list.length <= 0)) { | 584 | if (data === '' || (data.list && data.list.length <= 0)) { |
582 | nav.end = true; | 585 | nav.end = true; |
583 | - $('.search-divide').remove(); | ||
584 | if (nav.reload) { | 586 | if (nav.reload) { |
585 | if (data.total === 0) { | 587 | if (data.total === 0) { |
586 | $container.html(noResult); | 588 | $container.html(noResult); |
@@ -112,7 +112,6 @@ var defaultOpt = require('../common/query-param'); | @@ -112,7 +112,6 @@ var defaultOpt = require('../common/query-param'); | ||
112 | url: '/product/search/filter', | 112 | url: '/product/search/filter', |
113 | data: { | 113 | data: { |
114 | shop_id: $('.shopId').val(), | 114 | shop_id: $('.shopId').val(), |
115 | - type: 'default', | ||
116 | order: '0', | 115 | order: '0', |
117 | channel: defaultOpt.channel | 116 | channel: defaultOpt.channel |
118 | }, | 117 | }, |
@@ -385,6 +385,9 @@ function search(opt) { | @@ -385,6 +385,9 @@ function search(opt) { | ||
385 | type: 'GET', | 385 | type: 'GET', |
386 | url: location.protocol + '//m.yohobuy.com/product/search/search', | 386 | url: location.protocol + '//m.yohobuy.com/product/search/search', |
387 | data: setting, | 387 | data: setting, |
388 | + xhrFields: { | ||
389 | + withCredentials: true | ||
390 | + }, | ||
388 | success: function(data) { | 391 | success: function(data) { |
389 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', | 392 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', |
390 | num, | 393 | num, |
@@ -211,6 +211,9 @@ function getPageGoods(info) { | @@ -211,6 +211,9 @@ function getPageGoods(info) { | ||
211 | type: 'GET', | 211 | type: 'GET', |
212 | url: info.url, | 212 | url: info.url, |
213 | data: info.data, | 213 | data: info.data, |
214 | + xhrFields: { | ||
215 | + withCredentials: true | ||
216 | + }, | ||
214 | success: function(data) { | 217 | success: function(data) { |
215 | if (data === '' || (data.list && data.list.length <= 0)) { | 218 | if (data === '' || (data.list && data.list.length <= 0)) { |
216 | nav.end = true; | 219 | nav.end = true; |
@@ -52,6 +52,12 @@ const toArray = (obj) => { | @@ -52,6 +52,12 @@ const toArray = (obj) => { | ||
52 | const _sortListByField = (list, key, desc) => { | 52 | const _sortListByField = (list, key, desc) => { |
53 | let array = toArray(list); | 53 | let array = toArray(list); |
54 | 54 | ||
55 | + return array.sort(function(a, b) { | ||
56 | + a = a._key.split(',')[0] * 1; | ||
57 | + b = b._key.split(',')[0] * 1; | ||
58 | + return desc ? a < b : a > b; | ||
59 | + }); | ||
60 | +/* | ||
55 | array = array.sort((a, b) => { | 61 | array = array.sort((a, b) => { |
56 | let matchNumber = /([\d]+)/g; | 62 | let matchNumber = /([\d]+)/g; |
57 | 63 | ||
@@ -70,7 +76,7 @@ const _sortListByField = (list, key, desc) => { | @@ -70,7 +76,7 @@ const _sortListByField = (list, key, desc) => { | ||
70 | return numA < numB ? -1 : 1; | 76 | return numA < numB ? -1 : 1; |
71 | }); | 77 | }); |
72 | 78 | ||
73 | - return array; | 79 | + return array;*/ |
74 | }; | 80 | }; |
75 | 81 | ||
76 | /** | 82 | /** |
-
Please register or login to post a comment