mirror of
https://github.com/YMFE/yapi.git
synced 2025-02-05 13:29:43 +08:00
commit
07b331dec6
@ -2,7 +2,7 @@
|
||||
@import '../../styles/mixin.scss';
|
||||
|
||||
.footer{
|
||||
// max-width: 12rem;
|
||||
@include wrap-width-limit;
|
||||
margin: 0px auto;
|
||||
clear: both;
|
||||
font-size: 12px;
|
||||
|
@ -150,8 +150,11 @@ export default class HeaderCom extends Component {
|
||||
'background': 'url(./image/header-bg-img.jpg) no-repeat',
|
||||
'backgroundSize':'100% 100%'
|
||||
};
|
||||
const headerShadeStyle = login?{}:{
|
||||
'background': 'linear-gradient(to bottom,rgba(0,0,0,0.6),rgba(0,0,0,0.5))'
|
||||
const headerShadeStyle = login? {
|
||||
'padding':'0'
|
||||
}: {
|
||||
'background': 'linear-gradient(to bottom,rgba(0,0,0,0.6),rgba(0,0,0,0.5))',
|
||||
'padding':'0'
|
||||
};
|
||||
return (
|
||||
<acticle className={`header-box`} style={headerImgStyle}>
|
||||
|
@ -11,7 +11,7 @@ $color-black-light : #404040;
|
||||
display: block;
|
||||
font-size: 0.14rem;
|
||||
z-index: 99;
|
||||
// 内容宽度
|
||||
@include wrap-width-limit;
|
||||
.content {
|
||||
@include row-width-limit;
|
||||
margin: 0 auto;
|
||||
|
@ -52,6 +52,8 @@ $color-white: #fff;
|
||||
}
|
||||
}
|
||||
.img-container{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding-right: .15rem;
|
||||
//background-image: url("#{$imgUrl}demo-img.png");
|
||||
img{
|
||||
|
@ -12,9 +12,10 @@ $color-black-lighter: #404040;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
.main-one{
|
||||
@include wrap-width-limit;
|
||||
.home-des{
|
||||
color: $color-blue-grey-lighter;
|
||||
padding: .5rem 0 0;
|
||||
padding: .4rem 0 0;
|
||||
.title{
|
||||
font-size: .6rem;
|
||||
}
|
||||
@ -26,7 +27,7 @@ $color-black-lighter: #404040;
|
||||
color: $color-white;
|
||||
}
|
||||
.img-container{
|
||||
margin-bottom: -.2rem;
|
||||
margin-bottom: -.3rem;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -75,6 +76,7 @@ $color-black-lighter: #404040;
|
||||
.main-part{
|
||||
padding: .9rem .5rem;
|
||||
height: 5.8rem;
|
||||
@include wrap-width-limit;
|
||||
&:nth-child(odd){
|
||||
background-color: $color-blue-lighter;
|
||||
}
|
||||
@ -83,6 +85,7 @@ $color-black-lighter: #404040;
|
||||
}
|
||||
}
|
||||
.feat-part{
|
||||
@include wrap-width-limit;
|
||||
padding: .9rem .5rem;
|
||||
background-color: $color-white;
|
||||
p{
|
||||
|
@ -2,3 +2,7 @@
|
||||
max-width: 11.7rem;
|
||||
min-width: 9.7rem;
|
||||
}
|
||||
|
||||
@mixin wrap-width-limit {
|
||||
min-width: 10.7rem;
|
||||
}
|
||||
|
21
config_example.json
Normal file
21
config_example.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"port": "3000",
|
||||
"webhost": "yapi.local.qunar.com",
|
||||
"adminAccount": "admin@admin.com",
|
||||
"db": {
|
||||
"servername": "127.0.0.1",
|
||||
"DATABASE": "yapi",
|
||||
"port": 27017,
|
||||
"user": "test1",
|
||||
"pass": "test1"
|
||||
},
|
||||
"mail": {
|
||||
"host": "smtp.163.com",
|
||||
"port": 465,
|
||||
"from": "***@163.com",
|
||||
"auth": {
|
||||
"user": "***@163.com",
|
||||
"pass": "*****"
|
||||
}
|
||||
}
|
||||
}
|
32
gulpfile.js
32
gulpfile.js
@ -12,14 +12,14 @@ const SRC = 'server/**/*.js';
|
||||
|
||||
function generateBabel(status) {
|
||||
const babelProcess = babel({
|
||||
presets: ['es2015', "stage-3"],
|
||||
presets: ['es2015', 'stage-3'],
|
||||
plugins: ['transform-runtime']
|
||||
});
|
||||
|
||||
babelProcess.on('error', function (e) {
|
||||
const restart = status ? status.count < 2 : true;
|
||||
|
||||
console.error(e);
|
||||
console.error(e); // eslint-disable-line
|
||||
output('error', 'babel 编译失败!', restart);
|
||||
|
||||
if (status) {
|
||||
@ -39,7 +39,13 @@ function excuteCmd(cmd, args, opts) {
|
||||
});
|
||||
|
||||
command.stderr.on('data', data => {
|
||||
output('log', `${NAME} ${data.toString()}`, true);
|
||||
const message = data.toString();
|
||||
|
||||
output('log', `${NAME} ${message}`, true);
|
||||
|
||||
if (~message.indexOf('building complete')) {
|
||||
waitingSpinner();
|
||||
}
|
||||
});
|
||||
|
||||
return command;
|
||||
@ -50,12 +56,12 @@ function output(type, message, restart = false) {
|
||||
|
||||
if (type === 'success') {
|
||||
message = '✔ ' + message;
|
||||
console.log(chalk.green(message));
|
||||
console.log(chalk.green(message)); // eslint-disable-line
|
||||
} else if (type === 'error') {
|
||||
message = '✖ ' + message;
|
||||
console.log(chalk.red(message));
|
||||
console.log(chalk.red(message)); // eslint-disable-line
|
||||
} else {
|
||||
console.log(message);
|
||||
console.log(message); // eslint-disable-line
|
||||
}
|
||||
if (restart) {
|
||||
spinner.start();
|
||||
@ -63,6 +69,7 @@ function output(type, message, restart = false) {
|
||||
}
|
||||
|
||||
function waitingSpinner() {
|
||||
spinner.stop();
|
||||
spinner = ora({
|
||||
text: '等待文件变更...',
|
||||
spinner: 'circleQuarters',
|
||||
@ -71,7 +78,7 @@ function waitingSpinner() {
|
||||
}
|
||||
|
||||
gulp.task('removeDist', [], function () {
|
||||
return fs.removeSync(DIST)
|
||||
return fs.removeSync(DIST);
|
||||
});
|
||||
|
||||
gulp.task('initialBuild', ['removeDist'], () => {
|
||||
@ -95,9 +102,14 @@ gulp.task('initialBuild', ['removeDist'], () => {
|
||||
});
|
||||
|
||||
gulp.task('default', ['initialBuild'], () => {
|
||||
gulp.watch(SRC, (event) => {
|
||||
let originFilePath = path.relative(path.join(__dirname, 'server'), event.path)
|
||||
let distPath = path.resolve(DIST, path.join(originFilePath))
|
||||
gulp.watch('client/**/*', event => {
|
||||
spinner.stop();
|
||||
spinner = ora(`正在编译 ${event.path}`).start();
|
||||
});
|
||||
|
||||
gulp.watch(SRC, event => {
|
||||
let originFilePath = path.relative(path.join(__dirname, 'server'), event.path);
|
||||
let distPath = path.resolve(DIST, path.join(originFilePath));
|
||||
spinner.text = `正在编译 ${event.path}...`;
|
||||
|
||||
gulp.src(event.path).pipe(generateBabel())
|
||||
|
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* config.js是用来第一次安装初始化网站配置,如果不用默认的runtime_path,可以直接修改runtime_path路径
|
||||
*/
|
||||
let config = {
|
||||
"port": 80,
|
||||
"runtime_path": '',
|
||||
"webhost": "yapi.local.qunar.com",
|
||||
"adminAccount": "admin@admin.com",
|
||||
"db": {
|
||||
"servername": "127.0.0.1",
|
||||
"DATABASE": "yapi",
|
||||
"port": 27017
|
||||
},
|
||||
"mail": {
|
||||
"host": "smtp.mail.com",
|
||||
"from": "****@mail.com",
|
||||
"port": 4652,
|
||||
"auth": {
|
||||
"user": "****@mail.com",
|
||||
"pass": "**********"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
import yapi from '../yapi.js'
|
||||
import projectModel from '../models/project.js'
|
||||
import userModel from '../models/user.js'
|
||||
import yapi from '../yapi.js';
|
||||
import projectModel from '../models/project.js';
|
||||
import userModel from '../models/user.js';
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
||||
|
||||
class baseController{
|
||||
constructor(ctx){
|
||||
class baseController {
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
//网站上线后,role对象key是不能修改的,value可以修改
|
||||
this.roles = {
|
||||
admin: 'Admin',
|
||||
member: '网站会员'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async init(ctx){
|
||||
async init(ctx) {
|
||||
this.$user = null;
|
||||
let ignoreRouter = [
|
||||
'/user/login_by_token',
|
||||
@ -22,73 +21,93 @@ class baseController{
|
||||
'/user/reg',
|
||||
'/user/status',
|
||||
'/user/logout'
|
||||
]
|
||||
if(ignoreRouter.indexOf(ctx.path) > -1){
|
||||
];
|
||||
if (ignoreRouter.indexOf(ctx.path) > -1) {
|
||||
this.$auth = true;
|
||||
}else{
|
||||
await this.checkLogin(ctx)
|
||||
} else {
|
||||
await this.checkLogin(ctx);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
getUid(ctx){
|
||||
getUid() {
|
||||
return parseInt(this.$uid, 10);
|
||||
}
|
||||
|
||||
async checkLogin(ctx){
|
||||
async checkLogin(ctx) {
|
||||
let token = ctx.cookies.get('_yapi_token');
|
||||
let uid = ctx.cookies.get('_yapi_uid');
|
||||
try{
|
||||
if(!token || !uid) return false;
|
||||
let uid = ctx.cookies.get('_yapi_uid');
|
||||
|
||||
try {
|
||||
if (!token || !uid) return false;
|
||||
let userInst = yapi.getInst(userModel); //创建user实体
|
||||
let result = await userInst.findById(uid);
|
||||
let decoded = jwt.verify(token, result.passsalt)
|
||||
if(decoded.uid == uid){
|
||||
let decoded = jwt.verify(token, result.passsalt);
|
||||
|
||||
if (decoded.uid == uid) {
|
||||
this.$uid = uid;
|
||||
this.$auth = true;
|
||||
this.$user = result;
|
||||
this.$user = result;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getLoginStatus(ctx){
|
||||
if(await this.checkLogin(ctx) === true){
|
||||
return ctx.body = yapi.commons.resReturn(yapi.commons.fieldSelect(this.$user,['_id','username','email', 'up_time', 'add_time']));
|
||||
async getLoginStatus(ctx) {
|
||||
if (await this.checkLogin(ctx) === true) {
|
||||
return ctx.body = yapi.commons.resReturn(yapi.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']));
|
||||
}
|
||||
return ctx.body = yapi.commons.resReturn(null, 300 , 'Please login.');
|
||||
|
||||
return ctx.body = yapi.commons.resReturn(null, 300, 'Please login.');
|
||||
}
|
||||
|
||||
getRole(){
|
||||
getRole() {
|
||||
return this.$user.role;
|
||||
}
|
||||
|
||||
async jungeProjectAuth(id){
|
||||
async jungeProjectAuth(id) {
|
||||
let model = yapi.getInst(projectModel);
|
||||
if(this.getRole() === 'admin') return true;
|
||||
if(!id) return false;
|
||||
let result = await model.get(id);
|
||||
if(result.uid === this.getUid()){
|
||||
|
||||
if (this.getRole() === 'admin') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let result = await model.get(id);
|
||||
|
||||
if (result.uid === this.getUid()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async jungeMemberAuth(id, member_uid){
|
||||
async jungeMemberAuth(id, member_uid) {
|
||||
let model = yapi.getInst(projectModel);
|
||||
if(this.getRole() === 'admin') return true;
|
||||
if(!id || !member_uid) return false;
|
||||
let result = await model.checkMemberRepeat(id, member_uid);
|
||||
if(result > 0){
|
||||
|
||||
if (this.getRole() === 'admin') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!id || !member_uid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let result = await model.checkMemberRepeat(id, member_uid);
|
||||
|
||||
if (result > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = baseController
|
||||
module.exports = baseController;
|
@ -1,14 +1,12 @@
|
||||
import groupModel from '../models/group.js'
|
||||
import yapi from '../yapi.js'
|
||||
import baseController from './base.js'
|
||||
import projectModel from '../models/project.js'
|
||||
import groupModel from '../models/group.js';
|
||||
import yapi from '../yapi.js';
|
||||
import baseController from './base.js';
|
||||
import projectModel from '../models/project.js';
|
||||
|
||||
//
|
||||
class groupController extends baseController{
|
||||
constructor(ctx){
|
||||
super(ctx)
|
||||
class groupController extends baseController {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加项目分组
|
||||
@ -23,37 +21,45 @@ class groupController extends baseController{
|
||||
*/
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
|
||||
params = yapi.commons.handleParams(params, {
|
||||
group_name: 'string',
|
||||
group_desc: 'string'
|
||||
})
|
||||
if(this.getRole() !== 'admin'){
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'没有权限');
|
||||
});
|
||||
|
||||
if (this.getRole() !== 'admin') {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '没有权限');
|
||||
}
|
||||
if(!params.group_name){
|
||||
|
||||
if (!params.group_name) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目分组名不能为空');
|
||||
}
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
|
||||
var checkRepeat = await groupInst.checkRepeat(params.group_name);
|
||||
if(checkRepeat > 0){
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '项目分组名已存在');
|
||||
|
||||
let groupInst = yapi.getInst(groupModel);
|
||||
|
||||
let checkRepeat = await groupInst.checkRepeat(params.group_name);
|
||||
|
||||
if (checkRepeat > 0) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '项目分组名已存在');
|
||||
}
|
||||
|
||||
let data = {
|
||||
group_name: params.group_name,
|
||||
group_desc: params.group_desc,
|
||||
uid: this.getUid(),
|
||||
add_time: yapi.commons.time(),
|
||||
up_time: yapi.commons.time()
|
||||
}
|
||||
try{
|
||||
};
|
||||
|
||||
try {
|
||||
let result = await groupInst.save(data);
|
||||
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid']);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
} catch (e) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,14 +71,13 @@ class groupController extends baseController{
|
||||
* @returns {Object}
|
||||
* @example ./api/group/list.json
|
||||
*/
|
||||
|
||||
async list(ctx) {
|
||||
try{
|
||||
try {
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
let result = await groupInst.list();
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (e) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,27 +91,30 @@ class groupController extends baseController{
|
||||
* @returns {Object}
|
||||
* @example ./api/group/del.json
|
||||
*/
|
||||
async del(ctx) {
|
||||
if (this.getRole() !== 'admin') {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '没有权限');
|
||||
}
|
||||
|
||||
async del(ctx){
|
||||
if(this.getRole() !== 'admin'){
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'没有权限');
|
||||
}
|
||||
try{
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
var projectInst = yapi.getInst(projectModel);
|
||||
let id = ctx.request.body.id;
|
||||
if(!id){
|
||||
try {
|
||||
let groupInst = yapi.getInst(groupModel);
|
||||
let projectInst = yapi.getInst(projectModel);
|
||||
let id = ctx.request.body.id;
|
||||
|
||||
if (!id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 402, 'id不能为空');
|
||||
}
|
||||
let count = await projectInst.countByGroupId(id);
|
||||
if(count > 0){
|
||||
|
||||
let count = await projectInst.countByGroupId(id);
|
||||
|
||||
if (count > 0) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 403, '请先删除该分组下的项目');
|
||||
}
|
||||
|
||||
let result = await groupInst.del(id);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (err) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,33 +130,32 @@ class groupController extends baseController{
|
||||
* @returns {Object}
|
||||
* @example ./api/group/up.json
|
||||
*/
|
||||
|
||||
async up(ctx){
|
||||
if(this.getRole() !== 'admin'){
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'没有权限');
|
||||
async up(ctx) {
|
||||
if (this.getRole() !== 'admin') {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '没有权限');
|
||||
}
|
||||
try{
|
||||
|
||||
|
||||
try {
|
||||
|
||||
ctx.request.body = yapi.commons.handleParams(ctx.request.body, {
|
||||
id: 'number',
|
||||
group_name: 'string',
|
||||
group_desc: 'string'
|
||||
})
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
});
|
||||
let groupInst = yapi.getInst(groupModel);
|
||||
let id = ctx.request.body.id;
|
||||
let data = {};
|
||||
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name)
|
||||
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc)
|
||||
if(Object.keys(data).length === 0 ){
|
||||
ctx.request.body.group_name && (data.group_name = ctx.request.body.group_name);
|
||||
ctx.request.body.group_desc && (data.group_desc = ctx.request.body.group_desc);
|
||||
if (Object.keys(data).length === 0) {
|
||||
ctx.body = yapi.commons.resReturn(null, 404, '分组名和分组描述不能为空');
|
||||
}
|
||||
let result = await groupInst.up(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (err) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = groupController
|
||||
module.exports = groupController;
|
@ -1,5 +1,4 @@
|
||||
import fs from 'fs-extra';
|
||||
import initConfig from './utils/initConfig.js'
|
||||
import yapi from './yapi.js';
|
||||
import commons from './utils/commons';
|
||||
import dbModule from './utils/db.js';
|
||||
|
@ -1,22 +1,17 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import nodemailer from 'nodemailer';
|
||||
import config from '../runtime/config.json';
|
||||
import config from '../../config.json';
|
||||
|
||||
let insts = new Map();
|
||||
let mail;
|
||||
|
||||
if(!config.runtime_path){
|
||||
config.runtime_path = path.join(path.resolve(__dirname, '../'), 'runtime')
|
||||
}
|
||||
|
||||
const WEBROOT = path.resolve(__dirname, '..'); //路径
|
||||
const WEBROOT_SERVER = __dirname;
|
||||
const WEBROOT_RUNTIME = config.runtime_path;
|
||||
const WEBROOT_RUNTIME = path.resolve(__dirname, '../..');
|
||||
const WEBROOT_LOG = path.join(WEBROOT_RUNTIME, 'log');
|
||||
const WEBCONFIG = config;
|
||||
|
||||
fs.ensureDirSync(WEBROOT_RUNTIME);
|
||||
fs.ensureDirSync(WEBROOT_LOG);
|
||||
|
||||
if (WEBCONFIG.mail) {
|
||||
|
@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* config.js是用来第一次安装初始化网站配置,如果不用默认的runtime_path,可以直接修改runtime_path路径
|
||||
*/
|
||||
var config = {
|
||||
"port": 80,
|
||||
"runtime_path": '',
|
||||
"webhost": "yapi.local.qunar.com",
|
||||
"adminAccount": "admin@admin.com",
|
||||
"db": {
|
||||
"servername": "127.0.0.1",
|
||||
"DATABASE": "yapi",
|
||||
"port": 27017
|
||||
},
|
||||
"mail": {
|
||||
"host": "smtp.mail.com",
|
||||
"from": "****@mail.com",
|
||||
"port": 4652,
|
||||
"auth": {
|
||||
"user": "****@mail.com",
|
||||
"pass": "**********"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
@ -4,10 +4,6 @@ var _fsExtra = require('fs-extra');
|
||||
|
||||
var _fsExtra2 = _interopRequireDefault(_fsExtra);
|
||||
|
||||
var _initConfig = require('./utils/initConfig.js');
|
||||
|
||||
var _initConfig2 = _interopRequireDefault(_initConfig);
|
||||
|
||||
var _yapi = require('./yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
@ -16,7 +16,7 @@ var _nodemailer = require('nodemailer');
|
||||
|
||||
var _nodemailer2 = _interopRequireDefault(_nodemailer);
|
||||
|
||||
var _config = require('../runtime/config.json');
|
||||
var _config = require('../../config.json');
|
||||
|
||||
var _config2 = _interopRequireDefault(_config);
|
||||
|
||||
@ -25,17 +25,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
var insts = new _map2.default();
|
||||
var mail = void 0;
|
||||
|
||||
if (!_config2.default.runtime_path) {
|
||||
_config2.default.runtime_path = _path2.default.join(_path2.default.resolve(__dirname, '../'), 'runtime');
|
||||
}
|
||||
|
||||
var WEBROOT = _path2.default.resolve(__dirname, '..'); //路径
|
||||
var WEBROOT_SERVER = __dirname;
|
||||
var WEBROOT_RUNTIME = _config2.default.runtime_path;
|
||||
var WEBROOT_RUNTIME = _path2.default.resolve(__dirname, '../..');
|
||||
var WEBROOT_LOG = _path2.default.join(WEBROOT_RUNTIME, 'log');
|
||||
var WEBCONFIG = _config2.default;
|
||||
|
||||
_fsExtra2.default.ensureDirSync(WEBROOT_RUNTIME);
|
||||
_fsExtra2.default.ensureDirSync(WEBROOT_LOG);
|
||||
|
||||
if (WEBCONFIG.mail) {
|
||||
|
Loading…
Reference in New Issue
Block a user