- specify spu.sku.name
This commit is contained in:
@@ -230,8 +230,10 @@ func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, sp
|
||||
if unit == "份" {
|
||||
skuName += "约"
|
||||
}
|
||||
skuName += ComposeSkuSpec(spec_quality, spec_unit)
|
||||
skuName += "/" + unit
|
||||
if unit != "" {
|
||||
skuName += ComposeSkuSpec(spec_quality, spec_unit)
|
||||
skuName += "/" + unit
|
||||
}
|
||||
if comment != "" {
|
||||
skuName += "(" + comment + ")"
|
||||
}
|
||||
@@ -259,12 +261,14 @@ func ComposeSpuName(prefix, name string, maxLen int) (spuName string) {
|
||||
}
|
||||
|
||||
func ComposeSkuSpec(spec_quality float32, spec_unit string) (spec string) {
|
||||
if math.Round(float64(spec_quality)) == float64(spec_quality) || (spec_unit != "L" && spec_unit != "kg") {
|
||||
spec = fmt.Sprintf("%d", int(spec_quality))
|
||||
} else {
|
||||
spec = strings.TrimRight(fmt.Sprintf("%.2f", spec_quality), "0.")
|
||||
if spec_unit != "" {
|
||||
if math.Round(float64(spec_quality)) == float64(spec_quality) || (spec_unit != "L" && spec_unit != "kg") {
|
||||
spec = fmt.Sprintf("%d", int(spec_quality))
|
||||
} else {
|
||||
spec = strings.TrimRight(fmt.Sprintf("%.2f", spec_quality), "0.")
|
||||
}
|
||||
spec += spec_unit
|
||||
}
|
||||
spec += spec_unit
|
||||
return spec
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user