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)
}

View File

@@ -321,3 +321,15 @@ func (a *API) AddByStoreAndSkus(stationNo int64, skuIDs []int64) (err error) {
_, err = a.AccessAPINoPage("OrgSortService/addByStoreAndSkus", jdParams, nil, nil, genNoPageResultParser("status", "message", "", "200"))
return err
}
// 删除门店商品会员价接口
// https://openo2o.jddj.com/staticnew/widgets/resources.html?groupid=205&apiid=73116e2b9f374814880f1272ba301fdf
func (a *API) DelVipPrice(outStationNo string, skuIds []*SkuIdEntity, userPin string) (err error) {
jdParams := map[string]interface{}{
"outStationNo": outStationNo,
"skuPriceInfoList": skuIds,
"source": utils.GetAPIOperator(userPin),
}
_, err = a.AccessAPINoPage("vender/delVipPrice", jdParams, nil, nil, genNoPageResultParser("code", "msg", "", "0"))
return err
}

View File

@@ -13,13 +13,25 @@ const (
)
func TestGetStationInfoList(t *testing.T) {
result, err := api.GetStationInfoList(mustExistStoreID, []int64{mustExistSkuID})
result, err := api.GetStationInfoList("12005640", []int64{2023434101})
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestDelVipPrice(t *testing.T) {
err := api.DelVipPrice("667281", []*SkuIdEntity{
&SkuIdEntity{
OutSkuId: "26074",
},
}, "")
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}
func TestQueryOpenUseable(t *testing.T) {
result, err := api.QueryOpenUseable([]*BaseStockCenterRequest{
&BaseStockCenterRequest{