京东商城一系列
This commit is contained in:
@@ -359,6 +359,32 @@ func ComposeSkuNameOriginal(prefix, name, comment, unit string, spec_quality flo
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSkuNameForJds(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int) (skuName string) {
|
||||
strBuilder := &strings.Builder{}
|
||||
if prefix != "" {
|
||||
strBuilder.WriteString("[")
|
||||
strBuilder.WriteString(prefix)
|
||||
strBuilder.WriteString("]")
|
||||
}
|
||||
skuName += name
|
||||
strBuilder.WriteString(name)
|
||||
if comment != "" {
|
||||
strBuilder.WriteString(" ")
|
||||
strBuilder.WriteString(comment)
|
||||
}
|
||||
if unit == "份" {
|
||||
strBuilder.WriteString("约")
|
||||
}
|
||||
if unit != "" {
|
||||
strBuilder.WriteString(ComposeSkuSpec(spec_quality, spec_unit))
|
||||
}
|
||||
skuName = strBuilder.String()
|
||||
if maxLen > 0 {
|
||||
skuName = utils.LimitUTF8StringLen(skuName, maxLen)
|
||||
}
|
||||
return skuName
|
||||
}
|
||||
|
||||
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 != "" && exPrefixBegin != nil && exPrefixEnd != nil {
|
||||
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 {
|
||||
@@ -382,6 +408,19 @@ func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSkuNameSync2(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd *time.Time) (skuName string) {
|
||||
if exPrefix != "" && exPrefixBegin != nil && exPrefixEnd != nil {
|
||||
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 {
|
||||
skuName = exPrefix
|
||||
}
|
||||
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixEnd) > 0 {
|
||||
skuName = ""
|
||||
}
|
||||
}
|
||||
skuName += ComposeSkuNameForJds(prefix, name, comment, unit, spec_quality, spec_unit, maxLen)
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSpuName(prefix, name string, maxLen int) (spuName string) {
|
||||
if prefix != "" {
|
||||
spuName = "[" + prefix + "]"
|
||||
|
||||
Reference in New Issue
Block a user