From 56acf683938760fc242765417c1f5e8299f6a3a0 Mon Sep 17 00:00:00 2001 From: Hiven Date: Thu, 3 Aug 2023 18:27:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/inventory/etc/inventory.yaml | 1 + server/inventory/internal/handler/routes.go | 2 +- server/inventory/internal/types/types.go | 6 +++--- server/inventory/inventory_test.go | 12 ++++++++++++ server_api/inventory.api | 8 ++++---- 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 server/inventory/inventory_test.go diff --git a/server/inventory/etc/inventory.yaml b/server/inventory/etc/inventory.yaml index a8195506..3633f1b0 100644 --- a/server/inventory/etc/inventory.yaml +++ b/server/inventory/etc/inventory.yaml @@ -1,6 +1,7 @@ Name: inventory Host: 0.0.0.0 Port: 9905 + SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest Auth: AccessSecret: fusen2023 diff --git a/server/inventory/internal/handler/routes.go b/server/inventory/internal/handler/routes.go index 3809a2cb..4368a379 100644 --- a/server/inventory/internal/handler/routes.go +++ b/server/inventory/internal/handler/routes.go @@ -18,7 +18,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Handler: TakeHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodPost, Path: "/api/inventory/list", Handler: GetCloudListHandler(serverCtx), }, diff --git a/server/inventory/internal/types/types.go b/server/inventory/internal/types/types.go index 480970e8..e31a945f 100644 --- a/server/inventory/internal/types/types.go +++ b/server/inventory/internal/types/types.go @@ -16,9 +16,9 @@ type TakeForm struct { } type GetCloudListReq struct { - Page int `form:"page"` - PageSize int `form:"page_size"` - Size int64 `form:"size"` + Page int `json:"page"` + PageSize int `json:"page_size"` + Size int64 `json:"size"` } type GetCloudListRsp struct { diff --git a/server/inventory/inventory_test.go b/server/inventory/inventory_test.go new file mode 100644 index 00000000..d035c13a --- /dev/null +++ b/server/inventory/inventory_test.go @@ -0,0 +1,12 @@ +package main + +import ( + "testing" +) + +// var configFile = flag.String("f", "etc/home-user-auth.yaml", "the config file") + +func TestMain(t *testing.T) { + // log.Println(model.RawFieldNames[FsCanteenType]()) + main() +} diff --git a/server_api/inventory.api b/server_api/inventory.api index 33ddd65f..0700842f 100644 --- a/server_api/inventory.api +++ b/server_api/inventory.api @@ -14,7 +14,7 @@ service inventory { post /api/inventory/take(TakeReq) returns (response); //获取云仓库存列表 @handler GetCloudListHandler - get /api/inventory/list(GetCloudListReq) returns (response); + post /api/inventory/list(GetCloudListReq) returns (response); //云仓补货 @handler SupplementHandler post /api/inventory/supplement(SupplementReq) returns (response); @@ -34,9 +34,9 @@ type TakeForm { } //获取云仓库存列表 type GetCloudListReq { - Page int `form:"page"` - PageSize int `form:"page_size"` - Size int64 `form:"size"` + Page int `json:"page"` + PageSize int `json:"page_size"` + Size int64 `json:"size"` } type GetCloudListRsp { WarehouseBoxes int64 `json:"warehouse_boxes"`