- 限制GetAPIOperator的长度为50个UNICODE,前缀改为jxadmin

This commit is contained in:
gazebo
2019-05-27 15:37:24 +08:00
parent c6954769a1
commit 1e0a4f463b

View File

@@ -11,6 +11,7 @@ import (
"unicode/utf8" "unicode/utf8"
"git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
) )
@@ -101,10 +102,11 @@ func GetCurTimestamp() int64 {
} }
func GetAPIOperator(userName string) string { func GetAPIOperator(userName string) string {
retVal := "jxc4-admin" retVal := "jxadmin"
if userName != "" { if userName != "" {
retVal += "-" + userName retVal += "-" + userName
} }
retVal = utils.LimitUTF8StringLen(retVal, 50)
return retVal return retVal
} }