- fix bug in SplitSkuName.

This commit is contained in:
gazebo
2018-08-16 10:26:24 +08:00
parent d27caab804
commit 2b4e2ee1e9
2 changed files with 32 additions and 2 deletions

View File

@@ -156,11 +156,18 @@ func CallMsgHandlerAsync(handler func(), primaryID string) {
}
func SplitSkuName(fullName string) (name string, unit string) {
unit = "份"
index := strings.Index(fullName, "/")
if index >= 0 {
return fullName[:index], fullName[index+1:]
name = fullName[:index]
unitTmp := []rune(fullName[index+1:])
if len(unitTmp) >= 1 {
unit = string(unitTmp[:1])
}
} else {
name = fullName
}
return fullName, "份"
return name, unit
}
func MapValue2Scope(value, fromMin, fromMax, toMin, toMax int64) int64 {