diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index de927225..ee4f00c1 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -210,3 +210,7 @@ func TestCreateStoreCommodity(t *testing.T) { fmt.Println("err=============", err) fmt.Println("data===", fmt.Sprintf("%v", data)) } + +func TestInt16(t *testing.T) { + fmt.Println(utils.Str2Int16(strings.ReplaceAll("08:00", ":", ""))) +} diff --git a/utils/typeconv.go b/utils/typeconv.go index fa85e542..66da9b30 100644 --- a/utils/typeconv.go +++ b/utils/typeconv.go @@ -565,6 +565,10 @@ func Str2Int(s string) (i int) { return int(Str2Int64WithDefault(s, 0)) } +func Str2Int16(s string) (i int16) { + return int16(Str2Int64WithDefault(s, 0)) +} + //func String2Int64Slice(s string) []int64 { // res := make([]int64, 0) // if len(s) == 0 {