Authored by yyq

Merge remote-tracking branch 'origin/master' into feature/apiRisk

... ... @@ -156,5 +156,4 @@ nbproject/*
.happypack/*
.scannerwork
package-lock.json
yarn.lock
yoho-yohobuy-wap.tar.gz
... ...
... ... @@ -6,8 +6,9 @@
# nginx version: 1.12.0
############################################################
#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
FROM ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
#base image : ccr.ccs.tencentyun.com/yoho-base/node
FROM ccr.ccs.tencentyun.com/yoho-base/node:10.4.1-alpine
MAINTAINER xiaoxiao.hao <xiaoxiao.hao@yoho.cn>
... ...
... ... @@ -40,7 +40,17 @@ const logger = global.yoho.logger;
// zookeeper
if (config.zookeeperServer) {
require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {});
const monitor = global.yoho.monitorSender;
const monitorType = _.get(monitor, 'type.ZOOKEEPER');
require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}, false, {
onerror: (err) => {
monitor.tallyFail(monitorType, {
code: err.code,
message: err.name
});
}
});
}
// 访问域名层级
... ...
... ... @@ -7,7 +7,7 @@ const sm = require('sitemap');
const staticUrls = require('../../../config/staticUrls');
const api = global.yoho.API;
const Service = global.yoho.ServiceAPI;
const redis = require('../../../utils/redis');
const cache = global.yoho.cache;
const getStaticUrls = (currentStatics) => {
let urls = [];
... ... @@ -53,7 +53,7 @@ const itemXmlData = () => {// eslint-disable-line
// 关键词页面
const keywordsPage = (page) => {
return redis.getAsync(`global:yoho:seo:keywords:allIds:page:${page}`).then(function(res) {
return cache.getAsync(`global:yoho:seo:keywords:allIds:page:${page}`).then(function(res) {
let pages = [];
_.forEach(JSON.parse(res), val => {
... ...
... ... @@ -271,6 +271,9 @@ const listNew = (req, res, next) => {
desc: categoryIntroRedis[1]
} : null;
// 唤起 APP 的路径
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":${JSON.stringify(params)}}`;
res.render('search/list-new', Object.assign({
_noLazy: true, // 首屏不使用lazyload
module: 'product',
... ...
... ... @@ -23,9 +23,9 @@ const co = require('bluebird').coroutine;
*/
const _tdkProcess = (keyword) => {
return {
title: `${keyword}| ${keyword}品牌旗舰店 |正品保证, YOHO!BUY 有货`,
keywords: `${keyword}${keyword}品牌旗舰店,${keyword}正品`,
description: `有货网${keyword}旗舰店销售${keyword}正品商品,全场质量保证,支持货到付款,想了解${keyword}价格、图片、评价等信息,就上YOHO!BUY 有货中国大型潮流商品购物网站!`, // eslint-disable-line
title: `${keyword}_${keyword}品牌官方旗舰店-YOHO!BUY 有货官网`,
keywords: `${keyword},${keyword}品牌官方旗舰店`,
description: `潮流网购就上YOHO!BUY有货官网,${keyword}品牌官方旗舰店提供${keyword}品牌商品价格、图片、款式等信息,销售${keyword}品牌正品商品,全场低至4,★品牌正品保证,支持货到付款!★`, // eslint-disable-line
};
};
... ...
... ... @@ -38,6 +38,11 @@ exports.index = (req, res, next) => {
}
})((result) => {
let appParams = _.assign({keyword: req.query.query}, req.query);
// 唤起 APP 的路径
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.searchlist","params":${JSON.stringify(appParams)}}`;
res.render('search/index', Object.assign({
module: 'product',
page: 'search-index',
... ...
... ... @@ -48,7 +48,8 @@ module.exports = {
assetUrl: '//127.0.0.1:5001',
testCode: 'yoho4946abcdef#$%&!@',
domains: domains,
yohoVerifyUdid: '0f626ede-0e17-460b-a8ea-069ee506e8e9',
// yohoVerifyUdid: '0f626ede-0e17-460b-a8ea-069ee506e8e9',
signExtend: {
business_line: 'yohobuy'
},
... ... @@ -240,6 +241,11 @@ if (isProduction) {
port: 80,
db: 'web-apm'
},
monitorReport: {
host: '10.66.4.25',
port: 8086,
db: 'web_monitor',
},
loggers: {
infoFile: {
name: 'info',
... ... @@ -308,6 +314,11 @@ if (isProduction) {
key: '7e6f3307b64cc87c79c472814b88f7fb',
appSecret: 'ce21ae4a3f93852279175a167e54509b',
notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify',
},
monitorReport: {
host: '192.168.102.22',
port: 8086,
db: 'web_monitor',
}
});
}
... ...
... ... @@ -2,10 +2,14 @@
wordir=$2
cd $wordir
rm -rf yoho-yohobuy-wap.tar.gz
if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]];then
yarn
yarn build
else
npm i --production
if [[ $1 == "test1" ]] || [[ $1 == "test2" ]] || [[ $1 == "test3" ]]
then
yarn build
fi
node-prune
tar -czf yoho-yohobuy-wap.tar.gz *
... ...
... ... @@ -6,6 +6,8 @@ const uuid = require('uuid');
const cookieSession = require('client-sessions');
const connectRedis = require('connect-redis');
const RedisStore = connectRedis(session);
const monitor = global.yoho.monitorSender;
const monitorType = _.get(monitor, 'type.REDIS');
/**
* 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session
... ... @@ -65,7 +67,12 @@ module.exports = (app) => {
domain: 'yohobuy.com',
httpOnly: true
},
store: new RedisStore(config.redis.session)
store: new RedisStore(Object.assign(config.redis.session, {
logErrors: (e) => {
// 上报redis session错误
monitor && monitor.tallyFail(monitorType, e);
}
}))
}));
app.use(cookieSession({ // eslint-disable-line
... ...
... ... @@ -86,8 +86,8 @@
"xml2js": "^0.4.19",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.6.16",
"yoho-zookeeper": "^1.0.9"
"yoho-node-lib": "=0.6.17",
"yoho-zookeeper": "^1.0.10"
},
"devDependencies": {
"@mapbox/stylelint-processor-arbitrary-tags": "^0.2.0",
... ...
... ... @@ -3,6 +3,7 @@ const _ = require('lodash');
const redis = require('redis');
const bluebird = require('bluebird');
const config = require('../config/common');
const monitor = global.yoho.monitorSender;
let client;
const timeout = 200; // redis 操作超时时间
... ... @@ -12,6 +13,8 @@ try {
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
const monitorType = _.get(monitor, 'type.REDIS');
client.all = args => {
if (!client.ready) {
if (Array.isArray(args)) {
... ... @@ -21,7 +24,11 @@ try {
}
}
return client.multi.call(client, args).execAsync().timeout(timeout).catch(()=>{
return client.multi.call(client, args).execAsync().timeout(timeout).then(res => {
monitor && monitor.tallySuccess(monitorType);
return res;
}).catch((e)=>{
monitor && monitor.tallyFail(monitorType, e);
return false;
});
};
... ...
This diff could not be displayed because it is too large.