From ee4b2859bbeee15656a128b438608648d3807ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 26 Nov 2025 15:28:25 +0800 Subject: [PATCH] 1 --- platformapi/ebaiapi/shop_sku.go | 32 ++++++++++++++++++++++ platformapi/ebaiapi/shop_sku_test.go | 4 +++ platformapi/jdapi/invoice_test.go | 1 - platformapi/jxprintapi/jxprintapi_test.go | 13 +-------- platformapi/tao_vegetable/storeAct_test.go | 12 -------- 5 files changed, 37 insertions(+), 25 deletions(-) diff --git a/platformapi/ebaiapi/shop_sku.go b/platformapi/ebaiapi/shop_sku.go index fbc97d2c..1ca22135 100644 --- a/platformapi/ebaiapi/shop_sku.go +++ b/platformapi/ebaiapi/shop_sku.go @@ -629,3 +629,35 @@ func (a *API) GetEbaiCatIDFromName(shopID, catName string) (ebaiCatID int64) { } return ebaiCatID } + +// CategoryAttrValueList 根据分类id获取商品属性 +//https://open-retail.ele.me/#/apidoc/me.ele.retail:sku.category.property.list-3?aopApiCategory=item_cate&type=item_all +func (a *API) CategoryAttrValueList(cat3Id int64, shopId string) (categoryAttrValueListResult []*CategoryAttr, err error) { + result, err := a.AccessAPI("sku.category.property.list", map[string]interface{}{ + "cat3_id": cat3Id, + "shop_id": shopId, + }) + if err == nil && result.ErrNo == 0 { + err = utils.UnmarshalUseNumber(utils.MustMarshal(result.Data), &categoryAttrValueListResult) + } + return categoryAttrValueListResult, err +} + +type CategoryAttr struct { + PropertyId int64 `json:"propertyId"` // 属性ID + CategoryId int64 `json:"categoryId"` // 所属叶子类目ID + PropertyName string `json:"propertyName"` // 属性名 + Required bool `json:"required"` // 是否必选 + MultiSelect bool `json:"multiSelect"` // 属性值是否多选 + EnumProp bool `json:"enumProp"` // 是否枚举属性 + InputProp bool `json:"inputProp"` // 是否可输入属性 + SaleProp bool `json:"saleProp"` // 是否销售属性,销售属性只能用于生成多规格 + SortOrder bool `json:"sortOrder"` // 排序值 + MajorProp bool `json:"majorProp"` // 是否关键属性 + PropertyValues []PropertyValue `json:"propertyValues"` // 属性值列表 +} +type PropertyValue struct { + ValueId int64 `json:"ValueId"` // 属性值id + ValueData string `json:"valueData"` // 属性值内容 + SortOrder int64 `json:"sortOrder"` // 排序码 +} diff --git a/platformapi/ebaiapi/shop_sku_test.go b/platformapi/ebaiapi/shop_sku_test.go index 6e5594ac..9992ac55 100644 --- a/platformapi/ebaiapi/shop_sku_test.go +++ b/platformapi/ebaiapi/shop_sku_test.go @@ -370,3 +370,7 @@ func TestDeleteSku(t *testing.T) { // api.ShopCategoryDelete(shopId, v.CategoryID) //} } + +func TestCategoryAttrValueList(t *testing.T) { + api.CategoryAttrValueList(201220238, "666667") +} diff --git a/platformapi/jdapi/invoice_test.go b/platformapi/jdapi/invoice_test.go index 61914ae5..493c7f4d 100644 --- a/platformapi/jdapi/invoice_test.go +++ b/platformapi/jdapi/invoice_test.go @@ -10,7 +10,6 @@ func TestQueryInvoiceList(t *testing.T) { param := &QueryInvoiceListParam{ InvoiceStatusList: nil, - OrderId: 0, ApplyTimeOrder: "", OrderCompleteTimeStart: utils.Time2Pointer(utils.Str2Time("2025-05-01 00:00:00")), OrderCompleteTimeEnd: utils.Time2Pointer(utils.Str2Time("2025-05-31 23:00:00")), diff --git a/platformapi/jxprintapi/jxprintapi_test.go b/platformapi/jxprintapi/jxprintapi_test.go index 31a91702..c3be39bc 100644 --- a/platformapi/jxprintapi/jxprintapi_test.go +++ b/platformapi/jxprintapi/jxprintapi_test.go @@ -1,7 +1,6 @@ package jxprintapi import ( - "fmt" "git.rosy.net.cn/baseapi" "go.uber.org/zap" "testing" @@ -70,7 +69,7 @@ func TestGetPrintMsg(t *testing.T) { } func TestGetPrinterStatus(t *testing.T) { - result, err := api.GetPrinterStatus("120220915001467") + result, err := api.GetPrinterStatus("120220915001330") if err != nil { t.Fatal(err) } @@ -108,13 +107,3 @@ func TestDoPrint(t *testing.T) { } t.Log(result) } - -func TestName23(t *testing.T) { - - count := 236 / 50 - fmt.Println(count) - if 236%50 != 0 { - count += 1 - } - fmt.Println(count) -} diff --git a/platformapi/tao_vegetable/storeAct_test.go b/platformapi/tao_vegetable/storeAct_test.go index bb1d9375..e8bb835c 100644 --- a/platformapi/tao_vegetable/storeAct_test.go +++ b/platformapi/tao_vegetable/storeAct_test.go @@ -4,7 +4,6 @@ import ( "fmt" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/domain" "git.rosy.net.cn/baseapi/utils" - "strings" "testing" "time" ) @@ -58,14 +57,3 @@ func TestDeleteAct(t *testing.T) { err := apiTao.ActivityDelete("20230619180157", "京西菜市", 230658198) fmt.Println(err) } - -func TestA(t *testing.T) { - str := "J100867" - if strings.Contains(str, "X") { - data := strings.Split(str, "X") - fmt.Println(data[1]) - } else { - fmt.Println("null") - } - -}