Merge remote-tracking branch 'origin/master' into feature/apiRisk
Showing
13 changed files
with
65 additions
and
18 deletions
@@ -6,8 +6,9 @@ | @@ -6,8 +6,9 @@ | ||
6 | # nginx version: 1.12.0 | 6 | # nginx version: 1.12.0 |
7 | ############################################################ | 7 | ############################################################ |
8 | 8 | ||
9 | -#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1 | ||
10 | -FROM ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1 | 9 | + |
10 | +#base image : ccr.ccs.tencentyun.com/yoho-base/node | ||
11 | +FROM ccr.ccs.tencentyun.com/yoho-base/node:10.4.1-alpine | ||
11 | 12 | ||
12 | MAINTAINER xiaoxiao.hao <xiaoxiao.hao@yoho.cn> | 13 | MAINTAINER xiaoxiao.hao <xiaoxiao.hao@yoho.cn> |
13 | 14 |
@@ -40,7 +40,17 @@ const logger = global.yoho.logger; | @@ -40,7 +40,17 @@ const logger = global.yoho.logger; | ||
40 | 40 | ||
41 | // zookeeper | 41 | // zookeeper |
42 | if (config.zookeeperServer) { | 42 | if (config.zookeeperServer) { |
43 | - require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}); | 43 | + const monitor = global.yoho.monitorSender; |
44 | + const monitorType = _.get(monitor, 'type.ZOOKEEPER'); | ||
45 | + | ||
46 | + require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}, false, { | ||
47 | + onerror: (err) => { | ||
48 | + monitor.tallyFail(monitorType, { | ||
49 | + code: err.code, | ||
50 | + message: err.name | ||
51 | + }); | ||
52 | + } | ||
53 | + }); | ||
44 | } | 54 | } |
45 | 55 | ||
46 | // 访问域名层级 | 56 | // 访问域名层级 |
@@ -7,7 +7,7 @@ const sm = require('sitemap'); | @@ -7,7 +7,7 @@ const sm = require('sitemap'); | ||
7 | const staticUrls = require('../../../config/staticUrls'); | 7 | const staticUrls = require('../../../config/staticUrls'); |
8 | const api = global.yoho.API; | 8 | const api = global.yoho.API; |
9 | const Service = global.yoho.ServiceAPI; | 9 | const Service = global.yoho.ServiceAPI; |
10 | -const redis = require('../../../utils/redis'); | 10 | +const cache = global.yoho.cache; |
11 | 11 | ||
12 | const getStaticUrls = (currentStatics) => { | 12 | const getStaticUrls = (currentStatics) => { |
13 | let urls = []; | 13 | let urls = []; |
@@ -53,7 +53,7 @@ const itemXmlData = () => {// eslint-disable-line | @@ -53,7 +53,7 @@ const itemXmlData = () => {// eslint-disable-line | ||
53 | 53 | ||
54 | // 关键词页面 | 54 | // 关键词页面 |
55 | const keywordsPage = (page) => { | 55 | const keywordsPage = (page) => { |
56 | - return redis.getAsync(`global:yoho:seo:keywords:allIds:page:${page}`).then(function(res) { | 56 | + return cache.getAsync(`global:yoho:seo:keywords:allIds:page:${page}`).then(function(res) { |
57 | let pages = []; | 57 | let pages = []; |
58 | 58 | ||
59 | _.forEach(JSON.parse(res), val => { | 59 | _.forEach(JSON.parse(res), val => { |
@@ -271,6 +271,9 @@ const listNew = (req, res, next) => { | @@ -271,6 +271,9 @@ const listNew = (req, res, next) => { | ||
271 | desc: categoryIntroRedis[1] | 271 | desc: categoryIntroRedis[1] |
272 | } : null; | 272 | } : null; |
273 | 273 | ||
274 | + // 唤起 APP 的路径 | ||
275 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":${JSON.stringify(params)}}`; | ||
276 | + | ||
274 | res.render('search/list-new', Object.assign({ | 277 | res.render('search/list-new', Object.assign({ |
275 | _noLazy: true, // 首屏不使用lazyload | 278 | _noLazy: true, // 首屏不使用lazyload |
276 | module: 'product', | 279 | module: 'product', |
@@ -23,9 +23,9 @@ const co = require('bluebird').coroutine; | @@ -23,9 +23,9 @@ const co = require('bluebird').coroutine; | ||
23 | */ | 23 | */ |
24 | const _tdkProcess = (keyword) => { | 24 | const _tdkProcess = (keyword) => { |
25 | return { | 25 | return { |
26 | - title: `${keyword}| ${keyword}品牌旗舰店 |正品保证, YOHO!BUY 有货`, | ||
27 | - keywords: `${keyword},${keyword}品牌旗舰店,${keyword}正品`, | ||
28 | - description: `有货网${keyword}旗舰店销售${keyword}正品商品,全场质量保证,支持货到付款,想了解${keyword}价格、图片、评价等信息,就上YOHO!BUY 有货中国大型潮流商品购物网站!`, // eslint-disable-line | 26 | + title: `${keyword}_${keyword}品牌官方旗舰店-YOHO!BUY 有货官网`, |
27 | + keywords: `${keyword},${keyword}品牌官方旗舰店`, | ||
28 | + description: `潮流网购就上YOHO!BUY有货官网,${keyword}品牌官方旗舰店提供${keyword}品牌商品价格、图片、款式等信息,销售${keyword}品牌正品商品,全场低至4折,★品牌正品保证,支持货到付款!★`, // eslint-disable-line | ||
29 | }; | 29 | }; |
30 | }; | 30 | }; |
31 | 31 |
@@ -38,6 +38,11 @@ exports.index = (req, res, next) => { | @@ -38,6 +38,11 @@ exports.index = (req, res, next) => { | ||
38 | } | 38 | } |
39 | 39 | ||
40 | })((result) => { | 40 | })((result) => { |
41 | + let appParams = _.assign({keyword: req.query.query}, req.query); | ||
42 | + | ||
43 | + // 唤起 APP 的路径 | ||
44 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.searchlist","params":${JSON.stringify(appParams)}}`; | ||
45 | + | ||
41 | res.render('search/index', Object.assign({ | 46 | res.render('search/index', Object.assign({ |
42 | module: 'product', | 47 | module: 'product', |
43 | page: 'search-index', | 48 | page: 'search-index', |
@@ -48,7 +48,8 @@ module.exports = { | @@ -48,7 +48,8 @@ module.exports = { | ||
48 | assetUrl: '//127.0.0.1:5001', | 48 | assetUrl: '//127.0.0.1:5001', |
49 | testCode: 'yoho4946abcdef#$%&!@', | 49 | testCode: 'yoho4946abcdef#$%&!@', |
50 | domains: domains, | 50 | domains: domains, |
51 | - yohoVerifyUdid: '0f626ede-0e17-460b-a8ea-069ee506e8e9', | 51 | + |
52 | + // yohoVerifyUdid: '0f626ede-0e17-460b-a8ea-069ee506e8e9', | ||
52 | signExtend: { | 53 | signExtend: { |
53 | business_line: 'yohobuy' | 54 | business_line: 'yohobuy' |
54 | }, | 55 | }, |
@@ -240,6 +241,11 @@ if (isProduction) { | @@ -240,6 +241,11 @@ if (isProduction) { | ||
240 | port: 80, | 241 | port: 80, |
241 | db: 'web-apm' | 242 | db: 'web-apm' |
242 | }, | 243 | }, |
244 | + monitorReport: { | ||
245 | + host: '10.66.4.25', | ||
246 | + port: 8086, | ||
247 | + db: 'web_monitor', | ||
248 | + }, | ||
243 | loggers: { | 249 | loggers: { |
244 | infoFile: { | 250 | infoFile: { |
245 | name: 'info', | 251 | name: 'info', |
@@ -308,6 +314,11 @@ if (isProduction) { | @@ -308,6 +314,11 @@ if (isProduction) { | ||
308 | key: '7e6f3307b64cc87c79c472814b88f7fb', | 314 | key: '7e6f3307b64cc87c79c472814b88f7fb', |
309 | appSecret: 'ce21ae4a3f93852279175a167e54509b', | 315 | appSecret: 'ce21ae4a3f93852279175a167e54509b', |
310 | notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify', | 316 | notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify', |
317 | + }, | ||
318 | + monitorReport: { | ||
319 | + host: '192.168.102.22', | ||
320 | + port: 8086, | ||
321 | + db: 'web_monitor', | ||
311 | } | 322 | } |
312 | }); | 323 | }); |
313 | } | 324 | } |
@@ -2,10 +2,14 @@ | @@ -2,10 +2,14 @@ | ||
2 | wordir=$2 | 2 | wordir=$2 |
3 | cd $wordir | 3 | cd $wordir |
4 | rm -rf yoho-yohobuy-wap.tar.gz | 4 | rm -rf yoho-yohobuy-wap.tar.gz |
5 | -if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]];then | 5 | + |
6 | yarn | 6 | yarn |
7 | -yarn build | ||
8 | -else | ||
9 | -npm i --production | 7 | + |
8 | +if [[ $1 == "test1" ]] || [[ $1 == "test2" ]] || [[ $1 == "test3" ]] | ||
9 | +then | ||
10 | + yarn build | ||
10 | fi | 11 | fi |
12 | + | ||
13 | +node-prune | ||
14 | + | ||
11 | tar -czf yoho-yohobuy-wap.tar.gz * | 15 | tar -czf yoho-yohobuy-wap.tar.gz * |
@@ -6,6 +6,8 @@ const uuid = require('uuid'); | @@ -6,6 +6,8 @@ const uuid = require('uuid'); | ||
6 | const cookieSession = require('client-sessions'); | 6 | const cookieSession = require('client-sessions'); |
7 | const connectRedis = require('connect-redis'); | 7 | const connectRedis = require('connect-redis'); |
8 | const RedisStore = connectRedis(session); | 8 | const RedisStore = connectRedis(session); |
9 | +const monitor = global.yoho.monitorSender; | ||
10 | +const monitorType = _.get(monitor, 'type.REDIS'); | ||
9 | 11 | ||
10 | /** | 12 | /** |
11 | * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session | 13 | * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session |
@@ -65,7 +67,12 @@ module.exports = (app) => { | @@ -65,7 +67,12 @@ module.exports = (app) => { | ||
65 | domain: 'yohobuy.com', | 67 | domain: 'yohobuy.com', |
66 | httpOnly: true | 68 | httpOnly: true |
67 | }, | 69 | }, |
68 | - store: new RedisStore(config.redis.session) | 70 | + store: new RedisStore(Object.assign(config.redis.session, { |
71 | + logErrors: (e) => { | ||
72 | + // 上报redis session错误 | ||
73 | + monitor && monitor.tallyFail(monitorType, e); | ||
74 | + } | ||
75 | + })) | ||
69 | })); | 76 | })); |
70 | 77 | ||
71 | app.use(cookieSession({ // eslint-disable-line | 78 | app.use(cookieSession({ // eslint-disable-line |
@@ -86,8 +86,8 @@ | @@ -86,8 +86,8 @@ | ||
86 | "xml2js": "^0.4.19", | 86 | "xml2js": "^0.4.19", |
87 | "yoho-express-session": "^2.0.0", | 87 | "yoho-express-session": "^2.0.0", |
88 | "yoho-md5": "^2.0.0", | 88 | "yoho-md5": "^2.0.0", |
89 | - "yoho-node-lib": "=0.6.16", | ||
90 | - "yoho-zookeeper": "^1.0.9" | 89 | + "yoho-node-lib": "=0.6.17", |
90 | + "yoho-zookeeper": "^1.0.10" | ||
91 | }, | 91 | }, |
92 | "devDependencies": { | 92 | "devDependencies": { |
93 | "@mapbox/stylelint-processor-arbitrary-tags": "^0.2.0", | 93 | "@mapbox/stylelint-processor-arbitrary-tags": "^0.2.0", |
@@ -3,6 +3,7 @@ const _ = require('lodash'); | @@ -3,6 +3,7 @@ const _ = require('lodash'); | ||
3 | const redis = require('redis'); | 3 | const redis = require('redis'); |
4 | const bluebird = require('bluebird'); | 4 | const bluebird = require('bluebird'); |
5 | const config = require('../config/common'); | 5 | const config = require('../config/common'); |
6 | +const monitor = global.yoho.monitorSender; | ||
6 | let client; | 7 | let client; |
7 | const timeout = 200; // redis 操作超时时间 | 8 | const timeout = 200; // redis 操作超时时间 |
8 | 9 | ||
@@ -12,6 +13,8 @@ try { | @@ -12,6 +13,8 @@ try { | ||
12 | bluebird.promisifyAll(redis.RedisClient.prototype); | 13 | bluebird.promisifyAll(redis.RedisClient.prototype); |
13 | bluebird.promisifyAll(redis.Multi.prototype); | 14 | bluebird.promisifyAll(redis.Multi.prototype); |
14 | 15 | ||
16 | + const monitorType = _.get(monitor, 'type.REDIS'); | ||
17 | + | ||
15 | client.all = args => { | 18 | client.all = args => { |
16 | if (!client.ready) { | 19 | if (!client.ready) { |
17 | if (Array.isArray(args)) { | 20 | if (Array.isArray(args)) { |
@@ -21,7 +24,11 @@ try { | @@ -21,7 +24,11 @@ try { | ||
21 | } | 24 | } |
22 | } | 25 | } |
23 | 26 | ||
24 | - return client.multi.call(client, args).execAsync().timeout(timeout).catch(()=>{ | 27 | + return client.multi.call(client, args).execAsync().timeout(timeout).then(res => { |
28 | + monitor && monitor.tallySuccess(monitorType); | ||
29 | + return res; | ||
30 | + }).catch((e)=>{ | ||
31 | + monitor && monitor.tallyFail(monitorType, e); | ||
25 | return false; | 32 | return false; |
26 | }); | 33 | }); |
27 | }; | 34 | }; |
yarn.lock
0 → 100644
This diff could not be displayed because it is too large.
-
Please register or login to post a comment