@@ -99,7 +99,7 @@ func (this *BookController) Index() {
9999 }
100100}
101101
102- //收藏书籍
102+ // 收藏书籍
103103func (this * BookController ) Star () {
104104 uid := this .BaseController .Member .MemberId
105105 if uid <= 0 {
@@ -193,6 +193,10 @@ func (this *BookController) Setting() {
193193 this .Data ["Maps" ] = maps
194194 }
195195
196+ ver := models .NewVersion ()
197+ this .Data ["Versions" ] = ver .All ()
198+ this .Data ["VersionItem" ] = ver .GetVersionItem (book .Identify )
199+
196200 this .Data ["Cates" ], _ = new (models.Category ).GetCates (- 1 , 1 )
197201 this .Data ["Model" ] = book
198202 this .TplName = "book/setting.html"
@@ -277,6 +281,9 @@ func (this *BookController) SaveBook() {
277281 beego .Error (errSearch .Error ())
278282 }
279283 }()
284+ versionId , _ := this .GetInt ("version" )
285+ versionNO := this .GetString ("version_no" )
286+ models .NewVersion ().InsertOrUpdateVersionItem (versionId , book .Identify , book .BookName , versionNO )
280287 go models .CountCategory ()
281288 this .JsonResult (0 , "ok" , bookResult )
282289}
@@ -322,7 +329,7 @@ func (this *BookController) parseBookNav() (navs models.BookNavs, navStr string)
322329 return
323330}
324331
325- //设置书籍私有状态.
332+ // 设置书籍私有状态.
326333func (this * BookController ) PrivatelyOwned () {
327334
328335 status := this .GetString ("status" )
@@ -407,7 +414,7 @@ func (this *BookController) Transfer() {
407414 this .JsonResult (0 , "ok" )
408415}
409416
410- //上传书籍封面.
417+ // 上传书籍封面.
411418func (this * BookController ) UploadCover () {
412419
413420 bookResult , err := this .IsPermission ()
@@ -853,7 +860,7 @@ func (this *BookController) Generate() {
853860 this .JsonResult (0 , "电子书生成任务已交由后台执行,请您耐心等待。" )
854861}
855862
856- //文档排序.
863+ // 文档排序.
857864func (this * BookController ) SaveSort () {
858865
859866 identify := this .Ctx .Input .Param (":key" )
@@ -929,7 +936,7 @@ func (this *BookController) IsPermission() (*models.BookResult, error) {
929936 return book , nil
930937}
931938
932- //从github等拉取下载markdown书籍
939+ // 从github等拉取下载markdown书籍
933940func (this * BookController ) DownloadProject () {
934941
935942 //处理步骤
@@ -997,7 +1004,7 @@ func (this *BookController) GitPull() {
9971004 this .JsonResult (0 , "提交成功,请耐心等待。" )
9981005}
9991006
1000- //上传书籍
1007+ // 上传书籍
10011008func (this * BookController ) UploadProject () {
10021009 //处理步骤
10031010 //1、接受上传上来的zip文件,并存放到store/temp目录下
@@ -1032,11 +1039,11 @@ func (this *BookController) UploadProject() {
10321039 this .JsonResult (0 , "上传成功" )
10331040}
10341041
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 上传文件的原始文件名
10401047func (this * BookController ) unzipToData (bookId int , identify , zipFile , originFilename string ) {
10411048
10421049 //说明:
@@ -1217,7 +1224,7 @@ func (this *BookController) loadByFolder(bookId int, identify, folder string) {
12171224 }
12181225}
12191226
1220- //获取书籍的根目录
1227+ // 获取书籍的根目录
12211228func (this * BookController ) getProjectRoot (fl []filetil.FileList ) (root string ) {
12221229 var strs []string
12231230 for _ , f := range fl {
@@ -1228,7 +1235,7 @@ func (this *BookController) getProjectRoot(fl []filetil.FileList) (root string)
12281235 return utils .LongestCommonPrefix (strs )
12291236}
12301237
1231- //查找并替换markdown文件中的路径,把图片链接替换成url的相对路径,把文档间的链接替换成【$+文档标识链接】
1238+ // 查找并替换markdown文件中的路径,把图片链接替换成url的相对路径,把文档间的链接替换成【$+文档标识链接】
12321239func (this * BookController ) fixFileLinks (projectRoot string , identify string ) {
12331240 imgBaseUrl := "/uploads/projects/" + identify
12341241 switch utils .StoreType {
@@ -1311,7 +1318,7 @@ func (this *BookController) fixFileLinks(projectRoot string, identify string) {
13111318 }
13121319}
13131320
1314- //给书籍打分
1321+ // 给书籍打分
13151322func (this * BookController ) Score () {
13161323 bookId , _ := this .GetInt (":id" )
13171324 if bookId == 0 {
@@ -1328,7 +1335,7 @@ func (this *BookController) Score() {
13281335 this .JsonResult (1 , "给文档打分失败,请先登录再操作" )
13291336}
13301337
1331- //添加评论
1338+ // 添加评论
13321339func (this * BookController ) Comment () {
13331340 if this .Member .MemberId == 0 {
13341341 this .JsonResult (1 , "请先登录在评论" )
0 commit comments