This commit is contained in:
苏尹岚
2021-02-08 11:45:00 +08:00
parent a376ce1e48
commit 9c2c0930fd
11 changed files with 67 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ package jdapi
import (
"fmt"
"regexp"
"strings"
"testing"
@@ -9,6 +10,10 @@ import (
"git.rosy.net.cn/baseapi/utils"
)
var (
skuNamePat = regexp.MustCompile(`([\(\[【][^\(\[【\)\]】]*[\)\]】])?(.*?)([(].*[)])?\s*约?([1-9][\d\.]*)(g|G|kg|mg|kG|Kg|KG|l|L|ml|mL|Ml|ML|克)\s*([(].*[)])?\s*(?:\/||)\s*([^\s()]{0,2})(\s.*)?$\s*([(].*[)])?$`)
)
func TestGetRealMobileNumber4Order(t *testing.T) {
orderId := "921823424000122"
desiredMobile := "13722455105"
@@ -317,9 +322,7 @@ func findTheDifference(s string, t string) byte {
}
func TestGetJdStoreInfo(t *testing.T) {
result, err := api.GetJdStoreInfo("11942642")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
str := "汤臣倍健 辅酶Q10天然维生素E软胶囊 400mg*60粒/瓶"
searchResult := skuNamePat.FindStringSubmatch(str)
fmt.Println(searchResult)
}