- jd spu support
This commit is contained in:
@@ -235,6 +235,20 @@ func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, sp
|
||||
return skuName
|
||||
}
|
||||
|
||||
func ComposeSpuName(prefix, name string, maxLen int) (spuName string) {
|
||||
if prefix != "" {
|
||||
spuName = "[" + prefix + "]"
|
||||
}
|
||||
spuName += name
|
||||
if maxLen > 0 {
|
||||
runeList := []rune(spuName)
|
||||
if len(runeList) > maxLen {
|
||||
spuName = string(runeList[:maxLen])
|
||||
}
|
||||
}
|
||||
return spuName
|
||||
}
|
||||
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user