Merge branch 'feature/openapp' into release/5.7
Showing
8 changed files
with
69 additions
and
1 deletions
@@ -58,6 +58,9 @@ exports.index = (req, res, next) => { | @@ -58,6 +58,9 @@ exports.index = (req, res, next) => { | ||
58 | break; | 58 | break; |
59 | } | 59 | } |
60 | 60 | ||
61 | + // 唤起 APP 的路径 | ||
62 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"url":"http://guang.m.yohobuy.com${req.path}","param":${JSON.stringify(req.query)}}}`; | ||
63 | + | ||
61 | plusstarModel.getAllChannels({ | 64 | plusstarModel.getAllChannels({ |
62 | gender: gender, | 65 | gender: gender, |
63 | app_type: 0 | 66 | app_type: 0 |
@@ -45,6 +45,8 @@ const getListData = (req, res, next) => { | @@ -45,6 +45,8 @@ const getListData = (req, res, next) => { | ||
45 | }); | 45 | }); |
46 | }); | 46 | }); |
47 | 47 | ||
48 | + // 唤起 APP 的路径 | ||
49 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","type": 7,"params":{"url":"http://guang.m.yohobuy.com${req.path}","param":${JSON.stringify(req.query)}}}`; | ||
48 | 50 | ||
49 | res.render('plustar/list', { | 51 | res.render('plustar/list', { |
50 | module: 'guang', | 52 | module: 'guang', |
@@ -207,9 +207,13 @@ const category = (req, res, next) => { | @@ -207,9 +207,13 @@ const category = (req, res, next) => { | ||
207 | 207 | ||
208 | /* 勿修改,唤起 APP 使用 */ | 208 | /* 勿修改,唤起 APP 使用 */ |
209 | let appParams = Object.assign({}, req.query, { | 209 | let appParams = Object.assign({}, req.query, { |
210 | - title: req.query.title || req.query.sort_name || '' | 210 | + title: req.query.title || req.query.sort_name || '', |
211 | + productPool: req.query.filter_poolId, | ||
212 | + actiontype: req.query.actiontype || '1' | ||
211 | }); | 213 | }); |
212 | 214 | ||
215 | + delete appParams.filter_poolId; | ||
216 | + | ||
213 | let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' + | 217 | let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' + |
214 | JSON.stringify(appParams) + | 218 | JSON.stringify(appParams) + |
215 | '}'; | 219 | '}'; |
@@ -15,6 +15,15 @@ const _ = require('lodash'); | @@ -15,6 +15,15 @@ const _ = require('lodash'); | ||
15 | const helpers = global.yoho.helpers; | 15 | const helpers = global.yoho.helpers; |
16 | const qs = require('querystring'); | 16 | const qs = require('querystring'); |
17 | 17 | ||
18 | +const channelToAppChannel = (channel) => { | ||
19 | + return { | ||
20 | + boys: '1', | ||
21 | + girls: '2', | ||
22 | + kids: '3', | ||
23 | + lifestyle: '4' | ||
24 | + }[channel] || '1'; | ||
25 | +}; | ||
26 | + | ||
18 | // 新品到着(blk) | 27 | // 新品到着(blk) |
19 | const blkNewGoods = (req, res, next) => { | 28 | const blkNewGoods = (req, res, next) => { |
20 | let params = Object.assign({ | 29 | let params = Object.assign({ |
@@ -55,6 +64,14 @@ const blkNewGoods = (req, res, next) => { | @@ -55,6 +64,14 @@ const blkNewGoods = (req, res, next) => { | ||
55 | const newGoods = (req, res, next) => { | 64 | const newGoods = (req, res, next) => { |
56 | let channel = req.yoho.channel; | 65 | let channel = req.yoho.channel; |
57 | 66 | ||
67 | + let appParams = Object.assign({}, req.query, { | ||
68 | + channel: channelToAppChannel(channel), | ||
69 | + uid: undefined // eslint-disable-line | ||
70 | + }); | ||
71 | + | ||
72 | + // 唤起 APP 的路径 | ||
73 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.new","params":${JSON.stringify(appParams)}}`; | ||
74 | + | ||
58 | newModel.getNewFocus(channel).then((result) => { | 75 | newModel.getNewFocus(channel).then((result) => { |
59 | res.render('new/new', { | 76 | res.render('new/new', { |
60 | module: 'product', | 77 | module: 'product', |
@@ -97,6 +114,14 @@ const _newGoods = (req, res, next) => { | @@ -97,6 +114,14 @@ const _newGoods = (req, res, next) => { | ||
97 | let channel = req.yoho.channel; | 114 | let channel = req.yoho.channel; |
98 | let uid = req.user.uid; | 115 | let uid = req.user.uid; |
99 | 116 | ||
117 | + let appParams = Object.assign({}, req.query, { | ||
118 | + channel: channelToAppChannel(channel), | ||
119 | + uid: undefined // eslint-disable-line | ||
120 | + }); | ||
121 | + | ||
122 | + // 唤起 APP 的路径 | ||
123 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.new","params":${JSON.stringify(appParams)}}`; | ||
124 | + | ||
100 | newModel.indexData(uid, channel).then(result => { | 125 | newModel.indexData(uid, channel).then(result => { |
101 | let shopList = _.get(result, 'shop_list', []); | 126 | let shopList = _.get(result, 'shop_list', []); |
102 | let banner = _.get(result, 'ads[0]', {}); | 127 | let banner = _.get(result, 'ads[0]', {}); |
@@ -41,6 +41,9 @@ const index = (req, res, next) => { | @@ -41,6 +41,9 @@ const index = (req, res, next) => { | ||
41 | break; | 41 | break; |
42 | } | 42 | } |
43 | 43 | ||
44 | + // 唤起 APP 的路径 | ||
45 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.top100","params":{"page":"0"}}'; | ||
46 | + | ||
44 | newsaleModel.getHotRank(codeKey).then((result) => { | 47 | newsaleModel.getHotRank(codeKey).then((result) => { |
45 | 48 | ||
46 | res.render('newsale/hotrank', { | 49 | res.render('newsale/hotrank', { |
@@ -33,6 +33,9 @@ exports.index = (req, res, next) => { | @@ -33,6 +33,9 @@ exports.index = (req, res, next) => { | ||
33 | let yhChannel = req.query.yh_channel || yhChannelEmpty; | 33 | let yhChannel = req.query.yh_channel || yhChannelEmpty; |
34 | let contentcode = req.query.content_code; | 34 | let contentcode = req.query.content_code; |
35 | 35 | ||
36 | + // 唤起 APP 的路径 | ||
37 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.newoutlet","params":${JSON.stringify(req.query)}}`; | ||
38 | + | ||
36 | outletModel.getContent(categoryId, yhChannel, contentcode).then(result => { | 39 | outletModel.getContent(categoryId, yhChannel, contentcode).then(result => { |
37 | res.render('outlet', Object.assign({ | 40 | res.render('outlet', Object.assign({ |
38 | localCss: true, | 41 | localCss: true, |
@@ -12,6 +12,15 @@ const headerModel = require('../../../doraemon/models/header'); | @@ -12,6 +12,15 @@ const headerModel = require('../../../doraemon/models/header'); | ||
12 | const saleModel = require(`${mRoot}/sale`); | 12 | const saleModel = require(`${mRoot}/sale`); |
13 | const qs = require('querystring'); | 13 | const qs = require('querystring'); |
14 | 14 | ||
15 | +const channelToAppChannel = (channel) => { | ||
16 | + return { | ||
17 | + boys: '1', | ||
18 | + girls: '2', | ||
19 | + kids: '3', | ||
20 | + lifestyle: '4' | ||
21 | + }[channel] || '1'; | ||
22 | +}; | ||
23 | + | ||
15 | // const queryParam = { | 24 | // const queryParam = { |
16 | // brand: '0', | 25 | // brand: '0', |
17 | // gender: '1,2,3', | 26 | // gender: '1,2,3', |
@@ -71,6 +80,15 @@ let index = (req, res, next) => { | @@ -71,6 +80,15 @@ let index = (req, res, next) => { | ||
71 | 80 | ||
72 | params.channel = req.query.channel || params.channel; | 81 | params.channel = req.query.channel || params.channel; |
73 | 82 | ||
83 | + let appParams = Object.assign({}, req.query, { | ||
84 | + channel: channelToAppChannel(params.channel), | ||
85 | + uid: undefined // eslint-disable-line | ||
86 | + }); | ||
87 | + | ||
88 | + // 唤起 APP 的路径 | ||
89 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.sale","params":${JSON.stringify(appParams)}}`; | ||
90 | + | ||
91 | + | ||
74 | saleModel.getSaleData(params.channel).then((result) => { | 92 | saleModel.getSaleData(params.channel).then((result) => { |
75 | 93 | ||
76 | // 扩展头部频道选择数据 | 94 | // 扩展头部频道选择数据 |
@@ -118,6 +136,10 @@ let indexRedirect = (req, res) => { | @@ -118,6 +136,10 @@ let indexRedirect = (req, res) => { | ||
118 | let breakingYards = (req, res, next) => { | 136 | let breakingYards = (req, res, next) => { |
119 | let params = _processPublicData(req, '断码区', 'break-code'); | 137 | let params = _processPublicData(req, '断码区', 'break-code'); |
120 | 138 | ||
139 | + // 唤起 APP 的路径 | ||
140 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shortsize"}'; | ||
141 | + | ||
142 | + | ||
121 | saleModel.getBreakCodeData({ | 143 | saleModel.getBreakCodeData({ |
122 | yhChannel: params.channel | 144 | yhChannel: params.channel |
123 | }).then((result) => { | 145 | }).then((result) => { |
@@ -159,6 +181,9 @@ let discountDetail = (req, res, next) => { | @@ -159,6 +181,9 @@ let discountDetail = (req, res, next) => { | ||
159 | saleModel.getDiscountDetailData(id, req.yoho.channel).then((result) => { | 181 | saleModel.getDiscountDetailData(id, req.yoho.channel).then((result) => { |
160 | params.renderData.pageHeader.navTitle = result.title; | 182 | params.renderData.pageHeader.navTitle = result.title; |
161 | 183 | ||
184 | + // 唤起 APP 的路径 | ||
185 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.discountmarketpro","params":{"id":"${id}","cover_url":"${result.activity.cover_url.split('?')[0]}","title":"${result.title}"}}`; | ||
186 | + | ||
162 | res.render('sale/discount-detail', Object.assign(params.renderData, result, { | 187 | res.render('sale/discount-detail', Object.assign(params.renderData, result, { |
163 | localCss: true | 188 | localCss: true |
164 | })); | 189 | })); |
@@ -34,6 +34,9 @@ const list = (req, res, next) => { | @@ -34,6 +34,9 @@ const list = (req, res, next) => { | ||
34 | params.isApp = req.yoho.isApp; | 34 | params.isApp = req.yoho.isApp; |
35 | params.physical_channel = req.yoho.channel && searchProcess.getChannelType(req.yoho.channel); | 35 | params.physical_channel = req.yoho.channel && searchProcess.getChannelType(req.yoho.channel); |
36 | 36 | ||
37 | + // 唤起 APP 的路径 | ||
38 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":${JSON.stringify(params)}}`; | ||
39 | + | ||
37 | return searchModel.searchKeyActivity(params.query || '').then(activityResult => { | 40 | return searchModel.searchKeyActivity(params.query || '').then(activityResult => { |
38 | let activity = _.get(activityResult, 'urlobj.appUrl', ''); | 41 | let activity = _.get(activityResult, 'urlobj.appUrl', ''); |
39 | 42 |
-
Please register or login to post a comment