merge hotfix/rele5.2
Showing
8 changed files
with
27 additions
and
18 deletions
@@ -55,7 +55,6 @@ const getRssArticle = (gender) => { | @@ -55,7 +55,6 @@ const getRssArticle = (gender) => { | ||
55 | resolve(result); | 55 | resolve(result); |
56 | } | 56 | } |
57 | }; | 57 | }; |
58 | - | ||
59 | return new Promise((resolve) => { | 58 | return new Promise((resolve) => { |
60 | artListFunc(0, article.data.list.artList.length, resolve); | 59 | artListFunc(0, article.data.list.artList.length, resolve); |
61 | }); | 60 | }); |
@@ -96,4 +95,4 @@ const _genIntro = (id) => { | @@ -96,4 +95,4 @@ const _genIntro = (id) => { | ||
96 | 95 | ||
97 | module.exports = { | 96 | module.exports = { |
98 | getRssArticle | 97 | getRssArticle |
99 | -}; | 98 | +}; |
@@ -11,11 +11,11 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model | @@ -11,11 +11,11 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
11 | const _ = require('lodash'); | 11 | const _ = require('lodash'); |
12 | 12 | ||
13 | const suggestData = (req, res, next) => { | 13 | const suggestData = (req, res, next) => { |
14 | + let uid = req.user.uid; | ||
14 | let udid = req.sessionID || 'yoho'; | 15 | let udid = req.sessionID || 'yoho'; |
15 | let page = req.query.page || 1; | 16 | let page = req.query.page || 1; |
16 | let limit = 10; | 17 | let limit = 10; |
17 | - | ||
18 | - suggestModel.suggestData(udid, page, limit).then((result) => { | 18 | + suggestModel.suggestData(uid, udid, page, limit).then((result) => { |
19 | 19 | ||
20 | res.render('suggest', { | 20 | res.render('suggest', { |
21 | module: 'home', | 21 | module: 'home', |
@@ -11,14 +11,13 @@ const serviceAPI = global.yoho.ServiceAPI; | @@ -11,14 +11,13 @@ const serviceAPI = global.yoho.ServiceAPI; | ||
11 | const camelCase = global.yoho.camelCase; | 11 | const camelCase = global.yoho.camelCase; |
12 | const _ = require('lodash'); | 12 | const _ = require('lodash'); |
13 | 13 | ||
14 | -const suggestData = (udid, page, limit) => { | 14 | +const suggestData = (uid, udid, page, limit) => { |
15 | 15 | ||
16 | return serviceAPI.get('suggest/api/v1/suggest/getList', { | 16 | return serviceAPI.get('suggest/api/v1/suggest/getList', { |
17 | udid: udid, | 17 | udid: udid, |
18 | page: page, | 18 | page: page, |
19 | limit: limit | 19 | limit: limit |
20 | }).then((result) => { | 20 | }).then((result) => { |
21 | - | ||
22 | if (result && result.code === 200 && result.data) { | 21 | if (result && result.code === 200 && result.data) { |
23 | _.forEach(result.data.list, function(data) { | 22 | _.forEach(result.data.list, function(data) { |
24 | 23 | ||
@@ -36,7 +35,6 @@ const suggestData = (udid, page, limit) => { | @@ -36,7 +35,6 @@ const suggestData = (udid, page, limit) => { | ||
36 | }; | 35 | }; |
37 | 36 | ||
38 | const upAndDown = (uid, udid, reliable, suggestId) => { | 37 | const upAndDown = (uid, udid, reliable, suggestId) => { |
39 | - | ||
40 | return serviceAPI.get('suggest/api/v1/suggest/is_reliable', { | 38 | return serviceAPI.get('suggest/api/v1/suggest/is_reliable', { |
41 | uid: uid, | 39 | uid: uid, |
42 | udid: udid, | 40 | udid: udid, |
@@ -176,12 +176,12 @@ exports.consults = (req, res, next) => { | @@ -176,12 +176,12 @@ exports.consults = (req, res, next) => { | ||
176 | if (!req.query.product_id) { | 176 | if (!req.query.product_id) { |
177 | return next(); | 177 | return next(); |
178 | } | 178 | } |
179 | - | 179 | + let uid = req.user.uid || 0; |
180 | let headerData = headerModel.setNav({ | 180 | let headerData = headerModel.setNav({ |
181 | navTitle: '购买咨询' | 181 | navTitle: '购买咨询' |
182 | }); | 182 | }); |
183 | 183 | ||
184 | - detailRelated.consults(req.query).then((result) => { | 184 | + detailRelated.consults(req.query, uid).then((result) => { |
185 | res.render('detail/consults', Object.assign({ | 185 | res.render('detail/consults', Object.assign({ |
186 | title: '购买咨询', | 186 | title: '购买咨询', |
187 | pageHeader: headerData, | 187 | pageHeader: headerData, |
@@ -253,8 +253,7 @@ exports.consultsubmit = (req, res, next) => { | @@ -253,8 +253,7 @@ exports.consultsubmit = (req, res, next) => { | ||
253 | return res.json(data); | 253 | return res.json(data); |
254 | } | 254 | } |
255 | 255 | ||
256 | - detailRelated.addConsult(req.user.uid, req.body.product_id, req.body.content).then((result) => { | ||
257 | - | 256 | + return detailRelated.addConsult(req.user.uid, req.body.product_id, req.body.content).then((result) => { |
258 | if (result) { | 257 | if (result) { |
259 | Object.assign(data, result); | 258 | Object.assign(data, result); |
260 | } | 259 | } |
@@ -64,12 +64,13 @@ const _formatConsultsList = (data) => { | @@ -64,12 +64,13 @@ const _formatConsultsList = (data) => { | ||
64 | * @limit {[number]} 每页咨询数量 | 64 | * @limit {[number]} 每页咨询数量 |
65 | * @return {[object]} | 65 | * @return {[object]} |
66 | */ | 66 | */ |
67 | -const getConsults = (id, page, limit) => { | 67 | +const getConsults = (id, page, limit, uid) => { |
68 | let params = { | 68 | let params = { |
69 | method: 'app.consult.li', | 69 | method: 'app.consult.li', |
70 | product_id: id, | 70 | product_id: id, |
71 | page: page ? page : 1, | 71 | page: page ? page : 1, |
72 | - limit: limit ? limit : 300 | 72 | + limit: limit ? limit : 300, |
73 | + uid | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | return api.get('', params, { | 76 | return api.get('', params, { |
@@ -160,10 +161,10 @@ let comments = (params) => { | @@ -160,10 +161,10 @@ let comments = (params) => { | ||
160 | * @params {[object]} 查询参数 | 161 | * @params {[object]} 查询参数 |
161 | * @return {[object]} | 162 | * @return {[object]} |
162 | */ | 163 | */ |
163 | -let consults = (params) => { | 164 | +let consults = (params, uid) => { |
164 | return api.all([ | 165 | return api.all([ |
165 | _getCommonConsult(), | 166 | _getCommonConsult(), |
166 | - getConsults(params.product_id, 1, 60) | 167 | + getConsults(params.product_id, 1, 60, uid) |
167 | ]).then(result => { | 168 | ]).then(result => { |
168 | let data = { | 169 | let data = { |
169 | link: `/product/detail/consultform?product_id=${params.product_id}` | 170 | link: `/product/detail/consultform?product_id=${params.product_id}` |
@@ -76,7 +76,9 @@ if (navtabHammer) { | @@ -76,7 +76,9 @@ if (navtabHammer) { | ||
76 | 76 | ||
77 | if (gotoConsultHammer) { | 77 | if (gotoConsultHammer) { |
78 | gotoConsultHammer.on('tap', function() { | 78 | gotoConsultHammer.on('tap', function() { |
79 | - location.href = $(gotoConsultEle).find('a').attr('href'); | 79 | + var link = $(gotoConsultEle).find('a').attr('href'); |
80 | + link += (link.indexOf('?') >=0 ? '&' : '?') + 'from=' + encodeURIComponent(location.href); | ||
81 | + location.href = link; | ||
80 | }); | 82 | }); |
81 | } | 83 | } |
82 | 84 |
@@ -32,6 +32,11 @@ $content.on('focus', function() { | @@ -32,6 +32,11 @@ $content.on('focus', function() { | ||
32 | $content.val('请输入咨询内容'); | 32 | $content.val('请输入咨询内容'); |
33 | } | 33 | } |
34 | }); | 34 | }); |
35 | +var getUrlParam = function (paramName) { | ||
36 | + var reg = "[\\?|\\&]+" + paramName + "=([^&]*)[^&]?"; | ||
37 | + var exp = (window.location.href + "").match(reg); | ||
38 | + return exp ? exp[1] : ""; | ||
39 | +} | ||
35 | 40 | ||
36 | // 提交表单请求 | 41 | // 提交表单请求 |
37 | $consultForm.on('submit', function() { | 42 | $consultForm.on('submit', function() { |
@@ -68,7 +73,12 @@ $consultForm.on('submit', function() { | @@ -68,7 +73,12 @@ $consultForm.on('submit', function() { | ||
68 | } else { | 73 | } else { |
69 | tip.show('提交成功~'); | 74 | tip.show('提交成功~'); |
70 | setTimeout(function() { | 75 | setTimeout(function() { |
71 | - window.history.go(-1); | 76 | + var from = getUrlParam('from'); |
77 | + if (from) { | ||
78 | + window.location = decodeURIComponent(from); | ||
79 | + } else { | ||
80 | + window.history.go(-1); | ||
81 | + } | ||
72 | }, 3000); | 82 | }, 3000); |
73 | } | 83 | } |
74 | }).fail(function() { | 84 | }).fail(function() { |
@@ -127,7 +127,7 @@ function render(data) { | @@ -127,7 +127,7 @@ function render(data) { | ||
127 | $('#limitProductCode').val(data.cartInfo.limitProductCode).removeClass(dbClass); | 127 | $('#limitProductCode').val(data.cartInfo.limitProductCode).removeClass(dbClass); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | - if (data.isCollect) { | 130 | + if (data.isCollect === true) { |
131 | $('#likeBtn').addClass('liked'); | 131 | $('#likeBtn').addClass('liked'); |
132 | } | 132 | } |
133 | if (data.tickets) { | 133 | if (data.tickets) { |
-
Please register or login to post a comment