Authored by 姜枫

修改library

... ... @@ -22,11 +22,14 @@ const memcached = require('connect-memcached');
const hbs = require('express-handlebars');
const pkg = require('./package.json');
const yohoLib = require('yoho-node-lib');
const app = express();
const MemcachedStore = memcached(session);
// 指定libray目录
global.library = path.resolve('./library');
// 全局注册library
yohoLib.global(config);
global.middleware = path.resolve('./doraemon/middleware');
global.utils = path.resolve('./utils');
... ... @@ -41,7 +44,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: './doraemon/views',
partialsDir: './doraemon/views/partial',
helpers: require(`${global.library}/helpers`)
helpers: global.yoho.helpers
}));
app.use(favicon(path.join(__dirname, '/public/favicon.ico')));
... ... @@ -74,7 +77,7 @@ app.use((req, res, next) => {
next();
});
const logger = require('./library/logger');
const logger = global.yoho.logger;
// dispatcher
try {
... ...
... ... @@ -23,7 +23,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
helpers: require('../../library/helpers')
helpers: global.yoho.helpers
}));
// router
... ...
... ... @@ -5,12 +5,11 @@
*/
'use strict';
const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
const sign = require(`${global.library}/sign`);
const logger = require(`${global.library}/logger`);
const sign = global.yoho.sign;
const logger = global.yoho.logger;
const headerModel = require('../../../doraemon/models/header');
var api = new ServiceAPI();
var api = global.yoho.ServiceAPI;
const getstaticFile = (id) => {
return api.get('staticFileManage/queryById', sign.apiSign({
... ...
... ... @@ -26,7 +26,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [`${partials}/partials`, `${doraemon}/partial`],
helpers: require('../../library/helpers')
helpers: global.yoho.helpers
}));
... ...
... ... @@ -9,18 +9,16 @@ const _ = require('lodash');
const dataMap = require('../../../config/data-map');
const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
const SearchAPI = require(`${global.library}/api`).SearchAPI;
const sign = require(`${global.library}/sign`);
const helpers = require(`${global.library}/helpers`);
const sign = global.yoho.sign;
const helpers = global.yoho.helpers;
const images = require(`${global.utils}/images`);
// const processProduct = require(`${global.utils}/product-process`).processProductList;
const log = require(`${global.library}/logger`);
const log = global.yoho.logger;
const serviceApi = new ServiceAPI();
const searchApi = new SearchAPI();
const serviceApi = global.yoho.ServiceAPI;
const searchApi = global.yoho.SearchAPI;
const headerModel = require('../../../doraemon/models/header');
... ...
... ... @@ -5,13 +5,12 @@
*/
'use strict';
const library = '../../../library';
const passport = require('passport');
const uuid = require('uuid');
const cookie = require(`${library}/cookie`);
const helpers = require(`${library}/helpers`);
const log = require(`${library}/logger`);
const config = require('../../../config/common');
const cookie = global.yoho.cookie;
const helpers = global.yoho.helpers;
const log = global.yoho.logger;
const config = global.yoho.config;
const AuthHelper = require('../models/auth-helper');
const loginPage = `${config.siteUrl}/passport/login/index`;
... ...
... ... @@ -26,7 +26,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
helpers: require(`${global.library}/helpers`)
helpers: global.yoho.helpers
}));
... ...
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const api = new API();
const sign = global.yoho.sign;
const api = global.yoho.API;
class Auth {
... ...
... ... @@ -24,7 +24,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
helpers: require('../../library/helpers')
helpers: global.yoho.helpers
}));
// router
... ...
... ... @@ -6,10 +6,8 @@
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
const API = require(`${library}/api`).API;
const api = new API();
const api = global.yoho.API;
const saleApi = require('./sale-api');
const outletsApi = require('./outlets-api');
const productProcess = require(`${utils}/product-process`);
... ...
... ... @@ -6,12 +6,10 @@
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
const serviceApi = new ServiceAPI();
const api = new API();
const sign = require(`${library}/sign`);
const serviceApi = global.yoho.ServiceAPI;
const api = global.yoho.API;
const sign = global.yoho.sign;
const _ = require('lodash');
const yhChannel = {
... ...
... ... @@ -5,9 +5,8 @@
* @Last Modified time: 2016-06-08 19:31:52
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
const helpers = require(`${library}/helpers`);
const helpers = global.yoho.helpers;
const _ = require('lodash');
const camelCase = require('../../../library/camel-case');
const productProcess = require(`${utils}/product-process`);
... ...
... ... @@ -6,10 +6,8 @@
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
const API = require(`${library}/api`).API;
const api = new API();
const api = global.yoho.API;
const list = require('./list');
const outletsProcess = require('./outlets-handler');
const outletsApi = require('./outlets-api');
... ... @@ -18,7 +16,7 @@ const headerModel = require('../../../doraemon/models/header');
const _ = require('lodash');
const publicHandler = require('./public-handler');
const log = require(`${global.library}/logger`);
const log = global.yoho.logger;
// 奥莱频道资源码
const channelCode = {
... ...
... ... @@ -7,8 +7,7 @@
'use strict';
const _ = require('lodash');
const library = '../../../library';
const helpers = require(`${library}/helpers`);
const helpers = global.yoho.helpers;
const queryString = require('querystring');
/**
... ...
... ... @@ -6,12 +6,10 @@
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const api = new API();
const serviceAPI = new ServiceAPI();
const sign = require(`${library}/sign`);
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const sign = global.yoho.sign;
const _ = require('lodash');
const yhChannel = {
... ...
... ... @@ -6,8 +6,7 @@
*/
'use strict';
const library = '../../../library';
const helpers = require(`${library}/helpers`);
const helpers = global.yoho.helpers;
const _ = require('lodash');
const anHour = 3600000;
const aDay = anHour * 24;
... ...
... ... @@ -6,12 +6,10 @@
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
const logger = require(`${library}/logger`);
const camelCase = require(`${library}/camel-case`);
const API = require(`${library}/api`).API;
const api = new API();
const logger = global.yoho.logger;
const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const saleApi = require('./sale-api');
const publicHandler = require('./public-handler');
const saleHandler = require('./sale-handler');
... ...
... ... @@ -3,7 +3,7 @@
* @return {[type]}
*/
const headerModel = require('../models/header');
const logger = require('../../library/logger');
const logger = global.yoho.logger;
exports.notFound = () => {
return (req, res, next) => {
... ...
const _ = require('lodash');
const cookie = require('../../library/cookie');
const cookie = global.yoho.cookie;
module.exports = () => {
return (req, res, next) => {
... ...
... ... @@ -8,12 +8,11 @@
const _ = require('lodash');
const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
const sign = require(`${global.library}/sign`);
const sign = global.yoho.sign;
const serviceApi = new ServiceAPI();
const serviceApi = global.yoho.ServiceAPI;
const log = require(`${global.library}/logger`);
const log = global.yoho.logger;
/**
* 获取菜单
... ...
... ... @@ -51,7 +51,8 @@
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.1.4"
"winston-daily-rotate-file": "^1.1.4",
"yoho-node-lib": "0.0.4"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
... ...
'use strict';
const _ = require('lodash');
const camelCase = require('../library/camel-case');
const helpers = require('../library/helpers');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
... ...
const _ = require('lodash');
const camelCase = require('../library/camel-case');
const camelCase = global.yoho.camelCase;
/**
* 处理楼层数据
... ...