- 三个平台的SkuName长度限制常量规范化

This commit is contained in:
gazebo
2019-06-19 14:17:33 +08:00
parent 3a3734a788
commit 6930818468
4 changed files with 8 additions and 3 deletions

View File

@@ -19,7 +19,8 @@ const (
UPCTypePrivate = 0
)
const (
MaxLeftNum = 99999
MaxLeftNum = 99999
MaxSkuNameByteCount = 100 // skuname的最大字节数注意不是字符数超长饿百会报错{"data":"","errno":20200,"error":"invalid param:[name]...
)
type CategoryInfo struct {

View File

@@ -80,7 +80,7 @@ const (
)
const (
MaxSkuNameLen = 45 // skuname最长字符数
MaxSkuNameCharCount = 45 // skuname最长字符数
SaleAttrIDBase = 1001
SaleAttrValueIDBase = 10
)

View File

@@ -6,6 +6,10 @@ import (
"git.rosy.net.cn/baseapi/utils"
)
const (
MaxSkuNameCharCount = 30 // SkuName的最大字符数
)
type RetailCategoryInfo struct {
Name string `json:"name"`
Sequence int `json:"sequence"`

View File

@@ -247,7 +247,7 @@ func Base64DecodeMultiString(strs ...string) (decodedData [][]byte, err error) {
return decodedData, nil
}
// 只适合纯英文的情况
// 限制的是字节数,只适合纯英文的情况推荐使用LimitMixedStringLen除非确定是纯英文且对性能相当敏感
func LimitStringLen(str string, maxByteCount int) (limitedStr string) {
if maxByteCount > 0 {
if strLen := len(str); strLen > maxByteCount {