mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
用户登录
This commit is contained in:
commit
ab15fb7053
@ -25,7 +25,8 @@
|
||||
"koa-session-minimal": "^3.0.3",
|
||||
"koa-static": "^3.0.0",
|
||||
"koa-views": "^5.2.0",
|
||||
"mongoose": "4.10.8"
|
||||
"mongoose": "4.10.8",
|
||||
"mongoose-auto-increment": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.24.1",
|
||||
|
@ -6,15 +6,18 @@ yapi.commons = commons;
|
||||
|
||||
import dbModule from './utils/db.js';
|
||||
|
||||
import userauth from './middleware/userauth.js'
|
||||
|
||||
import Koa from 'koa'
|
||||
import convert from 'koa-convert'
|
||||
import koaStatic from 'koa-static'
|
||||
import bodyParser from 'koa-bodyparser'
|
||||
import router from './router.js'
|
||||
|
||||
|
||||
yapi.connect = dbModule.connect()
|
||||
|
||||
const app = new Koa()
|
||||
app.use(userauth)
|
||||
app.use(bodyParser())
|
||||
app.use(router.routes())
|
||||
app.use(router.allowedMethods())
|
||||
@ -28,7 +31,9 @@ commons.log(`the server is start at port ${yapi.WEBCONFIG.port}`)
|
||||
|
||||
yapi.fs.ensureDirSync(yapi.WEBROOT_RUNTIME);
|
||||
yapi.fs.ensureDirSync(yapi.WEBROOT_LOG);
|
||||
dbModule.connect()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
16
server/controllers/base.js
Normal file
16
server/controllers/base.js
Normal file
@ -0,0 +1,16 @@
|
||||
import yapi from '../yapi.js'
|
||||
class baseController{
|
||||
constructor(ctx){
|
||||
console.log('baseControler init...')
|
||||
}
|
||||
|
||||
getUid(){
|
||||
return 0
|
||||
}
|
||||
|
||||
getLoginStatus(){
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = baseController
|
@ -1,13 +1,22 @@
|
||||
import groupModel from '../models/group.js'
|
||||
import yapi from '../yapi.js'
|
||||
import baseController from './base.js'
|
||||
|
||||
|
||||
class groupController extends baseController{
|
||||
constructor(){
|
||||
super()
|
||||
console.log('constructor....')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
if(!params.group_name){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '组名不能为空');
|
||||
}
|
||||
var checkRepeat = await groupModel.checkRepeat(params.group_name);
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
|
||||
var checkRepeat = await groupInst.checkRepeat(params.group_name);
|
||||
if(checkRepeat > 0){
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '组名已存在');
|
||||
}
|
||||
@ -19,36 +28,39 @@ module.exports = {
|
||||
up_time: yapi.commons.time()
|
||||
}
|
||||
try{
|
||||
let result = await groupModel.save(data);
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid'])
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
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)
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
async list(ctx) {
|
||||
try{
|
||||
let result = await groupModel.list();
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
let result = await groupInst.list();
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){ //会不会有问题 err e.message
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
async del(ctx){
|
||||
try{
|
||||
var groupInst = yapi.getInst(groupModel);
|
||||
let id = ctx.request.body.id;
|
||||
let result = await groupModel.del(id);
|
||||
let result = await groupInst.del(id);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
async up(ctx){
|
||||
try{
|
||||
var 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)
|
||||
@ -56,10 +68,13 @@ module.exports = {
|
||||
if(Object.keys(data).length ===0){
|
||||
ctx.body = yapi.commons.resReturn(null, 404, '分组名和分组描述都为空');
|
||||
}
|
||||
let result = await groupModel.up(id, data);
|
||||
let result = await groupInst.up(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = groupController
|
||||
|
65
server/controllers/project.js
Normal file
65
server/controllers/project.js
Normal file
@ -0,0 +1,65 @@
|
||||
import projectModel from '../models/project.js'
|
||||
import yapi from '../yapi.js'
|
||||
|
||||
module.exports = {
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
if(!params.project_name){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '组名不能为空');
|
||||
}
|
||||
var checkRepeat = await projectModel.checkRepeat(params.project_name);
|
||||
if(checkRepeat > 0){
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '组名已存在');
|
||||
}
|
||||
let data = {
|
||||
project_name: params.project_name,
|
||||
project_desc: params.project_desc,
|
||||
uid: '0',
|
||||
add_time: yapi.commons.time(),
|
||||
up_time: yapi.commons.time()
|
||||
}
|
||||
try{
|
||||
let result = await projectModel.save(data);
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'project_name', 'project_desc', 'uid']);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async list(ctx) {
|
||||
try{
|
||||
let result = await projectModel.list();
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async del(ctx){
|
||||
try{
|
||||
let id = ctx.request.body.id;
|
||||
let result = await projectModel.del(id);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async up(ctx){
|
||||
try{
|
||||
let id = ctx.request.body.id;
|
||||
let data = {};
|
||||
ctx.request.body.project_name && (data.project_name = ctx.request.body.project_name)
|
||||
ctx.request.body.project_desc && (data.project_desc = ctx.request.body.project_desc)
|
||||
if(Object.keys(data).length ===0){
|
||||
ctx.body = yapi.commons.resReturn(null, 404, '分组名和分组描述都为空');
|
||||
}
|
||||
let result = await projectModel.up(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,77 +1,119 @@
|
||||
import userModel from '../models/user.js'
|
||||
import yapi from '../yapi.js'
|
||||
import baseController from './base.js'
|
||||
|
||||
module.exports = {
|
||||
async login(ctx){
|
||||
let params = ctx.request.body;
|
||||
if(!params.user_name){
|
||||
class userController extends baseController{
|
||||
constructor(){
|
||||
super()
|
||||
console.log('constructor...')
|
||||
}
|
||||
async login(ctx){ //登录
|
||||
var userInst = yapi.getInst(userModel); //创建user实体
|
||||
let username = ctx.request.body.username;
|
||||
let password = sha1(ctx.request.body.password);
|
||||
let id = ctx.request.body.id;
|
||||
let result = await userInst.getUser(id); //获取登录用户的id
|
||||
if(!username){
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'用户名不能为空');
|
||||
}
|
||||
if(!params.user_pwd){
|
||||
if(!password){
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'密码不能为空');
|
||||
}
|
||||
//输入一个不存在的用户名
|
||||
|
||||
//用户名存在,判断密码是否正确
|
||||
var checkRepeat = await userModel.checkRepeat(params.user_name);
|
||||
if(checkRepeat>0){
|
||||
let name = ctx.request.body.user_name;
|
||||
var checkRepeat = await userInst.checkRepeat(username);//然后检查是否已经存在该用户
|
||||
if(checkRepeat==0){
|
||||
return ctx.body = yapi.commons.resReturn(null,404,'该用户不存在'); //返回的错误码对吗????
|
||||
}else if(result.password===password){ //用户名存在,判断密码是否正确,正确则可以登录
|
||||
console.log('密码一致'); //是不是还需要把用户名密码一些东西写到session
|
||||
|
||||
}else{
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'密码错误');
|
||||
}
|
||||
|
||||
},
|
||||
async add(ctx){ //增加一个用户,即注册
|
||||
let params = ctx.request.body; //获取请求的参数
|
||||
if(!params.user_name){
|
||||
}
|
||||
async reg(ctx){ //注册
|
||||
var userInst = yapi.getInst(userModel);
|
||||
let params = ctx.request.body; //获取请求的参数,检查是否存在用户名和密码
|
||||
if(!params.username){
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'用户名不能为空');
|
||||
}
|
||||
var checkRepeat = await userModel.checkRepeat(params.user_name);
|
||||
if(!params.password){
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'密码不能为空');
|
||||
}
|
||||
if(!params.email){
|
||||
return ctx.body = yapi.commons.resReturn(null,400,'邮箱不能为空');
|
||||
}
|
||||
|
||||
var checkRepeat = await userInst.checkRepeat(params.username);//然后检查是否已经存在该用户
|
||||
if(checkRepeat>0){
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'用户已存在');
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'该用户名已经注册');
|
||||
}
|
||||
var checkRepeat = await userInst.checkRepeat(params.email);//然后检查是否已经存在该用户
|
||||
if(checkRepeat>0){
|
||||
return ctx.body = yapi.commons.resReturn(null,401,'该邮箱已经注册');
|
||||
}
|
||||
let data = {
|
||||
user_name: params.user_name,
|
||||
user_pwd: params.user_pwd,
|
||||
username: params.username,
|
||||
password: sha1(params.password),//加密
|
||||
email: params.email,
|
||||
role: params.role,
|
||||
add_time: yapi.commons.time(),
|
||||
up_time: yapi.commons.time()
|
||||
}
|
||||
try{
|
||||
let user = await userModel.save(data);
|
||||
user = yapi.commons.fieldSelect(user,['id','user_name','user_pwd'])
|
||||
let user = await userInst.save(data);
|
||||
user = yapi.commons.fieldSelect(user,['id','username','password','email','role'])
|
||||
ctx.body = yapi.commons.resReturn(user);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(e.message);
|
||||
}
|
||||
},
|
||||
async list(ctx){
|
||||
}
|
||||
async list(ctx){ //获取用户列表并分页
|
||||
var userInst = yapi.getInst(userModel);
|
||||
try{
|
||||
let user = await userModel.list();
|
||||
let user = await userInst.list();
|
||||
return ctx.body = yapi.commons.resReturn(user);
|
||||
}catch(e){
|
||||
return ctx.body = yapi.commons.resReturn(null,402,e.message);
|
||||
}
|
||||
},
|
||||
async del(ctx){
|
||||
try{
|
||||
let name = ctx.request.body.user_name;
|
||||
let result = await userModel.del(name);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null,402,e.message);
|
||||
}
|
||||
},
|
||||
async up(ctx){
|
||||
try{
|
||||
}
|
||||
async getUser(ctx){ //根据id获取用户信息
|
||||
try{
|
||||
var userInst = yapi.getInst(userModel);
|
||||
let id = ctx.request.body.id;
|
||||
let data ={};
|
||||
ctx.request.body.user_name && (data.user_name = ctx.request.body.user_name)
|
||||
ctx.request.body.user_pwd && (data.user_pwd = ctx.request.body.user_pwd)
|
||||
if (Object.keys(data).length===0){
|
||||
ctx.body = yapi.commons.resReturn(null,404,'用户名和用户描述为空');
|
||||
}
|
||||
let result = await userModel.up(id,data);
|
||||
let result = await userInst.getUser(id);
|
||||
return ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
return ctx.body = yapi.commons.resReturn(null,402,e.message);
|
||||
}
|
||||
}
|
||||
async del(ctx){ //根据id删除一个用户
|
||||
try{
|
||||
var userInst = yapi.getInst(userModel);
|
||||
let id = ctx.request.body.id;
|
||||
let result = await userInst.del(id);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null,402,e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
async update(ctx){ //更新用户信息
|
||||
try{
|
||||
var userInst = yapi.getInst(userModel);
|
||||
let id = ctx.request.body.id;
|
||||
let data ={};
|
||||
ctx.request.body.username && (data.username = ctx.request.body.username)
|
||||
ctx.request.body.password && (data.password = ctx.request.body.password)
|
||||
ctx.request.body.email && (data.email = ctx.request.body.email)
|
||||
ctx.request.body.role && (data.role = ctx.request.body.role)
|
||||
if (Object.keys(data).length===0){
|
||||
ctx.body = yapi.commons.resReturn(null,404,'用户名、密码、Email、role都为空');
|
||||
}
|
||||
let result = await userInst.update(id,data);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null,402,e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = userController
|
7
server/middleware/mockServer.js
Normal file
7
server/middleware/mockServer.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = async (ctx, next) => {
|
||||
let hostname = ctx.hostname
|
||||
|
||||
|
||||
|
||||
if(next) await next();
|
||||
}
|
6
server/middleware/userauth.js
Normal file
6
server/middleware/userauth.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = async (ctx, next) => {
|
||||
let path = ctx.path;
|
||||
console.log(path)
|
||||
console.log(ctx.hostname)
|
||||
if(next) await next();
|
||||
}
|
34
server/models/base.js
Normal file
34
server/models/base.js
Normal file
@ -0,0 +1,34 @@
|
||||
import yapi from '../yapi.js'
|
||||
import mongoose from 'mongoose'
|
||||
import autoIncrement from 'mongoose-auto-increment'
|
||||
|
||||
|
||||
/**
|
||||
* 所有的model都需要继承baseModel, 且需要 getSchema和getName方法,不然会报错
|
||||
*/
|
||||
|
||||
class baseModel{
|
||||
|
||||
constructor(){
|
||||
this.schema = new mongoose.Schema(this.getSchema())
|
||||
this.name = this.getName()
|
||||
this.schema.plugin(autoIncrement.plugin, this.name)
|
||||
this.model = yapi.db(this.name, this.schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取collection的schema结构
|
||||
*/
|
||||
|
||||
getSchema(){
|
||||
yapi.commons.log('Model Class need getSchema function', 'error')
|
||||
}
|
||||
|
||||
getName(){
|
||||
yapi.commons.log('Model Class need name', 'error')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = baseModel;
|
@ -1,35 +1,41 @@
|
||||
import yapi from '../yapi.js'
|
||||
const groupSchema = {
|
||||
uid: String,
|
||||
group_name: String,
|
||||
group_desc: String,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
}
|
||||
import mongoose from 'mongoose'
|
||||
import baseModel from './base.js'
|
||||
|
||||
var groupModel = yapi.db('group', groupSchema);
|
||||
class groupModel extends baseModel{
|
||||
getName(){
|
||||
return 'group'
|
||||
}
|
||||
|
||||
getSchema(){
|
||||
return {
|
||||
uid: String,
|
||||
group_name: String,
|
||||
group_desc: String,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
save: (data) => {
|
||||
let m = new groupModel(data);
|
||||
save(data) {
|
||||
let m = new this.model(data);
|
||||
return m.save();
|
||||
},
|
||||
checkRepeat: (name) => {
|
||||
return groupModel.count({
|
||||
}
|
||||
checkRepeat(name) {
|
||||
return this.model.count({
|
||||
group_name: name
|
||||
})
|
||||
},
|
||||
list: () => {
|
||||
return groupModel.find().select("group_name _id group_name group_desc add_time up_time").exec() //增加了group_name
|
||||
},
|
||||
del: (id) => {
|
||||
return groupModel.deleteOne({
|
||||
}
|
||||
list(){
|
||||
return this.model.find().select("group_name _id group_desc add_time up_time").exec()
|
||||
}
|
||||
del (id) {
|
||||
return this.model.deleteOne({
|
||||
_id: id
|
||||
})
|
||||
},
|
||||
up: (id, data) => {
|
||||
return groupModel.update({
|
||||
}
|
||||
up (id, data) {
|
||||
return this.model.update({
|
||||
_id: id,
|
||||
}, {
|
||||
group_name: data.group_name,
|
||||
@ -37,4 +43,9 @@ module.exports = {
|
||||
up_time: yapi.commons.time()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports= groupModel
|
44
server/models/project.js
Normal file
44
server/models/project.js
Normal file
@ -0,0 +1,44 @@
|
||||
import yapi from '../yapi.js'
|
||||
const projectSchema = {
|
||||
uid: Number,
|
||||
name: String,
|
||||
basepath: String,
|
||||
desc: String,
|
||||
group_id: Number,
|
||||
members: Array,
|
||||
prd_host: String,
|
||||
env: Object,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
}
|
||||
|
||||
|
||||
var projectModel = yapi.db('project', projectSchema);
|
||||
|
||||
|
||||
module.exports = {
|
||||
save: (data) => {
|
||||
let m = new projectModel(data);
|
||||
return m.save();
|
||||
},
|
||||
checkRepeat: (name, basepath) => {
|
||||
return projectModel.count({
|
||||
project_name: name,
|
||||
basepath: basepath
|
||||
})
|
||||
},
|
||||
list: () => {
|
||||
return projectModel.find().exec()
|
||||
},
|
||||
del: (id) => {
|
||||
return projectModel.deleteOne({
|
||||
_id: id
|
||||
})
|
||||
},
|
||||
up: (id, data) => {
|
||||
data.up_time = yapi.commons.time();
|
||||
return projectModel.update({
|
||||
_id: id,
|
||||
}, data)
|
||||
}
|
||||
}
|
@ -1,38 +1,57 @@
|
||||
import yapi from '../yapi.js'
|
||||
const userSchema = {
|
||||
user_name: String,
|
||||
user_pwd: String,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
}
|
||||
import mongoose from 'mongoose'
|
||||
import baseModel from './base.js'
|
||||
|
||||
var userModel = yapi.db('user',userSchema);
|
||||
class userModel extends baseModel{
|
||||
getName(){
|
||||
return 'user'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
save: (data)=>{
|
||||
let user = new userModel(data);
|
||||
getSchema(){
|
||||
return{
|
||||
username: String,
|
||||
password: String,
|
||||
passsalt: String,
|
||||
email: String,
|
||||
role: String,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
}
|
||||
}
|
||||
save(data){
|
||||
let user = new this.model(data);
|
||||
return user.save();
|
||||
},
|
||||
checkRepeat:(name)=>{
|
||||
return userModel.count({
|
||||
user_name: name
|
||||
}
|
||||
checkRepeat(name){
|
||||
return this.model.count({
|
||||
username: name
|
||||
})
|
||||
},
|
||||
list:()=>{
|
||||
return userModel.find().select("user_name_id user_name user_pwd add_time up_time").exec()
|
||||
},
|
||||
del:(name)=>{
|
||||
return userModel.find({"user_name":name}).remove()
|
||||
},
|
||||
up:(id,data)=>{
|
||||
return userModel.update({
|
||||
}
|
||||
list(){
|
||||
return this.model.find().select("username_id username email role add_time up_time").exec() //显示id name email role
|
||||
}
|
||||
getUser(id){
|
||||
return this.model.findById({
|
||||
_id: id
|
||||
})
|
||||
}
|
||||
del (id) {
|
||||
return this.model.deleteOne({
|
||||
_id: id
|
||||
})
|
||||
}
|
||||
update(id,data){
|
||||
return this.model.update({
|
||||
_id: id,
|
||||
},{
|
||||
user_name: data.user_name,
|
||||
user_pwd: data.user_pwd,
|
||||
username: data.username,
|
||||
password: data.password,
|
||||
email: data.email,
|
||||
role: data.role,
|
||||
up_time: yapi.commons.time()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = userModel
|
||||
|
@ -5,21 +5,49 @@ import userController from './controllers/user.js'
|
||||
|
||||
const router = koaRouter();
|
||||
|
||||
const INTERFACE_PREFIX = {
|
||||
interface: '/interface/',
|
||||
user: '/user/',
|
||||
group: '/group/'
|
||||
const INTERFACE_CONFIG = {
|
||||
interface: {
|
||||
prefix: '/interface/',
|
||||
controller: interfaceController
|
||||
},
|
||||
user: {
|
||||
prefix: '/user/',
|
||||
controller: userController
|
||||
},
|
||||
group: {
|
||||
prefix: '/group/',
|
||||
controller: groupController
|
||||
}
|
||||
};
|
||||
|
||||
router.post ( INTERFACE_PREFIX.interface + 'add', interfaceController.add)
|
||||
.get ( INTERFACE_PREFIX.interface + 'list', interfaceController.list)
|
||||
.get ( INTERFACE_PREFIX.group + 'list', groupController.list)
|
||||
.post ( INTERFACE_PREFIX.group + 'add', groupController.add)
|
||||
.post ( INTERFACE_PREFIX.group + 'up', groupController.up)
|
||||
.post ( INTERFACE_PREFIX.group + 'del', groupController.del)
|
||||
.get (INTERFACE_PREFIX.user + 'list', userController.list)
|
||||
.post (INTERFACE_PREFIX.user + 'add', userController.add)
|
||||
.post(INTERFACE_PREFIX.user + 'up', userController.up)
|
||||
.post(INTERFACE_PREFIX.user + 'del', userController.del)
|
||||
//group
|
||||
createAction('group', 'list', 'get', 'list')
|
||||
createAction('group', 'add', 'post', 'add')
|
||||
createAction('group', 'up', 'post', 'up')
|
||||
createAction('group', 'del', 'post', 'del')
|
||||
|
||||
//user
|
||||
createAction('user', 'login', 'post', 'login')
|
||||
createAction('user', 'reg', 'post', 'reg')
|
||||
createAction('user', 'list', 'get', 'list')
|
||||
createAction('user', 'getUser', 'get', 'getUser')
|
||||
createAction('user', 'update', 'post', 'update')
|
||||
createAction('user', 'del', 'post', 'del')
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} controller controller_name
|
||||
* @param {*} path request_path
|
||||
* @param {*} method request_method , post get put delete ...
|
||||
* @param {*} action controller_action_name
|
||||
*/
|
||||
function createAction(controller, path, method, action){
|
||||
router[method](INTERFACE_CONFIG[controller].prefix + path, async (ctx) => {
|
||||
let inst = new INTERFACE_CONFIG[controller].controller(ctx);
|
||||
await inst[action].call(inst, ctx);
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = router
|
||||
|
||||
module.exports = router
|
@ -1,8 +1,15 @@
|
||||
import mongoose from 'mongoose'
|
||||
import yapi from '../yapi.js'
|
||||
import autoIncrement from 'mongoose-auto-increment'
|
||||
|
||||
function model(model, schema){
|
||||
return mongoose.model(model, schema, model)
|
||||
if(schema instanceof mongoose.Schema === false){
|
||||
schema = new mongoose.Schema(schema);
|
||||
}
|
||||
|
||||
|
||||
schema.set('autoIndex', false);
|
||||
return yapi.connect.model(model, schema, model)
|
||||
}
|
||||
|
||||
function connect(){
|
||||
@ -17,6 +24,7 @@ function connect(){
|
||||
yapi.commons.log(err, 'Mongo connect error');
|
||||
})
|
||||
|
||||
autoIncrement.initialize(db);
|
||||
|
||||
checkDatabase();
|
||||
return db;
|
||||
|
@ -4,6 +4,7 @@ import prdConfig from './config.json'
|
||||
import devConfig from './config.dev.json'
|
||||
let args = process.argv.splice(2);
|
||||
let isDev = args[0] === 'dev' ? true : false;
|
||||
var insts = new Map();
|
||||
const config = isDev ? devConfig : prdConfig;
|
||||
|
||||
const WEBROOT = path.resolve(__dirname, '..'); //路径
|
||||
@ -12,6 +13,27 @@ const WEBROOT_RUNTIME = path.join(WEBROOT, 'runtime');
|
||||
const WEBROOT_LOG = path.join(WEBROOT_RUNTIME, 'log');
|
||||
const WEBCONFIG = config;
|
||||
|
||||
/**
|
||||
* 获取一个model实例,如果不存在则创建一个新的返回
|
||||
* @param {*} m class
|
||||
* @example
|
||||
* yapi.getInst(groupModel, arg1, arg2)
|
||||
*/
|
||||
function getInst(m, ...args){
|
||||
if(!insts.get(m)){
|
||||
insts.set(m, new m(args))
|
||||
}
|
||||
return insts.get(m)
|
||||
}
|
||||
|
||||
function delInst(m){
|
||||
try{
|
||||
insts.delete(m)
|
||||
}catch(err){
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fs: fs,
|
||||
path: path,
|
||||
@ -20,4 +42,7 @@ module.exports = {
|
||||
WEBROOT_RUNTIME: WEBROOT_RUNTIME,
|
||||
WEBROOT_LOG: WEBROOT_LOG,
|
||||
WEBCONFIG: WEBCONFIG,
|
||||
getInst: getInst,
|
||||
delInst: delInst,
|
||||
getInsts: insts
|
||||
}
|
@ -12,6 +12,10 @@ var _db = require('./utils/db.js');
|
||||
|
||||
var _db2 = _interopRequireDefault(_db);
|
||||
|
||||
var _userauth = require('./middleware/userauth.js');
|
||||
|
||||
var _userauth2 = _interopRequireDefault(_userauth);
|
||||
|
||||
var _koa = require('koa');
|
||||
|
||||
var _koa2 = _interopRequireDefault(_koa);
|
||||
@ -36,7 +40,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
_yapi2.default.commons = _commons2.default;
|
||||
|
||||
_yapi2.default.connect = _db2.default.connect();
|
||||
|
||||
var app = new _koa2.default();
|
||||
app.use(_userauth2.default);
|
||||
app.use((0, _koaBodyparser2.default)());
|
||||
app.use(_router2.default.routes());
|
||||
app.use(_router2.default.allowedMethods());
|
||||
@ -45,5 +52,4 @@ app.listen(_yapi2.default.WEBCONFIG.port);
|
||||
_commons2.default.log('the server is start at port ' + _yapi2.default.WEBCONFIG.port);
|
||||
|
||||
_yapi2.default.fs.ensureDirSync(_yapi2.default.WEBROOT_RUNTIME);
|
||||
_yapi2.default.fs.ensureDirSync(_yapi2.default.WEBROOT_LOG);
|
||||
_db2.default.connect();
|
||||
_yapi2.default.fs.ensureDirSync(_yapi2.default.WEBROOT_LOG);
|
38
server_dist/controllers/base.js
Normal file
38
server_dist/controllers/base.js
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var baseController = function () {
|
||||
function baseController(ctx) {
|
||||
(0, _classCallCheck3.default)(this, baseController);
|
||||
|
||||
console.log('baseControler init...');
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(baseController, [{
|
||||
key: 'getUid',
|
||||
value: function getUid() {
|
||||
return 0;
|
||||
}
|
||||
}, {
|
||||
key: 'getLoginStatus',
|
||||
value: function getLoginStatus() {
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
return baseController;
|
||||
}();
|
||||
|
||||
module.exports = baseController;
|
@ -12,6 +12,26 @@ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
||||
|
||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _group = require('../models/group.js');
|
||||
|
||||
var _group2 = _interopRequireDefault(_group);
|
||||
@ -20,71 +40,89 @@ var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _base = require('./base.js');
|
||||
|
||||
var _base2 = _interopRequireDefault(_base);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
add: function add(ctx) {
|
||||
var _this = this;
|
||||
var groupController = function (_baseController) {
|
||||
(0, _inherits3.default)(groupController, _baseController);
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
|
||||
var params, checkRepeat, data, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
function groupController() {
|
||||
(0, _classCallCheck3.default)(this, groupController);
|
||||
|
||||
if (params.group_name) {
|
||||
_context.next = 3;
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, (groupController.__proto__ || (0, _getPrototypeOf2.default)(groupController)).call(this));
|
||||
|
||||
console.log('constructor....');
|
||||
return _this;
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(groupController, [{
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, groupInst, checkRepeat, data, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
if (params.group_name) {
|
||||
_context.next = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '组名不能为空'));
|
||||
|
||||
case 3:
|
||||
groupInst = _yapi2.default.getInst(_group2.default);
|
||||
_context.next = 6;
|
||||
return groupInst.checkRepeat(params.group_name);
|
||||
|
||||
case 6:
|
||||
checkRepeat = _context.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context.next = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '组名已存在'));
|
||||
|
||||
case 9:
|
||||
data = {
|
||||
group_name: params.group_name,
|
||||
group_desc: params.group_desc,
|
||||
uid: '0',
|
||||
add_time: _yapi2.default.commons.time(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
_context.prev = 10;
|
||||
_context.next = 13;
|
||||
return groupInst.save(data);
|
||||
|
||||
case 13:
|
||||
result = _context.sent;
|
||||
|
||||
result = _yapi2.default.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid']);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 21;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '组名不能为空'));
|
||||
case 18:
|
||||
_context.prev = 18;
|
||||
_context.t0 = _context['catch'](10);
|
||||
|
||||
case 3:
|
||||
_context.next = 5;
|
||||
return _group2.default.checkRepeat(params.group_name);
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 5:
|
||||
checkRepeat = _context.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context.next = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '组名已存在'));
|
||||
|
||||
case 8:
|
||||
data = {
|
||||
group_name: params.group_name,
|
||||
group_desc: params.group_desc,
|
||||
uid: '0',
|
||||
add_time: _yapi2.default.commons.time(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
_context.prev = 9;
|
||||
_context.next = 12;
|
||||
return _group2.default.save(data);
|
||||
|
||||
case 12:
|
||||
result = _context.sent;
|
||||
|
||||
result = _yapi2.default.commons.fieldSelect(result, ['_id', 'group_name', 'group_desc', 'uid']);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 20;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
_context.prev = 17;
|
||||
_context.t0 = _context['catch'](9);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 20:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
case 21:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
}, _callee, _this, [[9, 17]]);
|
||||
}))();
|
||||
@ -118,86 +156,151 @@ module.exports = {
|
||||
case 10:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
=======
|
||||
}, _callee, this, [[10, 18]]);
|
||||
}));
|
||||
|
||||
function add(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
return add;
|
||||
}()
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var groupInst, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.prev = 0;
|
||||
groupInst = _yapi2.default.getInst(_group2.default);
|
||||
_context2.next = 4;
|
||||
return groupInst.list();
|
||||
|
||||
case 4:
|
||||
result = _context2.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context2.next = 11;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
_context2.prev = 8;
|
||||
_context2.t0 = _context2['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context2.t0.message);
|
||||
|
||||
case 11:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
}
|
||||
>>>>>>> dev
|
||||
}
|
||||
}
|
||||
}, _callee2, _this2, [[0, 7]]);
|
||||
}))();
|
||||
},
|
||||
del: function del(ctx) {
|
||||
var _this3 = this;
|
||||
}, _callee2, this, [[0, 8]]);
|
||||
}));
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3() {
|
||||
var id, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_context3.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
_context3.next = 4;
|
||||
return _group2.default.del(id);
|
||||
function list(_x2) {
|
||||
return _ref2.apply(this, arguments);
|
||||
}
|
||||
|
||||
case 4:
|
||||
result = _context3.sent;
|
||||
return list;
|
||||
}()
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var groupInst, id, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_context3.prev = 0;
|
||||
groupInst = _yapi2.default.getInst(_group2.default);
|
||||
id = ctx.request.body.id;
|
||||
_context3.next = 5;
|
||||
return groupInst.del(id);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context3.next = 11;
|
||||
break;
|
||||
case 5:
|
||||
result = _context3.sent;
|
||||
|
||||
case 8:
|
||||
_context3.prev = 8;
|
||||
_context3.t0 = _context3['catch'](0);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context3.next = 12;
|
||||
break;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
case 9:
|
||||
_context3.prev = 9;
|
||||
_context3.t0 = _context3['catch'](0);
|
||||
|
||||
case 11:
|
||||
case 'end':
|
||||
return _context3.stop();
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 12:
|
||||
case 'end':
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, _callee3, _this3, [[0, 8]]);
|
||||
}))();
|
||||
},
|
||||
up: function up(ctx) {
|
||||
var _this4 = this;
|
||||
}, _callee3, this, [[0, 9]]);
|
||||
}));
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4() {
|
||||
var id, data, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
case 0:
|
||||
_context4.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
data = {};
|
||||
function del(_x3) {
|
||||
return _ref3.apply(this, arguments);
|
||||
}
|
||||
|
||||
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 ((0, _keys2.default)(data).length === 0) {
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 404, '分组名和分组描述都为空');
|
||||
}
|
||||
_context4.next = 8;
|
||||
return _group2.default.up(id, data);
|
||||
return del;
|
||||
}()
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var groupInst, id, data, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
case 0:
|
||||
_context4.prev = 0;
|
||||
groupInst = _yapi2.default.getInst(_group2.default);
|
||||
id = ctx.request.body.id;
|
||||
data = {};
|
||||
|
||||
case 8:
|
||||
result = _context4.sent;
|
||||
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 ((0, _keys2.default)(data).length === 0) {
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 404, '分组名和分组描述都为空');
|
||||
}
|
||||
_context4.next = 9;
|
||||
return groupInst.up(id, data);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context4.next = 15;
|
||||
break;
|
||||
case 9:
|
||||
result = _context4.sent;
|
||||
|
||||
case 12:
|
||||
_context4.prev = 12;
|
||||
_context4.t0 = _context4['catch'](0);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context4.next = 16;
|
||||
break;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
case 13:
|
||||
_context4.prev = 13;
|
||||
_context4.t0 = _context4['catch'](0);
|
||||
|
||||
case 15:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 16:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, _callee4, _this4, [[0, 12]]);
|
||||
}))();
|
||||
}
|
||||
};
|
||||
}, _callee4, this, [[0, 13]]);
|
||||
}));
|
||||
|
||||
function up(_x4) {
|
||||
return _ref4.apply(this, arguments);
|
||||
}
|
||||
|
||||
return up;
|
||||
}()
|
||||
}]);
|
||||
return groupController;
|
||||
}(_base2.default);
|
||||
|
||||
module.exports = groupController;
|
203
server_dist/controllers/project.js
Normal file
203
server_dist/controllers/project.js
Normal file
@ -0,0 +1,203 @@
|
||||
'use strict';
|
||||
|
||||
var _keys = require('babel-runtime/core-js/object/keys');
|
||||
|
||||
var _keys2 = _interopRequireDefault(_keys);
|
||||
|
||||
var _regenerator = require('babel-runtime/regenerator');
|
||||
|
||||
var _regenerator2 = _interopRequireDefault(_regenerator);
|
||||
|
||||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
var _project = require('../models/project.js');
|
||||
|
||||
var _project2 = _interopRequireDefault(_project);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
add: function add(ctx) {
|
||||
var _this = this;
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
|
||||
var params, checkRepeat, data, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
if (params.project_name) {
|
||||
_context.next = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '组名不能为空'));
|
||||
|
||||
case 3:
|
||||
_context.next = 5;
|
||||
return _project2.default.checkRepeat(params.project_name);
|
||||
|
||||
case 5:
|
||||
checkRepeat = _context.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context.next = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '组名已存在'));
|
||||
|
||||
case 8:
|
||||
data = {
|
||||
project_name: params.project_name,
|
||||
project_desc: params.project_desc,
|
||||
uid: '0',
|
||||
add_time: _yapi2.default.commons.time(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
_context.prev = 9;
|
||||
_context.next = 12;
|
||||
return _project2.default.save(data);
|
||||
|
||||
case 12:
|
||||
result = _context.sent;
|
||||
|
||||
result = _yapi2.default.commons.fieldSelect(result, ['_id', 'project_name', 'project_desc', 'uid']);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 20;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
_context.prev = 17;
|
||||
_context.t0 = _context['catch'](9);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 20:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, _this, [[9, 17]]);
|
||||
}))();
|
||||
},
|
||||
list: function list(ctx) {
|
||||
var _this2 = this;
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2() {
|
||||
var result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.prev = 0;
|
||||
_context2.next = 3;
|
||||
return _project2.default.list();
|
||||
|
||||
case 3:
|
||||
result = _context2.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context2.next = 10;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
_context2.prev = 7;
|
||||
_context2.t0 = _context2['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 10:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, _this2, [[0, 7]]);
|
||||
}))();
|
||||
},
|
||||
del: function del(ctx) {
|
||||
var _this3 = this;
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3() {
|
||||
var id, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_context3.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
_context3.next = 4;
|
||||
return _project2.default.del(id);
|
||||
|
||||
case 4:
|
||||
result = _context3.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context3.next = 11;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
_context3.prev = 8;
|
||||
_context3.t0 = _context3['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 11:
|
||||
case 'end':
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3, _this3, [[0, 8]]);
|
||||
}))();
|
||||
},
|
||||
up: function up(ctx) {
|
||||
var _this4 = this;
|
||||
|
||||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4() {
|
||||
var id, data, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
case 0:
|
||||
_context4.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
data = {};
|
||||
|
||||
ctx.request.body.project_name && (data.project_name = ctx.request.body.project_name);
|
||||
ctx.request.body.project_desc && (data.project_desc = ctx.request.body.project_desc);
|
||||
if ((0, _keys2.default)(data).length === 0) {
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 404, '分组名和分组描述都为空');
|
||||
}
|
||||
_context4.next = 8;
|
||||
return _project2.default.up(id, data);
|
||||
|
||||
case 8:
|
||||
result = _context4.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context4.next = 15;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
_context4.prev = 12;
|
||||
_context4.t0 = _context4['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 15:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}, _callee4, _this4, [[0, 12]]);
|
||||
}))();
|
||||
}
|
||||
};
|
41
server_dist/middleware/mockServer.js
Normal file
41
server_dist/middleware/mockServer.js
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
var _regenerator = require("babel-runtime/regenerator");
|
||||
|
||||
var _regenerator2 = _interopRequireDefault(_regenerator);
|
||||
|
||||
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
var hostname;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
hostname = ctx.hostname;
|
||||
|
||||
if (!next) {
|
||||
_context.next = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
_context.next = 4;
|
||||
return next();
|
||||
|
||||
case 4:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, undefined);
|
||||
}));
|
||||
|
||||
return function (_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
44
server_dist/middleware/userauth.js
Normal file
44
server_dist/middleware/userauth.js
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
var _regenerator = require("babel-runtime/regenerator");
|
||||
|
||||
var _regenerator2 = _interopRequireDefault(_regenerator);
|
||||
|
||||
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
var path;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
path = ctx.path;
|
||||
|
||||
console.log(path);
|
||||
console.log(ctx.hostname);
|
||||
|
||||
if (!next) {
|
||||
_context.next = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
_context.next = 6;
|
||||
return next();
|
||||
|
||||
case 6:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, undefined);
|
||||
}));
|
||||
|
||||
return function (_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
57
server_dist/models/base.js
Normal file
57
server_dist/models/base.js
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _mongoose = require('mongoose');
|
||||
|
||||
var _mongoose2 = _interopRequireDefault(_mongoose);
|
||||
|
||||
var _mongooseAutoIncrement = require('mongoose-auto-increment');
|
||||
|
||||
var _mongooseAutoIncrement2 = _interopRequireDefault(_mongooseAutoIncrement);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* 所有的model都需要继承baseModel, 且需要 getSchema和getName方法,不然会报错
|
||||
*/
|
||||
|
||||
var baseModel = function () {
|
||||
function baseModel() {
|
||||
(0, _classCallCheck3.default)(this, baseModel);
|
||||
|
||||
this.schema = new _mongoose2.default.Schema(this.getSchema());
|
||||
this.name = this.getName();
|
||||
this.schema.plugin(_mongooseAutoIncrement2.default.plugin, this.name);
|
||||
this.model = _yapi2.default.db(this.name, this.schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取collection的schema结构
|
||||
*/
|
||||
|
||||
(0, _createClass3.default)(baseModel, [{
|
||||
key: 'getSchema',
|
||||
value: function getSchema() {
|
||||
_yapi2.default.commons.log('Model Class need getSchema function', 'error');
|
||||
}
|
||||
}, {
|
||||
key: 'getName',
|
||||
value: function getName() {
|
||||
_yapi2.default.commons.log('Model Class need name', 'error');
|
||||
}
|
||||
}]);
|
||||
return baseModel;
|
||||
}();
|
||||
|
||||
module.exports = baseModel;
|
@ -1,11 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
||||
|
||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _mongoose = require('mongoose');
|
||||
|
||||
var _mongoose2 = _interopRequireDefault(_mongoose);
|
||||
|
||||
var _base = require('./base.js');
|
||||
|
||||
var _base2 = _interopRequireDefault(_base);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
<<<<<<< HEAD
|
||||
var groupSchema = {
|
||||
uid: String,
|
||||
group_name: String,
|
||||
@ -42,5 +71,70 @@ module.exports = {
|
||||
group_desc: data.group_desc,
|
||||
up_time: _yapi2.default.commons.time()
|
||||
});
|
||||
=======
|
||||
var groupModel = function (_baseModel) {
|
||||
(0, _inherits3.default)(groupModel, _baseModel);
|
||||
|
||||
function groupModel() {
|
||||
(0, _classCallCheck3.default)(this, groupModel);
|
||||
return (0, _possibleConstructorReturn3.default)(this, (groupModel.__proto__ || (0, _getPrototypeOf2.default)(groupModel)).apply(this, arguments));
|
||||
>>>>>>> dev
|
||||
}
|
||||
};
|
||||
|
||||
(0, _createClass3.default)(groupModel, [{
|
||||
key: 'getName',
|
||||
value: function getName() {
|
||||
return 'group';
|
||||
}
|
||||
}, {
|
||||
key: 'getSchema',
|
||||
value: function getSchema() {
|
||||
return {
|
||||
uid: String,
|
||||
group_name: String,
|
||||
group_desc: String,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: 'save',
|
||||
value: function save(data) {
|
||||
var m = new this.model(data);
|
||||
return m.save();
|
||||
}
|
||||
}, {
|
||||
key: 'checkRepeat',
|
||||
value: function checkRepeat(name) {
|
||||
return this.model.count({
|
||||
group_name: name
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function list() {
|
||||
return this.model.find().select("group_name _id group_desc add_time up_time").exec();
|
||||
}
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function del(id) {
|
||||
return this.model.deleteOne({
|
||||
_id: id
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function up(id, data) {
|
||||
return this.model.update({
|
||||
_id: id
|
||||
}, {
|
||||
group_name: data.group_name,
|
||||
group_desc: data.group_desc,
|
||||
up_time: _yapi2.default.commons.time()
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return groupModel;
|
||||
}(_base2.default);
|
||||
|
||||
module.exports = groupModel;
|
49
server_dist/models/project.js
Normal file
49
server_dist/models/project.js
Normal file
@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var projectSchema = {
|
||||
uid: Number,
|
||||
name: String,
|
||||
basepath: String,
|
||||
desc: String,
|
||||
group_id: Number,
|
||||
members: Array,
|
||||
prd_host: String,
|
||||
env: Object,
|
||||
add_time: Number,
|
||||
up_time: Number
|
||||
};
|
||||
|
||||
var projectModel = _yapi2.default.db('project', projectSchema);
|
||||
|
||||
module.exports = {
|
||||
save: function save(data) {
|
||||
var m = new projectModel(data);
|
||||
return m.save();
|
||||
},
|
||||
checkRepeat: function checkRepeat(name, basepath) {
|
||||
return projectModel.count({
|
||||
project_name: name,
|
||||
basepath: basepath
|
||||
});
|
||||
},
|
||||
list: function list() {
|
||||
return projectModel.find().exec();
|
||||
},
|
||||
del: function del(id) {
|
||||
return projectModel.deleteOne({
|
||||
_id: id
|
||||
});
|
||||
},
|
||||
up: function up(id, data) {
|
||||
data.up_time = _yapi2.default.commons.time();
|
||||
return projectModel.update({
|
||||
_id: id
|
||||
}, data);
|
||||
}
|
||||
};
|
@ -1,5 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var _regenerator = require('babel-runtime/regenerator');
|
||||
|
||||
var _regenerator2 = _interopRequireDefault(_regenerator);
|
||||
|
||||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
var _koaRouter = require('koa-router');
|
||||
|
||||
var _koaRouter2 = _interopRequireDefault(_koaRouter);
|
||||
@ -20,12 +28,64 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
var router = (0, _koaRouter2.default)();
|
||||
|
||||
var INTERFACE_PREFIX = {
|
||||
interface: '/interface/',
|
||||
user: '/user/',
|
||||
group: '/group/'
|
||||
var INTERFACE_CONFIG = {
|
||||
interface: {
|
||||
prefix: '/interface/',
|
||||
controller: _interface2.default
|
||||
},
|
||||
user: {
|
||||
prefix: '/user/',
|
||||
controller: null
|
||||
},
|
||||
group: {
|
||||
prefix: '/group/',
|
||||
controller: _group2.default
|
||||
}
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
router.post(INTERFACE_PREFIX.interface + 'add', _interface2.default.add).get(INTERFACE_PREFIX.interface + 'list', _interface2.default.list).get(INTERFACE_PREFIX.group + 'list', _group2.default.list).post(INTERFACE_PREFIX.group + 'add', _group2.default.add).post(INTERFACE_PREFIX.group + 'up', _group2.default.up).post(INTERFACE_PREFIX.group + 'del', _group2.default.del).get(INTERFACE_PREFIX.user + 'list', _user2.default.list).post(INTERFACE_PREFIX.user + 'add', _user2.default.add).post(INTERFACE_PREFIX.user + 'up', _user2.default.up).post(INTERFACE_PREFIX.user + 'del', _user2.default.del);
|
||||
=======
|
||||
//group
|
||||
createAction('group', 'list', 'get', 'list');
|
||||
createAction('group', 'add', 'post', 'add');
|
||||
createAction('group', 'up', 'post', 'up');
|
||||
createAction('group', 'del', 'post', 'del');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} controller controller_name
|
||||
* @param {*} path request_path
|
||||
* @param {*} method request_method , post get put delete ...
|
||||
* @param {*} action controller_action_name
|
||||
*/
|
||||
function createAction(controller, path, method, action) {
|
||||
var _this = this;
|
||||
|
||||
router[method](INTERFACE_CONFIG[controller].prefix + path, function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var inst;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
inst = new INTERFACE_CONFIG[controller].controller(ctx);
|
||||
_context.next = 3;
|
||||
return inst[action].call(inst, ctx);
|
||||
|
||||
case 3:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, _this);
|
||||
}));
|
||||
|
||||
return function (_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}());
|
||||
}
|
||||
>>>>>>> dev
|
||||
|
||||
module.exports = router;
|
@ -8,10 +8,19 @@ var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _mongooseAutoIncrement = require('mongoose-auto-increment');
|
||||
|
||||
var _mongooseAutoIncrement2 = _interopRequireDefault(_mongooseAutoIncrement);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function model(model, schema) {
|
||||
return _mongoose2.default.model(model, schema, model);
|
||||
if (schema instanceof _mongoose2.default.Schema === false) {
|
||||
schema = new _mongoose2.default.Schema(schema);
|
||||
}
|
||||
|
||||
schema.set('autoIndex', false);
|
||||
return _yapi2.default.connect.model(model, schema, model);
|
||||
}
|
||||
|
||||
function connect() {
|
||||
@ -26,6 +35,8 @@ function connect() {
|
||||
_yapi2.default.commons.log(err, 'Mongo connect error');
|
||||
});
|
||||
|
||||
_mongooseAutoIncrement2.default.initialize(db);
|
||||
|
||||
checkDatabase();
|
||||
return db;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var _map = require('babel-runtime/core-js/map');
|
||||
|
||||
var _map2 = _interopRequireDefault(_map);
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
@ -20,6 +24,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
var args = process.argv.splice(2);
|
||||
var isDev = args[0] === 'dev' ? true : false;
|
||||
var insts = new _map2.default();
|
||||
var config = isDev ? _configDev2.default : _config2.default;
|
||||
|
||||
var WEBROOT = _path2.default.resolve(__dirname, '..'); //路径
|
||||
@ -28,6 +33,31 @@ var WEBROOT_RUNTIME = _path2.default.join(WEBROOT, 'runtime');
|
||||
var WEBROOT_LOG = _path2.default.join(WEBROOT_RUNTIME, 'log');
|
||||
var WEBCONFIG = config;
|
||||
|
||||
/**
|
||||
* 获取一个model实例,如果不存在则创建一个新的返回
|
||||
* @param {*} m class
|
||||
* @example
|
||||
* yapi.getInst(groupModel, arg1, arg2)
|
||||
*/
|
||||
function getInst(m) {
|
||||
if (!insts.get(m)) {
|
||||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
insts.set(m, new m(args));
|
||||
}
|
||||
return insts.get(m);
|
||||
}
|
||||
|
||||
function delInst(m) {
|
||||
try {
|
||||
insts.delete(m);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fs: _fsExtra2.default,
|
||||
path: _path2.default,
|
||||
@ -35,5 +65,8 @@ module.exports = {
|
||||
WEBROOT_SERVER: WEBROOT_SERVER,
|
||||
WEBROOT_RUNTIME: WEBROOT_RUNTIME,
|
||||
WEBROOT_LOG: WEBROOT_LOG,
|
||||
WEBCONFIG: WEBCONFIG
|
||||
WEBCONFIG: WEBCONFIG,
|
||||
getInst: getInst,
|
||||
delInst: delInst,
|
||||
getInsts: insts
|
||||
};
|
Loading…
Reference in New Issue
Block a user