@@ -99,7 +99,7 @@ func (this *BookController) Index() {
99
99
}
100
100
}
101
101
102
- //收藏书籍
102
+ // 收藏书籍
103
103
func (this * BookController ) Star () {
104
104
uid := this .BaseController .Member .MemberId
105
105
if uid <= 0 {
@@ -193,6 +193,10 @@ func (this *BookController) Setting() {
193
193
this .Data ["Maps" ] = maps
194
194
}
195
195
196
+ ver := models .NewVersion ()
197
+ this .Data ["Versions" ] = ver .All ()
198
+ this .Data ["VersionItem" ] = ver .GetVersionItem (book .Identify )
199
+
196
200
this .Data ["Cates" ], _ = new (models.Category ).GetCates (- 1 , 1 )
197
201
this .Data ["Model" ] = book
198
202
this .TplName = "book/setting.html"
@@ -277,6 +281,9 @@ func (this *BookController) SaveBook() {
277
281
beego .Error (errSearch .Error ())
278
282
}
279
283
}()
284
+ versionId , _ := this .GetInt ("version" )
285
+ versionNO := this .GetString ("version_no" )
286
+ models .NewVersion ().InsertOrUpdateVersionItem (versionId , book .Identify , book .BookName , versionNO )
280
287
go models .CountCategory ()
281
288
this .JsonResult (0 , "ok" , bookResult )
282
289
}
@@ -322,7 +329,7 @@ func (this *BookController) parseBookNav() (navs models.BookNavs, navStr string)
322
329
return
323
330
}
324
331
325
- //设置书籍私有状态.
332
+ // 设置书籍私有状态.
326
333
func (this * BookController ) PrivatelyOwned () {
327
334
328
335
status := this .GetString ("status" )
@@ -407,7 +414,7 @@ func (this *BookController) Transfer() {
407
414
this .JsonResult (0 , "ok" )
408
415
}
409
416
410
- //上传书籍封面.
417
+ // 上传书籍封面.
411
418
func (this * BookController ) UploadCover () {
412
419
413
420
bookResult , err := this .IsPermission ()
@@ -853,7 +860,7 @@ func (this *BookController) Generate() {
853
860
this .JsonResult (0 , "电子书生成任务已交由后台执行,请您耐心等待。" )
854
861
}
855
862
856
- //文档排序.
863
+ // 文档排序.
857
864
func (this * BookController ) SaveSort () {
858
865
859
866
identify := this .Ctx .Input .Param (":key" )
@@ -929,7 +936,7 @@ func (this *BookController) IsPermission() (*models.BookResult, error) {
929
936
return book , nil
930
937
}
931
938
932
- //从github等拉取下载markdown书籍
939
+ // 从github等拉取下载markdown书籍
933
940
func (this * BookController ) DownloadProject () {
934
941
935
942
//处理步骤
@@ -997,7 +1004,7 @@ func (this *BookController) GitPull() {
997
1004
this .JsonResult (0 , "提交成功,请耐心等待。" )
998
1005
}
999
1006
1000
- //上传书籍
1007
+ // 上传书籍
1001
1008
func (this * BookController ) UploadProject () {
1002
1009
//处理步骤
1003
1010
//1、接受上传上来的zip文件,并存放到store/temp目录下
@@ -1032,11 +1039,11 @@ func (this *BookController) UploadProject() {
1032
1039
this .JsonResult (0 , "上传成功" )
1033
1040
}
1034
1041
1035
- //将zip压缩文件解压并录入数据库
1036
- //@param book_id 书籍id(其实有想不标识了可以不要这个的,但是这里的书籍标识只做目录)
1037
- //@param identify 书籍标识
1038
- //@param zipfile 压缩文件
1039
- //@param originFilename 上传文件的原始文件名
1042
+ // 将zip压缩文件解压并录入数据库
1043
+ // @param book_id 书籍id(其实有想不标识了可以不要这个的,但是这里的书籍标识只做目录)
1044
+ // @param identify 书籍标识
1045
+ // @param zipfile 压缩文件
1046
+ // @param originFilename 上传文件的原始文件名
1040
1047
func (this * BookController ) unzipToData (bookId int , identify , zipFile , originFilename string ) {
1041
1048
1042
1049
//说明:
@@ -1217,7 +1224,7 @@ func (this *BookController) loadByFolder(bookId int, identify, folder string) {
1217
1224
}
1218
1225
}
1219
1226
1220
- //获取书籍的根目录
1227
+ // 获取书籍的根目录
1221
1228
func (this * BookController ) getProjectRoot (fl []filetil.FileList ) (root string ) {
1222
1229
var strs []string
1223
1230
for _ , f := range fl {
@@ -1228,7 +1235,7 @@ func (this *BookController) getProjectRoot(fl []filetil.FileList) (root string)
1228
1235
return utils .LongestCommonPrefix (strs )
1229
1236
}
1230
1237
1231
- //查找并替换markdown文件中的路径,把图片链接替换成url的相对路径,把文档间的链接替换成【$+文档标识链接】
1238
+ // 查找并替换markdown文件中的路径,把图片链接替换成url的相对路径,把文档间的链接替换成【$+文档标识链接】
1232
1239
func (this * BookController ) fixFileLinks (projectRoot string , identify string ) {
1233
1240
imgBaseUrl := "/uploads/projects/" + identify
1234
1241
switch utils .StoreType {
@@ -1311,7 +1318,7 @@ func (this *BookController) fixFileLinks(projectRoot string, identify string) {
1311
1318
}
1312
1319
}
1313
1320
1314
- //给书籍打分
1321
+ // 给书籍打分
1315
1322
func (this * BookController ) Score () {
1316
1323
bookId , _ := this .GetInt (":id" )
1317
1324
if bookId == 0 {
@@ -1328,7 +1335,7 @@ func (this *BookController) Score() {
1328
1335
this .JsonResult (1 , "给文档打分失败,请先登录再操作" )
1329
1336
}
1330
1337
1331
- //添加评论
1338
+ // 添加评论
1332
1339
func (this * BookController ) Comment () {
1333
1340
if this .Member .MemberId == 0 {
1334
1341
this .JsonResult (1 , "请先登录在评论" )
0 commit comments