This commit is contained in:
邹宗楠
2024-05-24 09:49:14 +08:00
parent 6afc1582fa
commit ad5f763b56
16 changed files with 1547 additions and 81 deletions

View File

@@ -288,7 +288,7 @@ func TestDeleteSku(t *testing.T) {
Page: 1,
PageSize: 100,
}
skuInfo, err := api.SkuList("669089", param1)
skuInfo, err := api.SkuList("100215", param1)
if err != nil {
fmt.Println(err)
return
@@ -300,7 +300,7 @@ func TestDeleteSku(t *testing.T) {
Page: i,
PageSize: 100,
}
skuInfo2, err2 := api.SkuList("669089", param)
skuInfo2, err2 := api.SkuList("100215", param)
if err2 != nil {
fmt.Println(err2)
}
@@ -309,7 +309,7 @@ func TestDeleteSku(t *testing.T) {
}
}
for i := 1; i <= skuInfo.Pages; i++ {
data, err := api.SkuDelete(utils.GetUUID(), "669089", skuIds[i-1:i*100], nil)
data, err := api.SkuDelete(utils.GetUUID(), "100215", skuIds[i-1:i*100], nil)
fmt.Println(data)
fmt.Println(err)
}

View File

@@ -9,10 +9,73 @@ import (
func TestShopList(t *testing.T) {
result, err := api.ShopList(SysStatusAll)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
data := make(map[string]int64, 0)
dataErr := make(map[string]int64, 0)
vendorKey := make([]int64, 0, 0)
for _, v := range result {
if len(v.ShopID) != 6 {
dataErr[v.ShopID] = v.BaiduShopID
vendorKey = append(vendorKey, v.BaiduShopID)
}
}
for _, vk := range vendorKey {
status2, _ := api.ShopBusStatusGet("", vk, "")
if status2 == 2 || status2 == 3 {
globals.SugarLogger.Debugf("==vk : %d", vk)
}
}
t.Log(utils.Format4Output(data, false))
t.Log(utils.Format4Output(dataErr, false))
t.Log(utils.Format4Output(vendorKey, false))
//t.Log(utils.Format4Output(data, false))
//t.Log(utils.Format4Output(dataErr, false))
}
//todo 修改ebai平台与本地映射
func TestShopIDBatchUpdate(t *testing.T) {
var (
fBaiduShopIDs []string
fShopIDs []string
)
key := map[int64]string{
509107995: "668893",
}
for k, v := range key {
k1 := utils.Int64ToStr(k)
remoteRel, err := api.ShopGet2("", k)
fmt.Sprintf("err====%v", err)
if remoteRel.ShopID != v {
fBaiduShopIDs = append(fBaiduShopIDs, k1)
fShopIDs = append(fShopIDs, v)
}
}
fmt.Sprintf("fBaiduIDs=====%s", fBaiduShopIDs)
fmt.Sprintf("fBaiduIDs=====%s", fShopIDs)
err := api.ShopIDBatchUpdate(fBaiduShopIDs, fShopIDs)
//err := api.ShopIDBatchUpdate([]string{utils.Int2Str(2235877567)}, []string{"100920"})
if err != nil {
t.Fatal(err)
}
// err = api.ShopIDBatchUpdate([]string{utils.Int2Str(testShopBaiduID)}, []string{testShopID})
// if err != nil {
// t.Fatal(err)
// }
}
func TestShopIDBatchUpdate2(t *testing.T) {
data := map[string]int64{
"667252": 32267779552, "100200": 2233065993, "100489": 2233066035, "100876": 2233066089, "100306": 2233066125, "100805": 2233066147, "100726": 2233066189, "100999": 2233066221, "100972": 2233066288, "100933": 2233066508, "101667": 2235330385, "101691": 2233065954, "101686": 2235811199, "101075": 2235877563, "101793": 2233066050, "101040": 2234549767, "101747": 2235877564, "102091": 2267141526, "101666": 2267141507, "102001": 2267141468, "102316": 2267141488, "102126": 2267141487, "100717": 2233066054, "100203": 2233066065, "102170": 2267121508, "102197": 32267034115, "102404": 32267034132, "102362": 32267034127, "102116": 2267092843, "102130": 32267089386, "102154": 32267089387, "102418": 32267089392, "102501": 32267089401, "102495": 32267089402, "102525": 32267089415, "102505": 32267089419, "102535": 32267089420, "102536": 32267089421, "102547": 32267089424, "100617": 32267105197, "102610": 32267105203, "102615": 32267105205, "102653": 32267105211, "102667": 32267105218, "102709": 32267144438, "102745": 32267144444, "102776": 32267144467, "102086": 2267141477, "102888": 32267184020, "102806": 32267184025, "102869": 32267184037, "102849": 32267184061, "102698": 2233065970, "102575": 2267030904, "102976": 32267258872, "102992": 32267315045, "102293": 32267315069, "103093": 32267358106, "102973": 32267184017, "103088": 32267387505, "100922": 32267388562, "100326": 2235877566, "103062": 32267630601, "102997": 32267358124, "666918": 32267655031, "667176": 32267655039, "667154": 32267715494, "101107": 32267779547, "100162": 32267779555, "667084": 32267674079, "667398": 32267804825, "667421": 32267812971, "103127": 32267387534, "102180": 32267715495, "667339": 32267144482, "667445": 32267089406, "667083": 32267674060, "666916": 32267630644, "103085": 32267105208, "667400": 32267812970, "667139": 32267630624, "102925": 32267804790, "102063": 32267184031, "100117": 32267779369, "666921": 32267742254, "102383": 2234778219, "668786": 508226060, "669232": 512276503, "669201": 1176226197,
}
for k, v := range data {
err := api.ShopIDBatchUpdate([]string{utils.Int64ToStr(v)}, []string{k})
globals.SugarLogger.Debugf("err := %v", err)
}
}
@@ -131,37 +194,6 @@ func TestShopStatusGet(t *testing.T) {
}
}
//todo 修改ebai平台与本地映射
func TestShopIDBatchUpdate(t *testing.T) {
var (
fBaiduShopIDs []string
fShopIDs []string
)
key := map[int64]string{
509107995: "668893",
}
for k, v := range key {
k1 := utils.Int64ToStr(k)
remoteRel, err := api.ShopGet2("", k)
fmt.Sprintf("err====%v", err)
if remoteRel.ShopID != v {
fBaiduShopIDs = append(fBaiduShopIDs, k1)
fShopIDs = append(fShopIDs, v)
}
}
fmt.Sprintf("fBaiduIDs=====%s", fBaiduShopIDs)
fmt.Sprintf("fBaiduIDs=====%s", fShopIDs)
err := api.ShopIDBatchUpdate(fBaiduShopIDs, fShopIDs)
//err := api.ShopIDBatchUpdate([]string{utils.Int2Str(2235877567)}, []string{"100920"})
if err != nil {
t.Fatal(err)
}
// err = api.ShopIDBatchUpdate([]string{utils.Int2Str(testShopBaiduID)}, []string{testShopID})
// if err != nil {
// t.Fatal(err)
// }
}
func TestSupplierList(t *testing.T) {
result, err := api.SupplierList()
if err != nil {