This commit is contained in:
邹宗楠
2025-11-26 15:28:25 +08:00
parent f28a13c2b3
commit ee4b2859bb
5 changed files with 37 additions and 25 deletions

View File

@@ -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"` // 排序码
}

View File

@@ -370,3 +370,7 @@ func TestDeleteSku(t *testing.T) {
// api.ShopCategoryDelete(shopId, v.CategoryID)
//}
}
func TestCategoryAttrValueList(t *testing.T) {
api.CategoryAttrValueList(201220238, "666667")
}

View File

@@ -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")),

View File

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

View File

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