This commit is contained in:
richboo111
2023-10-26 09:45:52 +08:00
5 changed files with 65 additions and 253 deletions

View File

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

View File

@@ -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 {

View File

@@ -170,220 +170,7 @@ func TestStoreSkuUpdateOffShelf(t *testing.T) {
//
var storeList = []int64{100930, 100871}
var skuList = []int64{
26125,
22596,
25103,
25104,
25105,
24656,
30670,
23422,
24097,
30669,
23424,
25535,
23620,
23621,
23622,
31308,
25022,
25717,
25023,
25718,
25685,
27264,
27265,
30396,
24300,
23001,
26049,
23002,
26050,
23417,
26287,
23419,
26289,
30625,
30691,
30611,
23291,
30686,
23294,
31254,
30672,
30671,
30702,
35420,
30687,
30730,
30727,
31312,
31238,
24264,
31022,
24266,
31229,
30663,
23879,
30777,
30889,
30676,
30814,
30219,
30675,
30627,
25518,
31518,
25519,
35242,
26057,
26058,
26447,
26448,
30365,
30830,
25412,
30641,
30657,
30656,
23818,
31200,
6045175,
33638,
31682,
6045386,
24935,
35241,
30875,
26700,
30888,
26701,
31248,
6042133,
34897,
23907,
30559,
30363,
6045167,
6041753,
30700,
26842,
26843,
26040,
35504,
6041970,
26065,
6041969,
6045177,
6045185,
30094,
6045186,
26067,
6045232,
31299,
6045404,
30667,
30780,
30881,
30644,
6041954,
6041955,
30639,
30775,
34417,
30811,
6045326,
35487,
23408,
31020,
23409,
35486,
35490,
23411,
25947,
25949,
30522,
24120,
25014,
30890,
26864,
6040867,
6042128,
25665,
30649,
34959,
25668,
35503,
30768,
26059,
6045098,
31243,
23163,
33156,
6039630,
27056,
34826,
30635,
30876,
30619,
30645,
30904,
31240,
24226,
31524,
25936,
32914,
25735,
32913,
29645,
33391,
30184,
23841,
34354,
30320,
25736,
6045549,
24251,
6045550,
24253,
31423,
31291,
35152,
22840,
27006,
22842,
30900,
26641,
30616,
30743,
26642,
30807,
26493,
26643,
25059,
25158,
26494,
25061,
26495,
31275,
25062,
30704,
26936,
31815,
33075,
30779,
25335,
25336,
22993,
30352,
25417,
25696,
23402,
25418,
25419,
26908,
}
var skuList = []int64{}
// 商品库存修改
func TestStoreSkuStock(t *testing.T) {

View File

@@ -19,7 +19,6 @@ import (
order_orderDetail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/response"
order_searchList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_searchList/request"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"math"
"time"
)
@@ -327,9 +326,9 @@ func (a *API) OrderDelivering(param *order_logisticsAdd_request.OrderLogisticsAd
func (a *API) CreateOrderCallback(orderStatus []byte) (map[string][]interface{}, *CallbackResponse) {
var resp []*OrderCallback
if err := json.Unmarshal(orderStatus, &resp); err != nil {
fmt.Println(err)
return nil, &CallbackResponse{Code: CallbackFailCode, Msg: CallbackFail}
}
globals.SugarLogger.Debugf("============================resp:= %s", utils.Format4Output(resp, false))
callbackResult := make(map[string][]interface{}, 0)
for _, data := range resp {
@@ -466,7 +465,6 @@ func (a *API) CreateOrderCallback(orderStatus []byte) (map[string][]interface{},
if err := json.Unmarshal([]byte(data.Data), &create); err != nil {
return nil, CallbackResponseErr(false)
}
globals.SugarLogger.Debugf("============================data:= %s", utils.Format4Output(create, false))
callbackResult[CallbackShipmentInfoChange] = append(callbackResult[CallbackShipmentInfoChange], create)
default:
return nil, CallbackResponseErr(false)

View File

@@ -134,7 +134,7 @@ func TestBatchDecrypt(t *testing.T) {
// a.OrderUserInfoSensitive("4988354190732430566")
//}
var c = []int64{64270123}
var c = []int64{86794412}
// 删除已经创建商品,重新同步
func TestDeleteSkuAndUploadSku(t *testing.T) {