This commit is contained in:
邹宗楠
2024-01-30 10:20:14 +08:00
parent 3c5f5316ac
commit ae90c597b2
2 changed files with 29 additions and 29 deletions

View File

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

View File

@@ -1,6 +1,7 @@
package mtwmapi
import (
"encoding/json"
"errors"
"fmt"
"git.rosy.net.cn/baseapi/utils"
@@ -222,51 +223,50 @@ func TestUpdateSkuBoxFee(t *testing.T) {
}
func TestRetailBatchInitData(t *testing.T) {
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "19284062", []map[string]interface{}{
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{}{
map[string]interface{}{
"app_food_code": "1680630415808835610",
"category_name": "厨卫",
"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\":\"豫皇星\",\"valueId\":2533451}],\"valueListIterator\":[{\"$ref\":\"$[3].valueList[0]\"}],\"valueListSize\":1}]",
"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}]",
"description": "",
"is_sold_out": 0,
"min_order_count": 1,
"name": "多功能清洁膏 330g/",
"picture": "http://p0.meituan.net/wmproduct/1d6406c367a2f31dd1c629c10fc024d4143352.jpg,http://p0.meituan.net/wmproduct/92af919285d5720c1952462db686f8ff134176.jpg,http://p0.meituan.net/xianfu/81fa0a6f3d8c556c2ba990fac8471c24157451.jpg,http://p0.meituan.net/xianfu/89eecafad3db2dd6090f8fbb1817e10549354.jpg,http://p0.meituan.net/xianfu/8dceb0ad6317462dc0c9f2d005c2e60b48474.jpg,http://p0.meituan.net/wmproduct/69e2ceb065768ee7440d61a48c087177143299.jpg",
"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": 25,
"sequence": -100,
"price": 40,
"sequence": -188,
"skus": []map[string]interface{}{
{
"available_times": map[string]string{
"friday": "",
"monday": "",
"saturday": "",
"sunday": "",
"thursday": "",
"tuesday": "",
"wednesday": "",
},
//"box_num": "",
//"box_price": "",
"available_times": string(timeString),
"isSellFlag": 1,
"ladder_box_num": "1",
"ladder_box_price": "0.0",
"limit_open_sync_stock_now": false,
"location_code": "",
"min_order_count": "1",
"price": "25.0",
"sku_id": "1680630417767739457",
"spec": "330g*1",
"stock": "998",
"price": "40.0",
"sku_id": "mtcode_1723264743986589792",
"spec": "500g*1",
"stock": "99",
"unit": "份",
"upc": "6948385202395",
//"weight": "330",
"weight_unit": "克(g)",
"weight_for_unit": "330",
"upc": "6972918583309",
"weight": "500",
},
},
"tag_id": 200004920,
"tag_id": 200001343,
"unit": "份",
"upc": "no_upc",
},
})
if err != nil {