商品名前缀
This commit is contained in:
@@ -329,7 +329,7 @@ func FloatWeight2Int(weight float32) int {
|
||||
|
||||
func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) {
|
||||
if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) {
|
||||
if time.Now().Add(6*time.Hour).After(exPrefixBegin) && time.Now().Add(-6*time.Hour).Before(exPrefixEnd) {
|
||||
if time.Now().After(exPrefixBegin) && time.Now().Before(exPrefixEnd) {
|
||||
skuName = exPrefix
|
||||
}
|
||||
}
|
||||
@@ -353,6 +353,35 @@ func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, sp
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) {
|
||||
if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) {
|
||||
if time.Now().Add(6*time.Hour).After(exPrefixBegin) && time.Now().Before(exPrefixEnd) {
|
||||
skuName = exPrefix
|
||||
}
|
||||
if time.Now().Add(6 * time.Hour).After(exPrefixEnd) {
|
||||
skuName = ""
|
||||
}
|
||||
}
|
||||
if prefix != "" {
|
||||
skuName += "[" + prefix + "]"
|
||||
}
|
||||
skuName += name
|
||||
if unit == "份" {
|
||||
skuName += "约"
|
||||
}
|
||||
if unit != "" {
|
||||
skuName += ComposeSkuSpec(spec_quality, spec_unit)
|
||||
skuName += "/" + unit
|
||||
}
|
||||
if comment != "" {
|
||||
skuName += "(" + comment + ")"
|
||||
}
|
||||
if maxLen > 0 {
|
||||
skuName = utils.LimitUTF8StringLen(skuName, maxLen)
|
||||
}
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSpuName(prefix, name string, maxLen int) (spuName string) {
|
||||
if prefix != "" {
|
||||
spuName = "[" + prefix + "]"
|
||||
|
||||
Reference in New Issue
Block a user