1、解决分页BUG

2、解决切换文档上传附件混乱的BUG
3、无法清空文档标识的BUG
4、实现上传文件不限制后缀
5、实现上传文件大小限制
6、实现自动发布功能
7、优化登录时密码框错误提示不消失问题
8、优化网站首页限制网站title
This commit is contained in:
Minho
2018-01-18 19:54:05 +08:00
parent 848d3752e3
commit 54b51d7c27
13 changed files with 92 additions and 21 deletions

View File

@@ -6,6 +6,9 @@ sessionon = true
sessionname = mindoc_id
copyrequestbody = true
#是否自动发布文档false 为否, true 保存文档后自动发布
auto_release=false
#默认Session生成Key的秘钥
beegoserversessionkey=123456
@@ -47,8 +50,10 @@ avatar=/static/images/headimgurl.jpg
#默认阅读令牌长度
token_size=12
#上传文件的后缀
#上传文件的后缀,如果不限制后缀可以设置为 *
upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif
#上传的文件大小限制,如果不填写,默认不限制,单位可以是 GB KB MB
upload_file_size=10MB
####################邮件配置######################
#是否启用邮件

View File

@@ -5,6 +5,7 @@ import (
"strings"
"github.com/astaxie/beego"
"strconv"
)
// 登录用户的Session名
@@ -12,7 +13,7 @@ const LoginSessionName = "LoginSessionName"
const CaptchaSessionName = "__captcha__"
const RegexpEmail = `^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$`
const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
//允许用户名中出现点号
@@ -101,6 +102,30 @@ func GetUploadFileExt() []string {
}
return exts
}
// 获取上传文件允许的最大值
func GetUploadFileSize() int64 {
size := beego.AppConfig.DefaultString("upload_file_size","0")
if strings.HasSuffix(size,"MB") {
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
return s * 1024 * 1024
}
}
if strings.HasSuffix(size,"GB") {
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
return s * 1024 * 1024 * 1024
}
}
if strings.HasSuffix(size,"KB") {
if s,e := strconv.ParseInt(size[0:len(size) - 2], 10, 64);e == nil {
return s * 1024
}
}
if s,e := strconv.ParseInt(size, 10, 64);e == nil {
return s * 1024
}
return 0
}
//判断是否是允许商城的文件类型.
func IsAllowUploadFileExt(ext string) bool {