- 三个平台的SkuName长度限制常量规范化
This commit is contained in:
@@ -19,7 +19,8 @@ const (
|
|||||||
UPCTypePrivate = 0
|
UPCTypePrivate = 0
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
MaxLeftNum = 99999
|
MaxLeftNum = 99999
|
||||||
|
MaxSkuNameByteCount = 100 // skuname的最大字节数,注意不是字符数,超长饿百会报错:{"data":"","errno":20200,"error":"invalid param:[name]...
|
||||||
)
|
)
|
||||||
|
|
||||||
type CategoryInfo struct {
|
type CategoryInfo struct {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MaxSkuNameLen = 45 // skuname最长字符数
|
MaxSkuNameCharCount = 45 // skuname最长字符数
|
||||||
SaleAttrIDBase = 1001
|
SaleAttrIDBase = 1001
|
||||||
SaleAttrValueIDBase = 10
|
SaleAttrValueIDBase = 10
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MaxSkuNameCharCount = 30 // SkuName的最大字符数
|
||||||
|
)
|
||||||
|
|
||||||
type RetailCategoryInfo struct {
|
type RetailCategoryInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Sequence int `json:"sequence"`
|
Sequence int `json:"sequence"`
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ func Base64DecodeMultiString(strs ...string) (decodedData [][]byte, err error) {
|
|||||||
return decodedData, nil
|
return decodedData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只适合与纯英文的情况
|
// 限制的是字节数,只适合纯英文的情况,推荐使用LimitMixedStringLen,除非确定是纯英文,且对性能相当敏感
|
||||||
func LimitStringLen(str string, maxByteCount int) (limitedStr string) {
|
func LimitStringLen(str string, maxByteCount int) (limitedStr string) {
|
||||||
if maxByteCount > 0 {
|
if maxByteCount > 0 {
|
||||||
if strLen := len(str); strLen > maxByteCount {
|
if strLen := len(str); strLen > maxByteCount {
|
||||||
|
|||||||
Reference in New Issue
Block a user