Authored by 周奇琪

Merge branch 'master' into develop

@@ -82,9 +82,9 @@ gulp.task("clean",function(){ @@ -82,9 +82,9 @@ gulp.task("clean",function(){
82 gulp.task("buildjs",["js"],function(){ 82 gulp.task("buildjs",["js"],function(){
83 gulp.src(path.join(public_dir,"dist") + '/*.js') 83 gulp.src(path.join(public_dir,"dist") + '/*.js')
84 .pipe(uglify()) 84 .pipe(uglify())
85 - .pipe(rename({  
86 - suffix:md5  
87 - })) 85 + // .pipe(rename({
  86 + // suffix:md5
  87 + // }))
88 .pipe(gulp.dest(dist_dir.js)); 88 .pipe(gulp.dest(dist_dir.js));
89 }); 89 });
90 //发布静态资源 90 //发布静态资源
@@ -10,6 +10,7 @@ var path = require('path'); @@ -10,6 +10,7 @@ var path = require('path');
10 var fs = require('fs'); 10 var fs = require('fs');
11 var logger = console; 11 var logger = console;
12 var config = require('../config/common'); 12 var config = require('../config/common');
  13 +var staticOptions = require('../staticConfig');
13 14
14 /** 15 /**
15 * 模块名处理,根据环境设置模块名 16 * 模块名处理,根据环境设置模块名
@@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) { @@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) {
135 }); 136 });
136 } 137 }
137 138
  139 +/**
  140 + * 获取API DOC配置
  141 + * @param {Object} routers 路由
  142 + */
138 exports.getInterfaceConfig = function (routers) { 143 exports.getInterfaceConfig = function (routers) {
  144 + var env = process.env.NODE_ENV || 'development';
  145 + var cssFile = 'css/all.css';
  146 + if(env !== 'development') {
  147 + cssFile = staticOptions.staticDir[env]+'/all.css';
  148 + }
  149 +
139 return function(req,res) { 150 return function(req,res) {
140 if(req.query.key === config.apiKey) { 151 if(req.query.key === config.apiKey) {
141 var groupList = []; 152 var groupList = [];
@@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) { @@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) {
160 171
161 navs[0].active = true; 172 navs[0].active = true;
162 groupList[0].active = true; 173 groupList[0].active = true;
163 - res.render('pages/apidoc/doc',{nav:navs,group:groupList,layout:false}); 174 + res.render('pages/apidoc/doc',{cssFile:cssFile,nav:navs,group:groupList,layout:false});
164 } else { 175 } else {
165 res.status(403).send('Permission denied'); 176 res.status(403).send('Permission denied');
166 } 177 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 <title>YOHO!BUY API DOC</title> 9 <title>YOHO!BUY API DOC</title>
10 10
11 - <link href="css/all.css" rel="stylesheet"> 11 + <link href="{{cssFile}}" rel="stylesheet">
12 </head> 12 </head>
13 13
14 <body> 14 <body>