Merge branch 'qCloud'
Showing
17 changed files
with
78 additions
and
28 deletions
@@ -27,6 +27,11 @@ const app = express(); | @@ -27,6 +27,11 @@ const app = express(); | ||
27 | app.locals.devEnv = app.get('env') === 'development'; | 27 | app.locals.devEnv = app.get('env') === 'development'; |
28 | app.locals.version = pkg.version; | 28 | app.locals.version = pkg.version; |
29 | 29 | ||
30 | +// zookeeper | ||
31 | +if (config.zookeeperServer) { | ||
32 | + require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}); | ||
33 | +} | ||
34 | + | ||
30 | // 访问域名层级 | 35 | // 访问域名层级 |
31 | app.set('subdomain offset', 3); | 36 | app.set('subdomain offset', 3); |
32 | 37 |
@@ -27,6 +27,13 @@ app.use(global.yoho.hbs({ | @@ -27,6 +27,13 @@ app.use(global.yoho.hbs({ | ||
27 | helpers: Object.assign({}, global.yoho.helpers, helpers) | 27 | helpers: Object.assign({}, global.yoho.helpers, helpers) |
28 | })); | 28 | })); |
29 | 29 | ||
30 | +// for zookeeper, inject locals | ||
31 | +app.use((req, res, next) => { | ||
32 | + req.app.locals.wap = app.locals.wap; | ||
33 | + | ||
34 | + next(); | ||
35 | +}); | ||
36 | + | ||
30 | // router | 37 | // router |
31 | app.use(require('./router')); | 38 | app.use(require('./router')); |
32 | 39 |
@@ -15,6 +15,13 @@ app.on('mount', function(parent) { | @@ -15,6 +15,13 @@ app.on('mount', function(parent) { | ||
15 | Object.assign(app.locals, parent.locals); | 15 | Object.assign(app.locals, parent.locals); |
16 | }); | 16 | }); |
17 | 17 | ||
18 | +// for zookeeper, inject locals | ||
19 | +app.use((req, res, next) => { | ||
20 | + req.app.locals.wap = app.locals.wap; | ||
21 | + | ||
22 | + next(); | ||
23 | +}); | ||
24 | + | ||
18 | // router | 25 | // router |
19 | app.use(require('./router')); | 26 | app.use(require('./router')); |
20 | 27 |
@@ -4,27 +4,21 @@ | @@ -4,27 +4,21 @@ | ||
4 | * @date: 2016/05/09 | 4 | * @date: 2016/05/09 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var express = require('express'), | ||
8 | - path = require('path'); | 7 | +var express = require('express'); |
9 | 8 | ||
10 | var app = express(); | 9 | var app = express(); |
11 | 10 | ||
12 | -// set view engin | ||
13 | -var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root | ||
14 | - | ||
15 | app.on('mount', function(parent) { | 11 | app.on('mount', function(parent) { |
16 | delete parent.locals.settings; // 不继承父 App 的设置 | 12 | delete parent.locals.settings; // 不继承父 App 的设置 |
17 | Object.assign(app.locals, parent.locals); | 13 | Object.assign(app.locals, parent.locals); |
18 | }); | 14 | }); |
19 | 15 | ||
20 | -// app.use(global.yoho.hbs({ | ||
21 | -// extname: '.hbs', | ||
22 | -// defaultLayout: 'layout', | ||
23 | -// layoutsDir: doraemon, | ||
24 | -// partialsDir: path.join(__dirname, 'views/partial'), | ||
25 | -// views: path.join(__dirname, 'views/action'), | ||
26 | -// helpers: global.yoho.helpers | ||
27 | -// })); | 16 | +// for zookeeper, inject locals |
17 | +app.use((req, res, next) => { | ||
18 | + req.app.locals.wap = app.locals.wap; | ||
19 | + | ||
20 | + next(); | ||
21 | +}); | ||
28 | 22 | ||
29 | // router | 23 | // router |
30 | app.use(require('./router')); | 24 | app.use(require('./router')); |
@@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | ||
26 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
27 | })); | 27 | })); |
28 | 28 | ||
29 | +// for zookeeper, inject locals | ||
30 | +app.use((req, res, next) => { | ||
31 | + req.app.locals.wap = app.locals.wap; | ||
32 | + | ||
33 | + next(); | ||
34 | +}); | ||
35 | + | ||
29 | // router | 36 | // router |
30 | app.use(require('./router')); | 37 | app.use(require('./router')); |
31 | 38 |
@@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | ||
26 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
27 | })); | 27 | })); |
28 | 28 | ||
29 | +// for zookeeper, inject locals | ||
30 | +app.use((req, res, next) => { | ||
31 | + req.app.locals.wap = app.locals.wap; | ||
32 | + | ||
33 | + next(); | ||
34 | +}); | ||
35 | + | ||
29 | // router | 36 | // router |
30 | app.use(require('./router')); | 37 | app.use(require('./router')); |
31 | 38 |
@@ -42,7 +42,7 @@ exports.address = (req, res, next) => { | @@ -42,7 +42,7 @@ exports.address = (req, res, next) => { | ||
42 | */ | 42 | */ |
43 | exports.addressAct = (req, res, next) => { | 43 | exports.addressAct = (req, res, next) => { |
44 | addressModel.address({ | 44 | addressModel.address({ |
45 | - id: decodeURIComponent(req.params.id), | 45 | + id: decodeURIComponent(req.query.id), |
46 | uid: req.user.uid | 46 | uid: req.user.uid |
47 | }).then(result => { | 47 | }).then(result => { |
48 | let responseData = { | 48 | let responseData = { |
@@ -114,7 +114,7 @@ exports.saveAddress = (req, res, next) => { | @@ -114,7 +114,7 @@ exports.saveAddress = (req, res, next) => { | ||
114 | area_code: req.body.area_code, | 114 | area_code: req.body.area_code, |
115 | consignee: req.body.consignee, | 115 | consignee: req.body.consignee, |
116 | email: req.body.email, | 116 | email: req.body.email, |
117 | - id: req.body.id, | 117 | + id: decodeURIComponent(req.body.id), |
118 | mobile: req.body.mobile, | 118 | mobile: req.body.mobile, |
119 | zip_code: req.body.zip_code | 119 | zip_code: req.body.zip_code |
120 | }).then(result => { | 120 | }).then(result => { |
@@ -130,7 +130,7 @@ exports.saveAddress = (req, res, next) => { | @@ -130,7 +130,7 @@ exports.saveAddress = (req, res, next) => { | ||
130 | */ | 130 | */ |
131 | exports.delAddress = (req, res, next) => { | 131 | exports.delAddress = (req, res, next) => { |
132 | addressModel.delAddress({ | 132 | addressModel.delAddress({ |
133 | - id: req.body.id, | 133 | + id: decodeURIComponent(req.body.id), |
134 | uid: req.user.uid | 134 | uid: req.user.uid |
135 | }).then(result => { | 135 | }).then(result => { |
136 | res.json(result); | 136 | res.json(result); |
@@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({ | ||
26 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
27 | })); | 27 | })); |
28 | 28 | ||
29 | +// for zookeeper, inject locals | ||
30 | +app.use((req, res, next) => { | ||
31 | + req.app.locals.wap = app.locals.wap; | ||
32 | + | ||
33 | + next(); | ||
34 | +}); | ||
35 | + | ||
29 | // router | 36 | // router |
30 | app.use(require('./router')); | 37 | app.use(require('./router')); |
31 | 38 |
@@ -100,14 +100,14 @@ const address = (params) => { | @@ -100,14 +100,14 @@ const address = (params) => { | ||
100 | 100 | ||
101 | /* 加密地址 ID */ | 101 | /* 加密地址 ID */ |
102 | _.forEach(selfAddress.data, (value, key) => { | 102 | _.forEach(selfAddress.data, (value, key) => { |
103 | - selfAddress.data[key].address_id = crypto.encryption(null, selfAddress.data[key].address_id); | 103 | + selfAddress.data[key].address_id = encodeURIComponent(crypto.encryption(null, selfAddress.data[key].address_id)); |
104 | }); | 104 | }); |
105 | 105 | ||
106 | /* 如果有 ID 是地址编辑页面 */ | 106 | /* 如果有 ID 是地址编辑页面 */ |
107 | if (params.id) { | 107 | if (params.id) { |
108 | return { | 108 | return { |
109 | address: camelCase(_.find(selfAddress.data, o => { | 109 | address: camelCase(_.find(selfAddress.data, o => { |
110 | - return o.address_id === params.id; | 110 | + return decodeURIComponent(o.address_id) === params.id; |
111 | })), | 111 | })), |
112 | addressList: camelCase(result[1] ? result[1].data : []), | 112 | addressList: camelCase(result[1] ? result[1].data : []), |
113 | navTitle: '编辑地址' | 113 | navTitle: '编辑地址' |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <span class="tel">{{mobile}}</span> | 6 | <span class="tel">{{mobile}}</span> |
7 | <p class="address-info">{{area}} {{address}}</p> | 7 | <p class="address-info">{{area}} {{address}}</p> |
8 | <div class="action iconfont"> | 8 | <div class="action iconfont"> |
9 | - <a class="edit" href="/home/addressAct/{{addressId}}"></a> | 9 | + <a class="edit" href="/home/addressAct?id={{addressId}}"></a> |
10 | <span class="del" data-id="{{addressId}}"></span> | 10 | <span class="del" data-id="{{addressId}}"></span> |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
@@ -28,6 +28,12 @@ app.use(global.yoho.hbs({ | @@ -28,6 +28,12 @@ app.use(global.yoho.hbs({ | ||
28 | helpers: global.yoho.helpers | 28 | helpers: global.yoho.helpers |
29 | })); | 29 | })); |
30 | 30 | ||
31 | +// for zookeeper, inject locals | ||
32 | +app.use((req, res, next) => { | ||
33 | + req.app.locals.wap = app.locals.wap; | ||
34 | + | ||
35 | + next(); | ||
36 | +}); | ||
31 | 37 | ||
32 | require('./auth'); | 38 | require('./auth'); |
33 | app.use(passport.initialize()); | 39 | app.use(passport.initialize()); |
@@ -27,6 +27,13 @@ app.use(global.yoho.hbs({ | @@ -27,6 +27,13 @@ app.use(global.yoho.hbs({ | ||
27 | helpers: global.yoho.helpers | 27 | helpers: global.yoho.helpers |
28 | })); | 28 | })); |
29 | 29 | ||
30 | +// for zookeeper, inject locals | ||
31 | +app.use((req, res, next) => { | ||
32 | + req.app.locals.wap = app.locals.wap; | ||
33 | + | ||
34 | + next(); | ||
35 | +}); | ||
36 | + | ||
30 | // router | 37 | // router |
31 | app.use(require('./router')); | 38 | app.use(require('./router')); |
32 | 39 |
@@ -83,7 +83,8 @@ module.exports = { | @@ -83,7 +83,8 @@ module.exports = { | ||
83 | appID: 'wx75e5a7c0c88e45c2', | 83 | appID: 'wx75e5a7c0c88e45c2', |
84 | appSecret: 'ce21ae4a3f93852279175a167e54509b' | 84 | appSecret: 'ce21ae4a3f93852279175a167e54509b' |
85 | } | 85 | } |
86 | - } | 86 | + }, |
87 | + zookeeperServer: false // '10.66.1.97:2181' | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | if (isProduction) { | 90 | if (isProduction) { |
@@ -2,5 +2,7 @@ | @@ -2,5 +2,7 @@ | ||
2 | <a href="{{@root.cartUrl}}"> | 2 | <a href="{{@root.cartUrl}}"> |
3 | <span class="iconfont"></span> | 3 | <span class="iconfont"></span> |
4 | </a> | 4 | </a> |
5 | + {{#unless @root.wap.common.removeCartCount}} | ||
5 | <span class="cart-count hide">0</span> | 6 | <span class="cart-count hide">0</span> |
7 | + {{/unless}} | ||
6 | </div> | 8 | </div> |
1 | { | 1 | { |
2 | "name": "m-yohobuy-node", | 2 | "name": "m-yohobuy-node", |
3 | - "version": "5.0.12", | 3 | + "version": "11.11.3", |
4 | "private": true, | 4 | "private": true, |
5 | "description": "A New Yohobuy Project With Express", | 5 | "description": "A New Yohobuy Project With Express", |
6 | "repository": { | 6 | "repository": { |
@@ -38,7 +38,8 @@ | @@ -38,7 +38,8 @@ | ||
38 | "request-promise": "^3.0.0", | 38 | "request-promise": "^3.0.0", |
39 | "serve-favicon": "^2.3.0", | 39 | "serve-favicon": "^2.3.0", |
40 | "uuid": "^2.0.3", | 40 | "uuid": "^2.0.3", |
41 | - "yoho-node-lib": "0.1.23" | 41 | + "yoho-node-lib": "0.1.23", |
42 | + "yoho-zookeeper": "^1.0.3" | ||
42 | }, | 43 | }, |
43 | "devDependencies": { | 44 | "devDependencies": { |
44 | "autoprefixer": "^6.3.7", | 45 | "autoprefixer": "^6.3.7", |
@@ -350,7 +350,7 @@ function givePoint(parameter) { | @@ -350,7 +350,7 @@ function givePoint(parameter) { | ||
350 | */ | 350 | */ |
351 | (function() { | 351 | (function() { |
352 | var channel = cookie('_Channel'); | 352 | var channel = cookie('_Channel'); |
353 | - var header = $('#yoho-header'); | 353 | + var header = $('#yoho-header, .homebuttom'); |
354 | 354 | ||
355 | if (!/^\/home/.test(location.pathname)) { | 355 | if (!/^\/home/.test(location.pathname)) { |
356 | switch (channel) { | 356 | switch (channel) { |
@@ -927,13 +927,12 @@ $nav2.on('touchstart', 'li', function(e) { | @@ -927,13 +927,12 @@ $nav2.on('touchstart', 'li', function(e) { | ||
927 | // // stopPropagation(e); | 927 | // // stopPropagation(e); |
928 | // }); | 928 | // }); |
929 | 929 | ||
930 | -$('#shop-category').click(function() { | ||
931 | - var subGroup = $('.sub-group'); | ||
932 | - | 930 | +$('.shop-foot-wrapper .buriedpoint').click(function() { |
931 | + var subGroup = $(this).find('.sub-group'); | ||
933 | if (subGroup.hasClass('hide')) { | 932 | if (subGroup.hasClass('hide')) { |
934 | - $('.sub-group').removeClass('hide'); | 933 | + subGroup.removeClass('hide'); |
935 | } else { | 934 | } else { |
936 | - $('.sub-group').addClass('hide'); | 935 | + subGroup.addClass('hide'); |
937 | } | 936 | } |
938 | }); | 937 | }); |
939 | 938 |
-
Please register or login to post a comment