Authored by ccbikai

优化代码

@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 'use strict'; 6 'use strict';
7 const _ = require('lodash'); 7 const _ = require('lodash');
8 const channelModel = require('../models/channel'); 8 const channelModel = require('../models/channel');
9 -const helpers = require('../../../library/helpers');  
10 -const log = require('../../../library/logger');  
11 -const cookie = require('../../../library/cookie'); 9 +const helpers = require(`${global.library}/helpers`);
  10 +const log = require(`${global.library}/logger`);
  11 +const cookie = require(`${global.library}/cookie`);
12 12
13 const renderData = { 13 const renderData = {
14 module: 'channel', 14 module: 'channel',
@@ -24,7 +24,7 @@ app.engine('.hbs', hbs({ @@ -24,7 +24,7 @@ app.engine('.hbs', hbs({
24 defaultLayout: 'layout', 24 defaultLayout: 'layout',
25 layoutsDir: doraemon, 25 layoutsDir: doraemon,
26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
27 - helpers: require('../../library/helpers') 27 + helpers: require(`${global.library}/helpers`)
28 })); 28 }));
29 29
30 // router 30 // router
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 const _ = require('lodash'); 7 const _ = require('lodash');
8 -const API = require('../../../library/api').ServiceAPI;  
9 -const sign = require('../../../library/sign');  
10 -const camelCase = require('../../../library/camel-case'); 8 +const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
  9 +const sign = require(`${global.library}/sign`);
  10 +const camelCase = require(`${global.library}/camel-case`);
11 11
12 -const api = new API(); 12 +const api = new ServiceAPI();
13 13
14 const genderData = { 14 const genderData = {
15 boys: '1,3', 15 boys: '1,3',
@@ -14,7 +14,7 @@ module.exports = { @@ -14,7 +14,7 @@ module.exports = {
14 siteUrl: 'http://m.yohobuy.com', 14 siteUrl: 'http://m.yohobuy.com',
15 domains: { 15 domains: {
16 api: 'http://testapi.yoho.cn:28078/', // http://devapi.yoho.cn:58078/ http://testapi.yoho.cn:28078/ 16 api: 'http://testapi.yoho.cn:28078/', // http://devapi.yoho.cn:58078/ http://testapi.yoho.cn:28078/
17 - service: 'http://devapi.yoho.cn:58078/' 17 + service: 'http://testservice.yoho.cn:28077/'
18 }, 18 },
19 useOneapm: false, 19 useOneapm: false,
20 useCache: false, 20 useCache: false,
@@ -18,7 +18,6 @@ const api = config.domains.api; @@ -18,7 +18,6 @@ const api = config.domains.api;
18 const serviceApi = config.domains.service; 18 const serviceApi = config.domains.service;
19 const searchApi = config.domains.search; 19 const searchApi = config.domains.search;
20 20
21 -  
22 let ApiUrl; 21 let ApiUrl;
23 22
24 class API { 23 class API {