Files
baseapi/platformapi/ebaiapi/common_test.go
邹宗楠 c740630ce6 1
2026-03-25 09:13:07 +08:00

70 lines
1.3 KiB
Go

package ebaiapi
import (
"fmt"
"testing"
"time"
"git.rosy.net.cn/baseapi/utils"
)
func TestCommonShopCities(t *testing.T) {
result, err := api.CommonShopCities(75)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestCommonShopCategoriesGet(t *testing.T) {
result, err := api.CommonShopCategoriesGet()
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestCommonShopCategories(t *testing.T) {
/*
{
"category1": "厨房生鲜",
"category2": "蔬菜"
},
{
"category1": "水果",
"category2": "水果店"
},
{
"category1": "厨房生鲜",
"category2": "肉类"
},
{
"category1": "厨房生鲜",
"category2": "水产"
} */
result, err := api.CommonShopCategories(274, 2)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestCommonBusinessCategories(t *testing.T) {
result, err := api.CommonBusinessCategories(0)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestUpdateName(t *testing.T) {
t1 := utils.Str2Time("2026-02-07 15:38:34")
t2 := utils.Str2Time("2024-11-27 11:02:55")
fmt.Println(t2.Sub(t1) > 30*24*time.Hour)
fmt.Println(t1.Sub(t2) > 30*24*time.Hour)
}