Skip to content

Commit bdab10b

Browse files
committed
2.2.0
1.添加了团队管理功能 2.添加了项目版本和接口快照功能,可以在不同的版本和快照间切换和回滚 3.支持自动化测试的轮询功能,可以定时在后台执行job 4.在接口运行中支持application/octet-stream类型的json解析 5.在项目中添加markdown文档,可以管理和项目有关的文档信息 6.添加消息中心,所有用户和项目消息都在这里 7.修复了自动化测试里测试脚本不能含有单引号的bug 8.在独立部署版本里用户可以选择是否通过net.js来做接口代理
1 parent d61bd5a commit bdab10b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+6293
-162
lines changed

SBDoc/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ app.use("/test",checkFormDataUser(con.imgPath),checkParam("test"),checkUser);
4343
app.use("/team",checkFormDataUser(con.imgPath),checkParam("team"),checkUser);
4444
app.use("/version",checkFormDataUser(con.imgPath),checkParam("version"),checkUser);
4545
app.use("/poll",checkFormDataUser(con.imgPath),checkParam("poll"),checkUser);
46+
app.use("/article",checkFormDataUser(con.imgPath),checkParam("article"),checkUser);
47+
app.use("/message",checkFormDataUser(con.imgPath),checkParam("message"),checkUser);
4648
app.use("/mock",checkFormDataUser(con.tempPath),mock);
4749
app.use("/html",express.static(path.join(__dirname, '../SBDocClient')));
4850
app.use("/img",express.static(con.imgPath));

SBDoc/event/event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var j1=schedule.scheduleJob("0 * * * *",(async (function () {
4747
try
4848
{
4949
let date=moment();
50-
let weekDay=date.weekday();
50+
let weekDay=date.weekday()-1;
5151
let hour=date.hour();
5252
let arr=await (poll.findAsync({
5353
date:weekDay,

SBDoc/html/component/article.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<el-dialog title="浏览" size="large" ref="box" >
3+
<el-row class="row">
4+
<span style="font-size: 20px">
5+
{{obj.title}}
6+
</span>
7+
</el-row>
8+
<el-row class="row" style="height: 30px;line-height: 30px;color: gray">
9+
作者:{{obj.creator.name}}&nbsp;&nbsp;最后修改:{{obj.updatedAt}}
10+
</el-row>
11+
<el-row class="row">
12+
<el-row class="row" style="height: 500px;overflow-y: auto" v-html="preContent"></el-row>
13+
</el-row>
14+
</el-dialog>
15+
</template>
16+
17+
<script>
18+
var markdown = require( "markdown" ).markdown;
19+
module.exports={
20+
props:["propObj"],
21+
data:function () {
22+
return {
23+
obj:this.propObj,
24+
}
25+
},
26+
computed:{
27+
preContent:function () {
28+
return markdown.toHTML(this.obj.content);
29+
}
30+
},
31+
methods:{
32+
33+
}
34+
}
35+
</script>

SBDoc/html/component/global.vue

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
BaseUrl
77
</el-button><el-button type="primary" style="margin: 20px 0 0 0;width: 80%;" @click="type=1">
88
状态码
9-
</el-button><el-button type="primary" style="margin: 20px 0 20px 0;width: 80%;" @click="type=2">
9+
</el-button><el-button type="primary" style="margin: 20px 0 0 0;width: 80%;" @click="type=2">
1010
环境注入
11+
</el-button><el-button type="primary" style="margin: 20px 0 20px 0;width: 80%;" @click="type=3">
12+
文档
1113
</el-button>
1214
</el-row>
1315
</el-col>
@@ -45,11 +47,37 @@
4547
</el-row>
4648
<inject :before="before" :after="after" @save="saveInject"></inject>
4749
</el-row>
50+
<el-row v-if="type==3" class="row">
51+
<el-row class="row" style="height: 60px;">
52+
<h4 style="margin-left: 10px;color: gray;display: inline-block">
53+
文档
54+
</h4>
55+
</el-row>
56+
<el-row class="row">
57+
<template v-for="item in arrArticle">
58+
<el-row class="row article" @click.native="editArticle(item,index)" style="margin-left: 20px;cursor: pointer">
59+
<el-row class="row" style="font-size: 20px">
60+
{{item.title}}
61+
</el-row>
62+
<el-row class="row" style="color: gray">
63+
{{item.updatedAt}}&nbsp;&nbsp;&nbsp;
64+
</el-button>
65+
</el-row>
66+
</el-row>
67+
</template>
68+
</el-row>
69+
</el-row>
4870
</el-row>
4971
</el-col>
5072
</el-row>
5173
</template>
5274

75+
<style>
76+
.article:hover {
77+
background-color: rgb(247,246,242) ;
78+
}
79+
</style>
80+
5381
<script>
5482
var bus=require("../bus/projectInfoBus")
5583
var urlList=require("./urlList.vue")
@@ -62,6 +90,7 @@
6290
status:[],
6391
before:"",
6492
after:"",
93+
arrArticle:[],
6594
}
6695
},
6796
computed:{
@@ -78,13 +107,20 @@
78107
source:item
79108
});
80109
},
110+
editArticle:function(item,index)
111+
{
112+
var child=$.showBox(this,"article",{
113+
propObj:item
114+
});
115+
}
81116
},
82117
created:function () {
83118
var _this=this;
84119
bus.$on("initInfo",function (data) {
85120
_this.baseUrl=data.baseUrls;
86121
_this.before=data.before;
87122
_this.after=data.after;
123+
_this.arrArticle=data.article;
88124
})
89125
bus.$on("initStatus",function (data) {
90126
_this.status=data;

SBDoc/html/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SBDoc/html/dist/vendor.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SBDoc/model/articleModel.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Created by sunxin on 2017/7/7.
3+
*/
4+
var mongoose = require('mongoose');
5+
var mongoomise=require("mongoomise")
6+
var db=require("../util/db.js");
7+
var model=new mongoose.Schema({
8+
title:String,
9+
content:{
10+
type:String,
11+
default:""
12+
},
13+
project:{
14+
type:mongoose.Schema.ObjectId,
15+
ref:"Project"
16+
},
17+
creator:{
18+
type:mongoose.Schema.ObjectId,
19+
ref:"User"
20+
}
21+
},{
22+
timestamps:true
23+
});
24+
model.configOutputField(null,[
25+
"createdAt",
26+
"updatedAt"
27+
]);
28+
var dbManage=db.model("Article",model);
29+
mongoomise.promisifyAll(dbManage,require("bluebird"));
30+
module.exports=dbManage;

SBDoc/model/messageModel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ var model=new mongoose.Schema({
1717
type:mongoose.Schema.ObjectId,
1818
ref:"User"
1919
},
20-
type:Number //0 个人申请消息 1 项目申请消息
20+
type:Number, //0 个人申请消息 1 项目申请消息
21+
read:{
22+
type:Number,
23+
default:0
24+
}
2125
},{
2226
timestamps:true
2327
});

SBDoc/routes/article/article.js

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/**
2+
* Created by sunxin on 2017/7/7.
3+
*/
4+
var async=require("asyncawait/async")
5+
var await=require("asyncawait/await")
6+
var e=require("../../util/error.json");
7+
var util=require("../../util/util");
8+
var user=require("../../model/userModel")
9+
var project=require("../../model/projectModel")
10+
var article=require("../../model/articleModel")
11+
var fs=require("fs");
12+
var uuid=require("uuid/v1");
13+
14+
function save(req,res) {
15+
try
16+
{
17+
let query={
18+
title:req.clientParam.title,
19+
content:req.clientParam.content,
20+
project:req.clientParam.project,
21+
creator:req.userInfo._id
22+
}
23+
let obj;
24+
if(req.clientParam.id)
25+
{
26+
obj=await (article.findOneAndUpdateAsync({
27+
_id:req.clientParam.id
28+
},query,{
29+
new:true
30+
}))
31+
}
32+
else
33+
{
34+
obj=await (article.createAsync(query))
35+
}
36+
util.ok(res,obj,"ok");
37+
}
38+
catch (err)
39+
{
40+
util.catch(res,err);
41+
}
42+
}
43+
44+
function remove(req,res) {
45+
try
46+
{
47+
await (article.removeAsync({
48+
_id:req.clientParam.id
49+
}));
50+
util.ok(res,"ok");
51+
}
52+
catch (err)
53+
{
54+
util.catch(res,err);
55+
}
56+
}
57+
58+
function info(req,res) {
59+
try
60+
{
61+
let obj=await (article.findOneAsync({
62+
_id:req.clientParam.id
63+
},null,{
64+
populate:{
65+
path:"creator",
66+
select:"name photo"
67+
}
68+
}));
69+
if(!obj)
70+
{
71+
util.throw(e.articleNotFound,"文档不存在");
72+
}
73+
util.ok(res,obj,"ok");
74+
}
75+
catch (err)
76+
{
77+
util.catch(res,err);
78+
}
79+
}
80+
81+
function list(req,res) {
82+
try
83+
{
84+
let arr=await (article.findAsync({
85+
project:req.clientParam.project
86+
},"-content",{
87+
populate:{
88+
path:"creator",
89+
select:"name photo"
90+
},
91+
sort:"-updatedAt",
92+
skip:10*req.clientParam.page,
93+
limit:10
94+
}));
95+
util.ok(res,arr,"ok");
96+
}
97+
catch (err)
98+
{
99+
util.catch(res,err);
100+
}
101+
}
102+
103+
exports.save=async (save);
104+
exports.remove=async (remove)
105+
exports.info=async (info);
106+
exports.list=async (list);
107+
108+
109+
110+
111+
112+
113+
114+
115+

SBDoc/routes/article/articleImp.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Created by sunxin on 2017/7/7.
3+
*/
4+
var article=require("./article");
5+
var interface=[
6+
{
7+
"method":"POST",
8+
"path":"/article/save",
9+
"param": {
10+
project:{
11+
type:String
12+
},
13+
id:{
14+
type:String,
15+
optional:1
16+
},
17+
title:{
18+
type:String,
19+
},
20+
content:{
21+
type:String,
22+
optional:1
23+
}
24+
},
25+
"data":String,
26+
user:1,
27+
handle:[article.save]
28+
},
29+
{
30+
"method":"DELETE",
31+
"path":"/article/item",
32+
"param": {
33+
id:{
34+
type:String
35+
},
36+
},
37+
"data":String,
38+
user:1,
39+
handle:[article.remove]
40+
},
41+
{
42+
"method":"GET",
43+
"path":"/article/item",
44+
"param": {
45+
id:{
46+
type:String
47+
},
48+
},
49+
"data":String,
50+
user:1,
51+
handle:[article.info]
52+
},
53+
{
54+
"method":"GET",
55+
"path":"/article/list",
56+
"param": {
57+
project:{
58+
type:String
59+
},
60+
page:Number
61+
},
62+
"data":String,
63+
user:1,
64+
handle:[article.list]
65+
},
66+
];
67+
68+
module.exports=interface;

0 commit comments

Comments
 (0)