diff --git a/platformapi/mtwmapi/act.go b/platformapi/mtwmapi/act.go index eade9c22..19757aa6 100644 --- a/platformapi/mtwmapi/act.go +++ b/platformapi/mtwmapi/act.go @@ -299,7 +299,7 @@ func (a *API) FullDiscountFoodsList(poiCode, actID string) (actFoodsInfo *FullDi break } } - return nil, err + return actFoodsInfo, err } // 批量删除活动商品至指定商品满减活动 diff --git a/platformapi/mtwmapi/act_test.go b/platformapi/mtwmapi/act_test.go index 0271c214..7cbf7a3e 100644 --- a/platformapi/mtwmapi/act_test.go +++ b/platformapi/mtwmapi/act_test.go @@ -35,7 +35,7 @@ func TestFullDiscountBatchSave(t *testing.T) { } func TestFullDiscountList(t *testing.T) { - result, err := api.FullDiscountList(testPoiCode, ActTypeStoreFullDiscount) + result, err := api.FullDiscountList("17626555", ActTypeStoreFullDiscount) if err != nil { t.Fatal(err) } @@ -43,7 +43,7 @@ func TestFullDiscountList(t *testing.T) { } func TestFullDiscountFoodsList(t *testing.T) { - result, err := api.FullDiscountFoodsList(testPoiCode, "497726932") + result, err := api.FullDiscountFoodsList("17626555", "9162539254") if err != nil { t.Fatal(err) } @@ -83,15 +83,29 @@ func TestRetailDiscountBatchSave(t *testing.T) { t.Log(utils.Format4Output(result, false)) } -func TestRetailDiscountList(t *testing.T) { - result, err := api.RetailDiscountList("9202390", RetailActTypeSecKill) +func TestRetailDiscountList(t *testing.T) { //56 1001 + result, err := api.RetailDiscountList("17626555", 1001) if err != nil { t.Fatal(err) } - for _, v := range result { - globals.SugarLogger.Debugf("%s", utils.Format4Output(v, false)) + //for _, v := range result { + // globals.SugarLogger.Debugf("%s", utils.Format4Output(v, false)) + //} + t.Log(utils.Format4Output(result, false)) +} + +func TestNew(t *testing.T) { + startTime := 1696831082 //2023-10-09 13:58:02 + endTime := 1697090282 //2023-10-12 13:58:02 + sTime := 1696089600 //2023-10-01 00:00:00 + eTime := 1698768000 //2023-11-01 00:00:00 + //fmt.Printf("1=%s", startTime < eTime && eTime < endTime) + //fmt.Printf("2=%s", startTime < sTime) + if sTime > endTime || eTime < startTime { + fmt.Println("false") + } else { + fmt.Println("true") } - //t.Log(utils.Format4Output(result, false)) } func TestInStoreCouponList(t *testing.T) { @@ -113,7 +127,7 @@ func TestParseErr4RetailDiscountDelete(t *testing.T) { } func TestGetByAppPoiCodeAndType(t *testing.T) { - result, err := api.GetByAppPoiCodeAndType("10305601", 1, 1) + result, err := api.GetByAppPoiCodeAndType("9472886", 1, 1) if err != nil { t.Fatal(err) } diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 235cfc76..3ed0a4ee 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -23,11 +23,11 @@ func init() { //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") // 果园 - api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") + //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //商超 //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nngsVP37s-HXY86xe85H7Q") //token_n4TwqCntWWuvQwAawzxC0w - //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w + api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gdlIEWwQnWhl8xzj8rtPTw") //token_n4TwqCntWWuvQwAawzxC0w cookieStr := ` acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; ` @@ -43,7 +43,7 @@ func TestAccessAPI(t *testing.T) { } func TestGetOAuthCode(t *testing.T) { - result, err := api.GetOAuthCode("17395411") + result, err := api.GetOAuthCode("9472886") if err != nil { t.Fatal(err) } diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index e28a17d7..6c140e0b 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -588,3 +588,21 @@ func TestGetStoreFreightDetail(t *testing.T) { fmt.Println(utils.Format4Output(detail, false)) fmt.Println(err) } + +func TestNew(t *testing.T) { + opTimeList := []int16{800, 2030, 2100, 2300} + timesLen := len(opTimeList) / 2 * 2 + var strPairs []string + for i := 0; i < timesLen; i += 2 { + if opTimeList[i] != 0 { + strPairs = append(strPairs, JxOperationTime2StrTime(opTimeList[i])+"-"+JxOperationTime2StrTime(opTimeList[i+1])) + } else { + break + } + } + fmt.Println(strings.Join(strPairs, ",")) +} + +func JxOperationTime2StrTime(value int16) string { + return fmt.Sprintf("%02d:%02d", value/100, value%100) +}