Merge remote-tracking branch 'origin/release/5.1' into release/5.1
Showing
6 changed files
with
115 additions
and
77 deletions
@@ -27,10 +27,12 @@ const editor = (req, res, next) => { | @@ -27,10 +27,12 @@ const editor = (req, res, next) => { | ||
27 | id = req.query.id || 0, | 27 | id = req.query.id || 0, |
28 | title = '编辑简介', | 28 | title = '编辑简介', |
29 | parameter = {}, | 29 | parameter = {}, |
30 | - isApp = req.query.app_version || req.query.appVersion || false, | 30 | + isApp = req.yoho.isApp, |
31 | gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1; | 31 | gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1; |
32 | 32 | ||
33 | - if (isApp === false) { | 33 | + if (isApp) { |
34 | + uid = req.query.uid; | ||
35 | + } else { | ||
34 | parameter = { | 36 | parameter = { |
35 | pageHeader: headerModel.setNav({ | 37 | pageHeader: headerModel.setNav({ |
36 | navTitle: title | 38 | navTitle: title |
@@ -76,7 +78,11 @@ const editor = (req, res, next) => { | @@ -76,7 +78,11 @@ const editor = (req, res, next) => { | ||
76 | const pageData = (req, res, next) => { | 78 | const pageData = (req, res, next) => { |
77 | /* 判断是不是AJAX请求 */ | 79 | /* 判断是不是AJAX请求 */ |
78 | if (!req.xhr) { | 80 | if (!req.xhr) { |
79 | - res.json({ code: 400, message: '非法请求', data: '' }); | 81 | + res.json({ |
82 | + code: 400, | ||
83 | + message: '非法请求', | ||
84 | + data: '' | ||
85 | + }); | ||
80 | return; | 86 | return; |
81 | } | 87 | } |
82 | 88 | ||
@@ -90,15 +96,23 @@ const pageData = (req, res, next) => { | @@ -90,15 +96,23 @@ const pageData = (req, res, next) => { | ||
90 | isTab = req.query.isTab || false, | 96 | isTab = req.query.isTab || false, |
91 | showAuthor = false; | 97 | showAuthor = false; |
92 | 98 | ||
93 | - let uid = req.user.uid, | 99 | + let uid = req.user.uid || req.query.uid, |
94 | udid = req.sessionID; | 100 | udid = req.sessionID; |
95 | 101 | ||
96 | if (!stringProcess.isNumeric(sortId)) { | 102 | if (!stringProcess.isNumeric(sortId)) { |
97 | - res.json({ code: 400, message: '参数错误', data: '' }); | 103 | + res.json({ |
104 | + code: 400, | ||
105 | + message: '参数错误', | ||
106 | + data: '' | ||
107 | + }); | ||
98 | return; | 108 | return; |
99 | } | 109 | } |
100 | if (!page && !isNaN(page)) { | 110 | if (!page && !isNaN(page)) { |
101 | - res.json({ code: 400, message: '参数错误', data: '' }); | 111 | + res.json({ |
112 | + code: 400, | ||
113 | + message: '参数错误', | ||
114 | + data: '' | ||
115 | + }); | ||
102 | return; | 116 | return; |
103 | } | 117 | } |
104 | if (!authorId && isNaN(authorId)) { | 118 | if (!authorId && isNaN(authorId)) { |
@@ -106,9 +120,15 @@ const pageData = (req, res, next) => { | @@ -106,9 +120,15 @@ const pageData = (req, res, next) => { | ||
106 | } | 120 | } |
107 | return indexModel.getPageData(gender, sortId, uid, udid, page, tag, authorId, isApp, showAuthor, isTab).then(data => { | 121 | return indexModel.getPageData(gender, sortId, uid, udid, page, tag, authorId, isApp, showAuthor, isTab).then(data => { |
108 | if (data) { | 122 | if (data) { |
109 | - res.render('index/page', Object.assign(data, { layout: false })); | 123 | + res.render('index/page', Object.assign(data, { |
124 | + layout: false | ||
125 | + })); | ||
110 | } else { | 126 | } else { |
111 | - res.json({ code: 400, message: '', data: '' }); | 127 | + res.json({ |
128 | + code: 400, | ||
129 | + message: '', | ||
130 | + data: '' | ||
131 | + }); | ||
112 | } | 132 | } |
113 | }).catch(next); | 133 | }).catch(next); |
114 | 134 | ||
@@ -134,7 +154,7 @@ const index = (req, res, next) => { | @@ -134,7 +154,7 @@ const index = (req, res, next) => { | ||
134 | }; | 154 | }; |
135 | 155 | ||
136 | let param = { | 156 | let param = { |
137 | - uid: req.user.uid, | 157 | + uid: req.user.uid || req.query.uid, |
138 | 158 | ||
139 | udid: req.user.udid, | 159 | udid: req.user.udid, |
140 | 160 | ||
@@ -172,7 +192,7 @@ const tag = (req, res, next) => { | @@ -172,7 +192,7 @@ const tag = (req, res, next) => { | ||
172 | tag: req.query.query, | 192 | tag: req.query.query, |
173 | isApp: req.query.app_version || req.query.appVersion || false, | 193 | isApp: req.query.app_version || req.query.appVersion || false, |
174 | gender: req.query.gender || '1,3', | 194 | gender: req.query.gender || '1,3', |
175 | - uid: req.user.uid || 0, | 195 | + uid: req.user.uid || req.query.uid || 0, |
176 | udid: req.sessionID, | 196 | udid: req.sessionID, |
177 | type: req.query.type || 0 | 197 | type: req.query.type || 0 |
178 | 198 | ||
@@ -203,7 +223,7 @@ const listDynamicData = (req, res) => { | @@ -203,7 +223,7 @@ const listDynamicData = (req, res) => { | ||
203 | type = req.query.type; | 223 | type = req.query.type; |
204 | 224 | ||
205 | if (req.user.uid) { | 225 | if (req.user.uid) { |
206 | - other.uid = req.user.uid; | 226 | + other.uid = req.user.uid || req.query.uid; |
207 | } | 227 | } |
208 | 228 | ||
209 | if (query) { | 229 | if (query) { |
@@ -227,7 +247,7 @@ const listDynamicData = (req, res) => { | @@ -227,7 +247,7 @@ const listDynamicData = (req, res) => { | ||
227 | const detailDynamicData = (req, res) => { | 247 | const detailDynamicData = (req, res) => { |
228 | 248 | ||
229 | let id = req.query.id, | 249 | let id = req.query.id, |
230 | - uid = req.user.uid, | 250 | + uid = req.user.uid || req.query.uid, |
231 | udid = req.sessionID; | 251 | udid = req.sessionID; |
232 | 252 | ||
233 | indexModel.getDynamicDataById(id, uid, udid).then((ret) => { | 253 | indexModel.getDynamicDataById(id, uid, udid).then((ret) => { |
@@ -244,4 +264,4 @@ module.exports = { | @@ -244,4 +264,4 @@ module.exports = { | ||
244 | tag, | 264 | tag, |
245 | listDynamicData, | 265 | listDynamicData, |
246 | detailDynamicData | 266 | detailDynamicData |
247 | -}; | 267 | +}; |
@@ -51,8 +51,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -51,8 +51,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
51 | src: helpers.image(imgs[0].src, 315, 420) | 51 | src: helpers.image(imgs[0].src, 315, 420) |
52 | }, { | 52 | }, { |
53 | src: helpers.image(imgs[1].src, 315, 420) | 53 | src: helpers.image(imgs[1].src, 315, 420) |
54 | - } | ||
55 | - ]; | 54 | + }]; |
56 | contents.push(build); | 55 | contents.push(build); |
57 | joinContentFunc(++i, len); | 56 | joinContentFunc(++i, len); |
58 | 57 | ||
@@ -80,7 +79,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -80,7 +79,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
80 | for (let o = 0; o < product.data.product_list.length; o++) { | 79 | for (let o = 0; o < product.data.product_list.length; o++) { |
81 | let goods = product.data.product_list[o]; | 80 | let goods = product.data.product_list[o]; |
82 | 81 | ||
83 | - // 最多显示4个 | 82 | + // 最多显示4个 |
84 | if (o > 3) { | 83 | if (o > 3) { |
85 | break; | 84 | break; |
86 | } | 85 | } |
@@ -94,7 +93,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -94,7 +93,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
94 | }); | 93 | }); |
95 | } | 94 | } |
96 | 95 | ||
97 | - // 多个商品 | 96 | + // 多个商品 |
98 | if (product.data.product_list.length && (product.data.product_list.length > 1)) { | 97 | if (product.data.product_list.length && (product.data.product_list.length > 1)) { |
99 | build.relatedReco = reco; | 98 | build.relatedReco = reco; |
100 | } else if (product.data.product_list.length === 1) { // 单个商品 | 99 | } else if (product.data.product_list.length === 1) { // 单个商品 |
@@ -249,13 +248,17 @@ const index = (req, res, next) => { | @@ -249,13 +248,17 @@ const index = (req, res, next) => { | ||
249 | parameter = {}, | 248 | parameter = {}, |
250 | title = '逛'; | 249 | title = '逛'; |
251 | 250 | ||
252 | - // pagecache 前端做 | ||
253 | - // userAgent = req.get('User-Agent'), | ||
254 | - // isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问 | 251 | + // pagecache 前端做 |
252 | + // userAgent = req.get('User-Agent'), | ||
253 | + // isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问 | ||
255 | 254 | ||
256 | // 判断参数是否有效, 无效会跳转到错误页面 | 255 | // 判断参数是否有效, 无效会跳转到错误页面 |
257 | if (!stringProcess.isNumeric(id)) { | 256 | if (!stringProcess.isNumeric(id)) { |
258 | - res.json({ code: 400, message: '非法请求', data: '' }); | 257 | + res.json({ |
258 | + code: 400, | ||
259 | + message: '非法请求', | ||
260 | + data: '' | ||
261 | + }); | ||
259 | return; | 262 | return; |
260 | } | 263 | } |
261 | parameter = { | 264 | parameter = { |
@@ -297,7 +300,6 @@ const index = (req, res, next) => { | @@ -297,7 +300,6 @@ const index = (req, res, next) => { | ||
297 | // guang双头部的问题 20160601 | 300 | // guang双头部的问题 20160601 |
298 | // 正确的URL | 301 | // 正确的URL |
299 | data.guang.author.url = helpers.https(`${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${detail.getAuthor.url}"}}`); | 302 | data.guang.author.url = helpers.https(`${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${detail.getAuthor.url}"}}`); |
300 | - | ||
301 | // 错误的URL | 303 | // 错误的URL |
302 | // data.guang.author.url = helpers.https(`${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${detail.getAuthor.author_id}"},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${helpers.urlFormat('/author/index', {}, 'guang')}"}}`); | 304 | // data.guang.author.url = helpers.https(`${detail.getAuthor.url}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${detail.getAuthor.author_id}"},"share":"","id":${detail.getAuthor.author_id},"type":0,"islogin":"N","url":"${helpers.urlFormat('/author/index', {}, 'guang')}"}}`); |
303 | } | 305 | } |
@@ -340,7 +342,6 @@ const index = (req, res, next) => { | @@ -340,7 +342,6 @@ const index = (req, res, next) => { | ||
340 | data.description = detail.getArticle.article_summary; | 342 | data.description = detail.getArticle.article_summary; |
341 | data.description_more = true; | 343 | data.description_more = true; |
342 | } | 344 | } |
343 | - | ||
344 | // 标识有微信分享 | 345 | // 标识有微信分享 |
345 | data.hasWxShare = true; | 346 | data.hasWxShare = true; |
346 | res.render('info/index', Object.assign({ | 347 | res.render('info/index', Object.assign({ |
@@ -369,7 +370,11 @@ const mini = (req, res, next) => { | @@ -369,7 +370,11 @@ const mini = (req, res, next) => { | ||
369 | 370 | ||
370 | // 判断参数是否有效, 无效会跳转到错误页面 | 371 | // 判断参数是否有效, 无效会跳转到错误页面 |
371 | if (!stringProcess.isNumeric(id)) { | 372 | if (!stringProcess.isNumeric(id)) { |
372 | - res.json({ code: 400, message: '非法请求', data: '' }); | 373 | + res.json({ |
374 | + code: 400, | ||
375 | + message: '非法请求', | ||
376 | + data: '' | ||
377 | + }); | ||
373 | return; | 378 | return; |
374 | } | 379 | } |
375 | 380 | ||
@@ -440,7 +445,11 @@ const foryoho = (req, res, next) => { | @@ -440,7 +445,11 @@ const foryoho = (req, res, next) => { | ||
440 | 445 | ||
441 | // 判断参数是否有效, 无效会跳转到错误页面 | 446 | // 判断参数是否有效, 无效会跳转到错误页面 |
442 | if (!stringProcess.isNumeric(id)) { | 447 | if (!stringProcess.isNumeric(id)) { |
443 | - res.json({ code: 400, message: '非法请求', data: '' }); | 448 | + res.json({ |
449 | + code: 400, | ||
450 | + message: '非法请求', | ||
451 | + data: '' | ||
452 | + }); | ||
444 | return; | 453 | return; |
445 | } | 454 | } |
446 | 455 | ||
@@ -492,4 +501,4 @@ module.exports = { | @@ -492,4 +501,4 @@ module.exports = { | ||
492 | index, | 501 | index, |
493 | mini, | 502 | mini, |
494 | foryoho | 503 | foryoho |
495 | -}; | 504 | +}; |
@@ -166,7 +166,9 @@ const getArticle = (param) => { | @@ -166,7 +166,9 @@ const getArticle = (param) => { | ||
166 | 166 | ||
167 | let page = param.page ? param.page : 1; | 167 | let page = param.page ? param.page : 1; |
168 | 168 | ||
169 | - Object.assign(param, { page: page }); | 169 | + Object.assign(param, { |
170 | + page: page | ||
171 | + }); | ||
170 | 172 | ||
171 | return api.all([ | 173 | return api.all([ |
172 | _category(), | 174 | _category(), |
@@ -182,7 +184,7 @@ const getArticle = (param) => { | @@ -182,7 +184,7 @@ const getArticle = (param) => { | ||
182 | }; | 184 | }; |
183 | 185 | ||
184 | // 顶部的分类列表 | 186 | // 顶部的分类列表 |
185 | - let curIndex = 0;// 当前tab顺序 | 187 | + let curIndex = 0; // 当前tab顺序 |
186 | 188 | ||
187 | let indexTmp = 0; | 189 | let indexTmp = 0; |
188 | 190 | ||
@@ -265,7 +267,9 @@ const getTagEditor = (param) => { | @@ -265,7 +267,9 @@ const getTagEditor = (param) => { | ||
265 | 267 | ||
266 | let page = param.page ? param.page : 1; | 268 | let page = param.page ? param.page : 1; |
267 | 269 | ||
268 | - Object.assign(param, { page: page }); | 270 | + Object.assign(param, { |
271 | + page: page | ||
272 | + }); | ||
269 | 273 | ||
270 | return api.all([ | 274 | return api.all([ |
271 | _article(param) | 275 | _article(param) |
@@ -285,10 +289,8 @@ const getTagEditor = (param) => { | @@ -285,10 +289,8 @@ const getTagEditor = (param) => { | ||
285 | let inf = []; | 289 | let inf = []; |
286 | 290 | ||
287 | let infoList = result[0].data.list.artList; | 291 | let infoList = result[0].data.list.artList; |
288 | - | ||
289 | infoList.forEach(val => { | 292 | infoList.forEach(val => { |
290 | - val.url = helpers.https(`${val.url}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":"","type":0,"islogin":"N","url":"${val.url}"}}`); | ||
291 | - inf.push(guangProcess.formatArticle(val, true, false, true)); | 293 | + inf.push(guangProcess.formatArticle(val, true, param.isApp, true)); |
292 | }); | 294 | }); |
293 | 295 | ||
294 | resu.guang.infos = inf; | 296 | resu.guang.infos = inf; |
@@ -333,7 +335,9 @@ const getDynamicDataByIds = (ids, udid, other) => { | @@ -333,7 +335,9 @@ const getDynamicDataByIds = (ids, udid, other) => { | ||
333 | }); | 335 | }); |
334 | } | 336 | } |
335 | 337 | ||
336 | - return serviceAPI.get('guang/api/v6/article/getSimpleArticleList', params, {cache: true}); | 338 | + return serviceAPI.get('guang/api/v6/article/getSimpleArticleList', params, { |
339 | + cache: true | ||
340 | + }); | ||
337 | }; | 341 | }; |
338 | 342 | ||
339 | /** | 343 | /** |
@@ -358,4 +362,4 @@ module.exports = { | @@ -358,4 +362,4 @@ module.exports = { | ||
358 | getTagEditor, | 362 | getTagEditor, |
359 | getDynamicDataByIds, | 363 | getDynamicDataByIds, |
360 | getDynamicDataById | 364 | getDynamicDataById |
361 | -}; | 365 | +}; |
@@ -40,11 +40,11 @@ const packageData = (id, isApp) => { | @@ -40,11 +40,11 @@ const packageData = (id, isApp) => { | ||
40 | cache: true | 40 | cache: true |
41 | }).then(data => { | 41 | }).then(data => { |
42 | // 接口要判断一下返回状态是否成功 | 42 | // 接口要判断一下返回状态是否成功 |
43 | - if (data === '' && data.code !== 200) { | 43 | + if (!data || data.code !== 200) { |
44 | result.code = 400; | 44 | result.code = 400; |
45 | return result; | 45 | return result; |
46 | } | 46 | } |
47 | - let article = data.data; | 47 | + let article = data.data || {}; |
48 | 48 | ||
49 | result.getArticle = article; | 49 | result.getArticle = article; |
50 | 50 | ||
@@ -136,7 +136,9 @@ const packageData = (id, isApp) => { | @@ -136,7 +136,9 @@ const packageData = (id, isApp) => { | ||
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | - getArticleContent.splice(preCount, 0, {weixinPublic: datas[4].data}); | 139 | + getArticleContent.splice(preCount, 0, { |
140 | + weixinPublic: datas[4].data | ||
141 | + }); | ||
140 | } | 142 | } |
141 | if (datas[0]) { | 143 | if (datas[0]) { |
142 | result.getAuthor = datas[0].data; | 144 | result.getAuthor = datas[0].data; |
@@ -177,4 +179,4 @@ const intro = (id) => { | @@ -177,4 +179,4 @@ const intro = (id) => { | ||
177 | module.exports = { | 179 | module.exports = { |
178 | packageData, | 180 | packageData, |
179 | intro | 181 | intro |
180 | -}; | 182 | +}; |
@@ -146,39 +146,42 @@ function initInfosEvt($container) { | @@ -146,39 +146,42 @@ function initInfosEvt($container) { | ||
146 | // APP收藏 | 146 | // APP收藏 |
147 | $btn = $this.closest('.collect-btn'); | 147 | $btn = $this.closest('.collect-btn'); |
148 | if ($btn.length > 0) { | 148 | if ($btn.length > 0) { |
149 | - e.preventDefault(); | ||
150 | - if ($btn.hasClass('collected')) { | ||
151 | - opt = 'cancel'; | ||
152 | - } | ||
153 | - | ||
154 | - $info = $this.closest('.guang-info'); | 149 | + var uid = getUrlParam('uid'); |
150 | + if (uid) { | ||
151 | + e.preventDefault(); | ||
152 | + if ($btn.hasClass('collected')) { | ||
153 | + opt = 'cancel'; | ||
154 | + } | ||
155 | 155 | ||
156 | - if (getUrlParam('yh_channel')) { | ||
157 | - yhChannel = getUrlParam('yh_channel'); | ||
158 | - } | 156 | + $info = $this.closest('.guang-info'); |
159 | 157 | ||
160 | - $.ajax({ | ||
161 | - type: 'POST', | ||
162 | - url: '/guang/opt/collectArticle', | ||
163 | - data: { | ||
164 | - id: $info.data('id'), | ||
165 | - opt: opt, | ||
166 | - yh_channel: yhChannel, | ||
167 | - uid: getUrlParam('uid') | ||
168 | - }, | ||
169 | - success: function(data) { | ||
170 | - if (data.code && data.code === 200) { | 158 | + if (getUrlParam('yh_channel')) { |
159 | + yhChannel = getUrlParam('yh_channel'); | ||
160 | + } | ||
171 | 161 | ||
172 | - // 切换收藏状态 | ||
173 | - $btn.toggleClass('collected'); | ||
174 | - } else { | ||
175 | - tip.show(data.message); | 162 | + $.ajax({ |
163 | + type: 'POST', | ||
164 | + url: '/guang/opt/collectArticle', | ||
165 | + data: { | ||
166 | + id: $info.data('id'), | ||
167 | + opt: opt, | ||
168 | + yh_channel: yhChannel, | ||
169 | + uid: uid | ||
170 | + }, | ||
171 | + success: function(data) { | ||
172 | + if (data.code && data.code === 200) { | ||
173 | + | ||
174 | + // 切换收藏状态 | ||
175 | + $btn.toggleClass('collected'); | ||
176 | + } else { | ||
177 | + tip.show(data.message); | ||
178 | + } | ||
179 | + }, | ||
180 | + error: function() { | ||
181 | + tip.show('网络断开连接了~'); | ||
176 | } | 182 | } |
177 | - }, | ||
178 | - error: function() { | ||
179 | - tip.show('网络断开连接了~'); | ||
180 | - } | ||
181 | - }); | 183 | + }); |
184 | + } | ||
182 | } | 185 | } |
183 | }); | 186 | }); |
184 | 187 | ||
@@ -251,9 +254,9 @@ function loadMore($container, opt, url) { | @@ -251,9 +254,9 @@ function loadMore($container, opt, url) { | ||
251 | if (opt.page === 1) { | 254 | if (opt.page === 1) { |
252 | loading.hideLoadingMask(); | 255 | loading.hideLoadingMask(); |
253 | 256 | ||
254 | - $loading.removeClass('hide');// 显示空屏加载时hide的隐藏 | 257 | + $loading.removeClass('hide'); // 显示空屏加载时hide的隐藏 |
255 | 258 | ||
256 | - window.rePosFooter();// 插入内容后重新计算底部位置 | 259 | + window.rePosFooter(); // 插入内容后重新计算底部位置 |
257 | } | 260 | } |
258 | 261 | ||
259 | opt.page++; | 262 | opt.page++; |
@@ -275,4 +278,4 @@ exports.mySwiper = mySwiper; | @@ -275,4 +278,4 @@ exports.mySwiper = mySwiper; | ||
275 | exports.initSwiper = initSwiper; | 278 | exports.initSwiper = initSwiper; |
276 | exports.initInfosEvt = initInfosEvt; | 279 | exports.initInfosEvt = initInfosEvt; |
277 | exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis; | 280 | exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis; |
278 | -exports.loadMore = loadMore; | 281 | +exports.loadMore = loadMore; |
@@ -84,9 +84,9 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr | @@ -84,9 +84,9 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr | ||
84 | let collectUrl = 'javascript:;'; // 根据用户是否登录做处理的链接 | 84 | let collectUrl = 'javascript:;'; // 根据用户是否登录做处理的链接 |
85 | 85 | ||
86 | if (!uid) { | 86 | if (!uid) { |
87 | - let playUrlEncode = originUrl.replace(/\//g, '\\/'); | 87 | + let playUrlEncode = originUrl.replace(/\//g, '\\\/'); |
88 | 88 | ||
89 | - collectUrl = `${originUrl}?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${playUrlEncode}","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}`; | 89 | + collectUrl = `${originUrl}?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:${playUrlEncode}","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}`; |
90 | } | 90 | } |
91 | result.collect.url = collectUrl; | 91 | result.collect.url = collectUrl; |
92 | } else { // 点赞 | 92 | } else { // 点赞 |
@@ -110,7 +110,7 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr | @@ -110,7 +110,7 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryStr | ||
110 | // 编辑人员 app跳转url处理 20160601 | 110 | // 编辑人员 app跳转url处理 20160601 |
111 | let isLogin = uid ? true : false; | 111 | let isLogin = uid ? true : false; |
112 | 112 | ||
113 | - articleData.author.url = `${helpers.https(articleData.author.url)}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${articleData.author.author_id}"},"share":"","id":${articleData.author.author_id},"type":0,"islogin":"${isLogin}","url":"https:${helpers.urlFormat('/author/index', {uid: uid}, 'guang')}"}}&uid=${uid}`; | 113 | + articleData.author.url = `${helpers.https(articleData.author.url)}&openby:yohobuy={"action":"go.h5","params":{"param":{},"share":"","id":${articleData.author.author_id},"type":0,"islogin":"${isLogin}","url":"${articleData.author.url}"}}`; |
114 | result.author = articleData.author; | 114 | result.author = articleData.author; |
115 | if (result.author.avatar) { | 115 | if (result.author.avatar) { |
116 | result.author.avatar = result.author.avatar.replace('http://', '//'); | 116 | result.author.avatar = result.author.avatar.replace('http://', '//'); |
@@ -282,8 +282,8 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | @@ -282,8 +282,8 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | ||
282 | if (showTags) { | 282 | if (showTags) { |
283 | result.tags = { | 283 | result.tags = { |
284 | is_new: showNew && productData.is_new === 'Y', // 新品 | 284 | is_new: showNew && productData.is_new === 'Y', // 新品 |
285 | - is_discount: showSale && productData.is_discount === 'Y', // 在售 | ||
286 | - is_limited: productData.is_limited && productData.is_limited === 'Y', // 限量 | 285 | + is_discount: showSale && productData.is_discount === 'Y', // 在售 |
286 | + is_limited: productData.is_limited && productData.is_limited === 'Y', // 限量 | ||
287 | is_yohood: productData.is_yohood && productData.is_yohood === 'Y', // YOHOOD | 287 | is_yohood: productData.is_yohood && productData.is_yohood === 'Y', // YOHOOD |
288 | midYear: productData.midear && productData.midear === 'Y', // 年中 | 288 | midYear: productData.midear && productData.midear === 'Y', // 年中 |
289 | yearEnd: productData.yearnd && productData.yearnd === 'Y', // 年末 | 289 | yearEnd: productData.yearnd && productData.yearnd === 'Y', // 年末 |
@@ -294,7 +294,7 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | @@ -294,7 +294,7 @@ const formatProduct = (productData, showTags, showNew, showSale, width, height, | ||
294 | if (result.is_soon_sold_out && result.tags.is_discount) { | 294 | if (result.is_soon_sold_out && result.tags.is_discount) { |
295 | result.tags.is_new = false; | 295 | result.tags.is_new = false; |
296 | } else if (result.tags.is_discount && | 296 | } else if (result.tags.is_discount && |
297 | - (result.tags.is_new || result.tags.is_limited || result.tags.is_yohood || result.tags.is_advance)// 打折与其它组合则隐藏打折 | 297 | + (result.tags.is_new || result.tags.is_limited || result.tags.is_yohood || result.tags.is_advance) // 打折与其它组合则隐藏打折 |
298 | ) { | 298 | ) { |
299 | result.tags.is_discount = false; | 299 | result.tags.is_discount = false; |
300 | } else if (result.tags.is_yohood && result.tags.is_new) { // YOHOOD和新品组合显示YOHOOD | 300 | } else if (result.tags.is_yohood && result.tags.is_new) { // YOHOOD和新品组合显示YOHOOD |
@@ -312,4 +312,4 @@ module.exports = { | @@ -312,4 +312,4 @@ module.exports = { | ||
312 | getFilterUrl, | 312 | getFilterUrl, |
313 | formatProduct, | 313 | formatProduct, |
314 | getProductIcon | 314 | getProductIcon |
315 | -}; | 315 | +}; |
-
Please register or login to post a comment