This commit is contained in:
邹宗楠
2024-02-22 17:48:34 +08:00
parent 3a407553fe
commit 8cd80b3754
3 changed files with 26 additions and 31 deletions

View File

@@ -26,7 +26,7 @@ func init() {
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_tcaqk459xuIjL2l9OplDYg") //token_n4TwqCntWWuvQwAawzxC0w
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_ovY_D_9WSMGIT3bFAbNEDg") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`

View File

@@ -307,9 +307,11 @@ func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[
failedFoodList, err = handleRetailBatchResult(result)
}
globals.SugarLogger.Debugf("========foodDataList := %s", utils.Format4Output(foodDataList, false))
globals.SugarLogger.Debugf("========result := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("========err := %v", err)
if err != nil {
globals.SugarLogger.Debugf("========foodDataList := %s", utils.Format4Output(foodDataList, false))
globals.SugarLogger.Debugf("========result := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("========err := %v", err)
}
return failedFoodList, err
}

View File

@@ -285,48 +285,41 @@ func TestUpdateSkuBoxFee(t *testing.T) {
}
func TestRetailBatchInitData(t *testing.T) {
data := map[string]string{
"friday": "\"08:00-18:00\"",
"monday": "\"08:00-18:00\"",
"saturday": "\"08:00-18:00\"",
"sunday": "\"08:00-18:00\"",
"thursday": "\"08:00-18:00\"",
"tuesday": "\"08:00-18:00\"",
"wednesday": "\"08:00-18:00\"",
}
timeString, _ := json.Marshal(data)
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "19696163", []map[string]interface{}{
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "20498582", []map[string]interface{}{
map[string]interface{}{
"app_food_code": "mtcode_1723264743986589792",
"category_code": "6856569",
"common_attr_value": "[{\"attrId\":1200000094,\"attrName\":\"产地\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"中国\",\"valueId\":100000050}],\"valueListIterator\":[{\"$ref\":\"$[0].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000132,\"attrName\":\"国产/进口\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"国产\",\"valueId\":1300000003}],\"valueListIterator\":[{\"$ref\":\"$[1].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000210,\"attrName\":\"商品类别\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"其他\",\"valueId\":1300000249}],\"valueListIterator\":[{\"$ref\":\"$[2].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000088,\"attrName\":\"品牌\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"贵族符号noble sign\",\"valueId\":1027211}],\"valueListIterator\":[{\"$ref\":\"$[3].valueList[0]\"}],\"valueListSize\":1}]",
"app_food_code": "mtcode_1752187360965320785",
"category_name": "百货小件",
"common_attr_value": "[]",
"description": "",
"is_sold_out": 0,
"min_order_count": 1,
"name": "贵族符号 活氧清洁颗粒 500g/瓶",
"picture": "http://p0.meituan.net/retailsp/a1cd36d0072df039aada0559f7db52b836132.jpg,http://p0.meituan.net/retailsp/d0d4523dbad6d5ca1719f2746bd45a9538667.jpg,http://p0.meituan.net/retailsp/5073b4ae0ef7f473097cf3915f3538e155436.jpg",
"picture_contents": "",
"price": 40,
"sequence": -188,
"name": "纳米海绵魔力擦去污厨房神器百洁布刷碗海绵擦擦鞋茶杯清洁洗碗神",
"picture": "http://p0.meituan.net/shangouproductapi/345b69be84e7aa7b712effa3e073797263755.jpg,http://p0.meituan.net/shangouproductapi/2b6063c59bcf7ce1480c7ab4f6befaa326515.jpg,http://p0.meituan.net/shangouproductapi/cab39f2d1ba18aa87c7956308ee233b741668.jpg,http://p1.meituan.net/shangouproductapi/2d262f9abd9cb316bdd4dff5c76b9cf275224.jpg,http://p0.meituan.net/shangouproductapi/062f27e13a4831a7798df1a332759d8881586.jpg,http://p0.meituan.net/shangouproductapi/10b7985398420bb66f996c9ad5138d3f57301.jpg",
"picture_contents": "http://p0.meituan.net/shangouproductapi/8d0ea27ad4bb49301d4cc3a4dfba2f5e306596.jpg?w=790\u0026h=998,http://p1.meituan.net/shangouproductapi/9a3d8724862794f6f0babc11213bfbc4593012.jpg?w=790\u0026h=1043,http://p1.meituan.net/shangouproductapi/dcea8fff8e2c99b43e031cee554d74b7546297.jpg?w=790\u0026h=1008,http://p1.meituan.net/shangouproductapi/2cbe515ee7b2ffd9b8eb60913a0099e1484424.jpg?w=790\u0026h=1279,http://p0.meituan.net/shangouproductapi/f387bea7d880228d91e1332b873a93e8289160.jpg?w=790\u0026h=1101,http://p0.meituan.net/shangouproductapi/f06a9dabf4e9fc1133a1fd080d4af809356708.jpg?w=790\u0026h=1103,http://p0.meituan.net/shangouproductapi/3a79713a61330d3364f12244e278bfa2490198.jpg?w=790\u0026h=1419,http://p0.meituan.net/shangouproductapi/079f10d6accce58d21fd7d2a6a46e6ce430887.jpg?w=790\u0026h=1047,http://p0.meituan.net/shangouproductapi/908663d6584843d036c9faf85b7cd2d1514205.jpg?w=395\u0026h=1817,http://p1.meituan.net/shangouproductapi/9373a48f439756393d408a96341451aa451327.jpg?w=750\u0026h=1200,http://p0.meituan.net/shangouproductapi/e4a1f59d5b377cc8e6ab365675cbe7f3535263.jpg?w=750\u0026h=1125,http://p0.meituan.net/shangouproductapi/74dcd2441921a374c6b6d3d14e0807de382818.jpg?w=750\u0026h=950,http://p0.meituan.net/shangouproductapi/07802b60421666052ca5ddab0a80fe5b166720.jpg?w=800\u0026h=800,http://p1.meituan.net/shangouproductapi/acb6cb7fed6909fd63c8f444812f6990251688.jpg?w=800\u0026h=800,http://p0.meituan.net/shangouproductapi/4e3f1809c1929beab69e8ebce62fa323146125.jpg?w=880\u0026h=880,http://p0.meituan.net/shangouproductapi/6a83adc7073c48cf92e80d8db8a529ca302398.jpg?w=800\u0026h=800",
"price": 1,
"sequence": -130,
"skus": []map[string]interface{}{
{
"available_times": string(timeString),
"available_times": map[string]string{"friday": "", "monday": "", "saturday": "", "sunday": "", "thursday": "", "tuesday": "", "wednesday": ""},
"isSellFlag": 1,
"ladder_box_num": "1",
"ladder_box_price": "0.0",
"limit_open_sync_stock_now": false,
"location_code": "",
"min_order_count": "1",
"price": "40.0",
"sku_id": "mtcode_1723264743986589792",
"spec": "500g*1瓶",
"stock": "99",
"price": "1.0",
"sku_id": "mtcode_1752187360965320785",
"spec": "",
"stock": "500",
"unit": "份",
"upc": "6972918583309",
"weight": "500",
"upc": "",
//"weight": "10",
"weight_for_unit": "10.0",
"weight_unit": "克(g)",
},
},
"tag_id": 200001343,
"tag_id": 200001637,
"unit": "份",
"upc": "no_upc",
},