This commit is contained in:
邹宗楠
2025-01-06 14:34:40 +08:00
parent a759b1d05f
commit 7ac9146ca5
4 changed files with 37 additions and 24 deletions

View File

@@ -60,6 +60,12 @@ const (
DefaultPageSize = 50
)
const (
JdVendorOrgCodeVagetable = "320406" // 菜市默认京东code
JdVendorOrgCodeFruit = "339032" // 水果默认京东code
JdVendorOrgCodePet = "390558" // 百货默认京东code
)
type API struct {
platformapi.APICookie

View File

@@ -20,13 +20,13 @@ func init() {
baseapi.Init(sugarLogger)
// 菜市
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_p9xkpA90fnlwJUPgIV5G1A")
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_qR5Et61N9S000vcr7q1PZQ")
//cookieStr := `
// acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
//`

View File

@@ -23,12 +23,9 @@ func TestPoiGetIDs(t *testing.T) {
// t.Log(result)
}
func TestPoiGet(t *testing.T) {
shop, err := api.PoiGet("18940973")
fmt.Println(shop)
fmt.Println(err)
func Test1111(t *testing.T) {
fmt.Println(utils.Float64TwoInt(float64(1132) / float64(2441) * float64(805)))
}
func TestPoiMGet(t *testing.T) {
result, err := api.PoiMGet([]string{"18580531"})
t.Log(utils.Format4Output(result, false))

View File

@@ -285,23 +285,33 @@ func TestMap(t *testing.T) {
}
func TestRetailDat(t *testing.T) {
err := api.RetailInitData("F71D0F0881A211ED9D81525400E86DC0", "25791090", "1161", map[string]interface{}{
"app_food_code": "1161",
"category_code": "4",
"common_attr_value": "[{\"attr_id\":1200000088,\"attr_name\":\"品牌\",\"valueList\":[{\"value\":\"其他\"}]},{\"attr_id\":1200000132,\"attr_name\":\"国产/进口\",\"valueList\":[{\"value_id\":1300000003,\"value\":\"国产\"}]},{\"attr_id\":1200250629,\"attr_name\":\"是否为特殊用途化妆品\",\"valueList\":[{\"value_id\":1300017034,\"value\":\"非特殊化妆品\"}]}]",
"description": "",
"is_sold_out": 0,
"min_order_count": 1,
"name": "紧致抗皱樱花精华液约40ml/瓶",
"picture": "https://image.jxc4.com/image/11abea38b125078afbac5402940acb6b.jpg,https://image.jxc4.com/image/37cb700edfb80b41d7d5c7f12dca06b9.jpg,https://image.jxc4.com/image/6bbaced20900c2ba295ab72d9e3fa058.jpg,https://image.jxc4.com/image/3187f06340ae13260b58cb3b71d0fdf4.jpg,https://image.jxc4.com/image/946d193eb89f0e210c87c69684272f5a.jpg",
"price": 35,
"qua_approval_date": 1893340800,
"qua_effective_date": 1672502400,
"qua_pictures": "https://image.jxc4.com/image/53a3b7a2bc31f7044e49bfbf762ad520.jpg",
"sequence": 3500,
"skus": `[{"box_num": "0","box_price": "0","location_code": "A2006","price": 35,"sku_id": "1161","spec": "40ml","stock": "1","weight": 40}]`,
"tag_id": "200000044",
"unit": "瓶",
err := api.RetailInitData("F71D0F0881A211ED9D81525400E86DC0", "26207799", "mtcode_1808750374413807658", map[string]interface{}{
"app_food_code": "mtcode_1808750374413807658",
"category_name": "活动",
"common_attr_value": "[{\"attrId\":1200000135,\"attrName\":\"包装方式\",\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"散装\",\"valueId\":1300000232}]},{\"attrId\":1200000202,\"attrName\":\"品\",\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"韭菜\",\"valueId\":1300003045}]}]",
"description": "",
"is_sold_out": 0,
"min_order_count": 1,
"name": "【惊喜爆品】韭菜约250g",
"picture": "http://p0.meituan.net/retailsp/a71560e4b5edb76558a73aa68dbb7932123662.jpg",
"picture_contents": "",
"price": 3.5,
"sequence": 0,
"skus": ` [{
"isSellFlag": 1,
"limit_open_sync_stock_now": false,
"location_code": "",
"price": "3.5",
"sku_id": "mtcode_1808750374413807658",
"spec": "250克",
"stock": "5",
"unit": "",
"upc": "",
"weight": "250"
}]`,
"tag_id": 200002521,
"unit": "",
"upc": "no_upc",
})
globals.SugarLogger.Debugf("err %s", utils.Format4Output(err, false))
}