mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-20 10:48:00 +08:00
1、解决分页BUG
2、解决切换文档上传附件混乱的BUG 3、无法清空文档标识的BUG 4、实现上传文件不限制后缀 5、实现上传文件大小限制 6、实现自动发布功能 7、优化登录时密码框错误提示不消失问题 8、优化网站首页限制网站title
This commit is contained in:
@@ -29,6 +29,7 @@ func (c *BaseController) Prepare (){
|
||||
c.EnableDocumentHistory = false
|
||||
|
||||
if member,ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0{
|
||||
|
||||
c.Member = &member
|
||||
c.Data["Member"] = c.Member
|
||||
}else{
|
||||
|
@@ -392,9 +392,8 @@ func (c *DocumentController) Create() {
|
||||
document.MemberId = c.Member.MemberId
|
||||
document.BookId = book_id
|
||||
|
||||
if doc_identify != "" {
|
||||
document.Identify = doc_identify
|
||||
}
|
||||
document.Identify = doc_identify
|
||||
|
||||
|
||||
document.Version = time.Now().Unix()
|
||||
document.DocumentName = doc_name
|
||||
@@ -435,14 +434,26 @@ func (c *DocumentController) Upload() {
|
||||
|
||||
defer file.Close()
|
||||
|
||||
type Size interface {
|
||||
Size() int64
|
||||
}
|
||||
beego.Info(conf.GetUploadFileSize())
|
||||
beego.Info(moreFile.Size)
|
||||
if conf.GetUploadFileSize() > 0 && moreFile.Size > conf.GetUploadFileSize() {
|
||||
c.JsonResult(6009,"查过文件允许的上传最大值")
|
||||
}
|
||||
|
||||
|
||||
ext := filepath.Ext(moreFile.Filename)
|
||||
|
||||
if ext == "" {
|
||||
c.JsonResult(6003, "无法解析文件的格式")
|
||||
}
|
||||
|
||||
if !conf.IsAllowUploadFileExt(ext) {
|
||||
c.JsonResult(6004, "不允许的文件类型")
|
||||
//如果文件类型设置为 * 标识不限制文件类型
|
||||
if beego.AppConfig.DefaultString("upload_file_ext", "") != "*" {
|
||||
if !conf.IsAllowUploadFileExt(ext) {
|
||||
c.JsonResult(6004, "不允许的文件类型")
|
||||
}
|
||||
}
|
||||
|
||||
book_id := 0
|
||||
@@ -806,6 +817,14 @@ func (c *DocumentController) Content() {
|
||||
beego.Error("DocumentHistory InsertOrUpdate => ", err)
|
||||
}
|
||||
}
|
||||
if beego.AppConfig.DefaultBool("auto_release", false) {
|
||||
go func(identify string) {
|
||||
models.NewDocument().ReleaseContent(book_id)
|
||||
|
||||
|
||||
}(identify)
|
||||
}
|
||||
|
||||
|
||||
c.JsonResult(0, "ok", doc)
|
||||
}
|
||||
|
Reference in New Issue
Block a user