Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -84,16 +84,24 @@ type AvailableTimesInfo struct {
|
||||
}
|
||||
|
||||
type SkuInfo struct {
|
||||
AvailableTimes *AvailableTimesInfo `json:"available_times"`
|
||||
BoxNum string `json:"box_num"`
|
||||
BoxPrice string `json:"box_price"`
|
||||
LocationCode string `json:"location_code"`
|
||||
Price string `json:"price"`
|
||||
SkuID string `json:"sku_id"`
|
||||
Spec string `json:"spec"`
|
||||
Stock string `json:"stock"`
|
||||
Upc string `json:"upc"`
|
||||
Weight string `json:"weight"`
|
||||
AvailableTimes *AvailableTimesInfo `json:"available_times"`
|
||||
BoxNum string `json:"box_num"`
|
||||
BoxPrice string `json:"box_price"`
|
||||
IsSellFlag int `json:"isSellFlag"`
|
||||
LadderBoxNum string `json:"ladder_box_num"`
|
||||
LadderBoxPrice string `json:"ladder_box_price"`
|
||||
LimitOpenSyncStockNow bool `json:"limit_open_sync_stock_now"`
|
||||
LocationCode string `json:"location_code"`
|
||||
MinOrderCount string `json:"min_order_count"`
|
||||
Price string `json:"price"`
|
||||
SkuId string `json:"sku_id"`
|
||||
Spec string `json:"spec"`
|
||||
Stock string `json:"stock"`
|
||||
Unit string `json:"unit"`
|
||||
Upc string `json:"upc"`
|
||||
Weight string `json:"weight"`
|
||||
//WeightForUnit string `json:"weight_for_unit"` // weight weight_for_unit 至多填写一个
|
||||
//WeightUnit string `json:"weight_unit"`
|
||||
}
|
||||
|
||||
type AppFood struct {
|
||||
@@ -244,8 +252,6 @@ func (a *API) RetailListAll(poiCode string, offset int) (foodList []*AppFood, er
|
||||
data := make([]*AppFood, 0, 0)
|
||||
offset = offset * GeneralMaxLimit
|
||||
batchList, err2 := a.RetailList(poiCode, offset, GeneralMaxLimit) // GeneralMaxLimit
|
||||
globals.SugarLogger.Debugf("==========batchList %d", len(batchList))
|
||||
globals.SugarLogger.Debugf("==========batchList %s", utils.Format4Output(err2, false))
|
||||
if err = err2; err == nil {
|
||||
data = append(data, batchList...)
|
||||
}
|
||||
@@ -298,6 +304,9 @@ func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[
|
||||
if err == nil {
|
||||
failedFoodList, err = handleRetailBatchResult(result)
|
||||
}
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("=============err := %v", err)
|
||||
}
|
||||
|
||||
return failedFoodList, err
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestRetailCatDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailList(t *testing.T) {
|
||||
result, err := api.RetailList("18900165", 1, 100)
|
||||
result, err := api.RetailList("785527", 1, 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -175,33 +175,51 @@ func TestErrList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailBatchInitData(t *testing.T) {
|
||||
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "19120530", []map[string]interface{}{
|
||||
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "19284062", []map[string]interface{}{
|
||||
map[string]interface{}{
|
||||
"app_food_code": 1692848899,
|
||||
"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\":1200000135,\"attrName\":\"包装方式\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"袋\",\"valueId\":1300004918}],\"valueListIterator\":[{\"$ref\":\"$[1].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000088,\"attrName\":\"品牌\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"吉香居\",\"valueId\":1008695}],\"valueListIterator\":[{\"$ref\":\"$[2].valueList[0]\"}],\"valueListSize\":1}]",
|
||||
"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}]",
|
||||
"description": "",
|
||||
"is_sold_out": 0,
|
||||
"min_order_count": 1,
|
||||
"name": "吉香居 麻辣萝卜干泡菜 52g/袋",
|
||||
"picture": "http://p0.meituan.net/retailsp/f2aec3c090c7ee952f61301848f27c09917081.jpg,http://p0.meituan.net/retailsp/c93074d623f04272b28d7b03fd2b8699852829.jpg,http://p0.meituan.net/retailsp/8d2ef2c6f92b7c48f3673a67fe420fbe111196.jpg",
|
||||
"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",
|
||||
"picture_contents": "",
|
||||
"price": 4.5,
|
||||
"sequence": -117,
|
||||
"skus": ` [
|
||||
{
|
||||
"ladder_box_num": "",
|
||||
"ladder_box_price": "0.0",
|
||||
"price": "4.5",
|
||||
"sku_id": 1692848899,
|
||||
"spec": "52g*1袋",
|
||||
"stock": "9999",
|
||||
"upc": "6926896703303",
|
||||
"weight": "52"
|
||||
}
|
||||
]`,
|
||||
"tag_id": 200005035,
|
||||
"unit": "",
|
||||
"price": 25,
|
||||
"sequence": -100,
|
||||
"skus": []map[string]interface{}{
|
||||
{
|
||||
"available_times": map[string]string{
|
||||
"friday": "",
|
||||
"monday": "",
|
||||
"saturday": "",
|
||||
"sunday": "",
|
||||
"thursday": "",
|
||||
"tuesday": "",
|
||||
"wednesday": "",
|
||||
},
|
||||
//"box_num": "",
|
||||
//"box_price": "",
|
||||
"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",
|
||||
"unit": "份",
|
||||
"upc": "6948385202395",
|
||||
//"weight": "330",
|
||||
"weight_unit": "克(g)",
|
||||
"weight_for_unit": "330",
|
||||
},
|
||||
},
|
||||
"tag_id": 200004920,
|
||||
"unit": "份",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user