Skip to content

Commit 7921023

Browse files
committed
重新整理系统接口,信息维护统一放到维护接口中,方便后期权限隔离
1 parent f7d1dd3 commit 7921023

File tree

14 files changed

+371
-37
lines changed

14 files changed

+371
-37
lines changed

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ archives:
2626
- "giserver"
2727
format: binary
2828
name_template: >-
29-
"giserver"_
29+
giserver_
3030
{{- title .Os }}_
3131
{{- if eq .Arch "amd64" }}x86_64
3232
{{- else if eq .Arch "386" }}i386

internal/controller/Data.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,47 @@ func (*dataController) Add(ctx *fiber.Ctx) error {
3737
})
3838
}
3939
}
40+
41+
func (*dataController) Update(ctx *fiber.Ctx) error {
42+
data := new(model.Data)
43+
if err := ctx.BodyParser(data); err != nil {
44+
logger.Errorln(err)
45+
return ctx.SendStatus(fiber.StatusInternalServerError)
46+
}
47+
if data.Id == 0 {
48+
return ctx.JSON(&server.CommonResponse{
49+
Code: -1,
50+
Msg: "id must be provided",
51+
})
52+
}
53+
err := service.DataService.Update(data)
54+
if err != nil {
55+
return ctx.SendStatus(fiber.StatusInternalServerError)
56+
}
57+
return ctx.JSON(&server.CommonResponse{})
58+
}
59+
60+
func (*dataController) List(ctx *fiber.Ctx) error {
61+
condition := new(model.Data)
62+
if err := ctx.QueryParser(condition); err != nil {
63+
logger.Errorln(err)
64+
return ctx.SendStatus(fiber.StatusInternalServerError)
65+
}
66+
limit, offset, orderBy, err := server.ParsePaginationInfoFromQuery(ctx)
67+
if err != nil {
68+
logger.Errorln(err)
69+
return ctx.SendStatus(fiber.StatusInternalServerError)
70+
}
71+
total, list, err := service.DataService.List(condition, offset, limit, orderBy)
72+
if err != nil {
73+
return ctx.SendStatus(fiber.StatusInternalServerError)
74+
}
75+
return ctx.JSON(&server.CommonResponse{
76+
Data: &server.Paginate{
77+
Total: total,
78+
Offset: offset,
79+
Limit: limit,
80+
Items: list,
81+
},
82+
})
83+
}

internal/controller/Index.go

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,64 @@ import (
88
)
99

1010
func InitRouter() {
11-
store := server.Group("/store")
12-
store.Post("/", StoreController.Add)
11+
{
12+
manage := server.Group("/manage")
13+
store := manage.Group("/store")
14+
store.Post("/", StoreController.Add)
15+
store.Put("/", StoreController.Update)
16+
store.Get("/list", StoreController.List)
17+
18+
space := manage.Group("/space")
19+
space.Post("/", SpaceController.Add)
20+
space.Put("/", SpaceController.Update)
21+
space.Get("/list", SpaceController.List)
22+
23+
scene := manage.Group("/scene")
24+
scene.Post("/", SceneController.Add)
25+
scene.Put("/", SceneController.Update)
26+
scene.Get("/list", SceneController.List)
27+
28+
data := manage.Group("/data")
29+
data.Post("/", DataController.Add)
30+
data.Put("/", DataController.Update)
31+
data.Get("/list", DataController.List)
32+
33+
layer := manage.Group("/layer")
34+
layer.Post("/", LayerController.Add)
35+
layer.Put("/", LayerController.Update)
36+
layer.Get("/list", LayerController.List)
37+
}
1338

1439
space := server.Group("/space")
1540
space.Get("/:spaceName", SpaceController.SpaceInfo)
16-
space.Post("/", SpaceController.Add)
1741

1842
scene := server.Group("/scene")
1943
scene.Get("/:sceneId.json", SceneController.SceneInfo)
2044
scene.Get("/:sceneId/layers.json", SceneController.SceneLayers)
2145
scene.Get("/:sceneId", SceneController.SceneInfo).Name("scene.info")
22-
scene.Post("/", SceneController.Add)
2346
scene.Get("/:sceneId/layers/:layerName/extendxml.xml", LayerController.GetLayerExtendXml)
2447

25-
data := server.Group("/data")
26-
data.Post("/", DataController.Add)
27-
28-
layer := server.Group("/layer")
29-
layer.Post("/", LayerController.Add)
30-
3148
// iserver适配
32-
server.Get("/giservices/:spaceName/rest/realspace/scenes.json", SpaceController.SpaceInfo)
33-
server.Get("/giservices/:spaceName/rest/realspace/datas/:dataName/config", LayerController.LayerConfig)
34-
server.Get("/giservices/:spaceName/rest/realspace/datas/:dataName/data/path/:fold/:file",
35-
//etag.New(),
36-
LayerController.TileFile)
37-
38-
server.Get("/giservices/:spaceName/rest/realspace/login.json", func(ctx *fiber.Ctx) error {
39-
return ctx.JSON(fiber.Map{
40-
"random": util.SnowflakeIdString(),
41-
"jsessionID": util.SnowflakeIdString(),
49+
{
50+
server.Get("/giservices/:spaceName/rest/realspace/scenes.json", SpaceController.SpaceInfo)
51+
server.Get("/giservices/:spaceName/rest/realspace/datas/:dataName/config", LayerController.LayerConfig)
52+
server.Get("/giservices/:spaceName/rest/realspace/datas/:dataName/data/path/:fold/:file", LayerController.TileFile)
53+
54+
server.Get("/giservices/:spaceName/rest/realspace/login.json", func(ctx *fiber.Ctx) error {
55+
return ctx.JSON(fiber.Map{
56+
"random": util.SnowflakeIdString(),
57+
"jsessionID": util.SnowflakeIdString(),
58+
})
59+
})
60+
server.Post("/giservices/:spaceName/rest/realspace/login.json", func(ctx *fiber.Ctx) error {
61+
return ctx.JSON(fiber.Map{
62+
"postResultType": "CreateChild",
63+
"succeed": true,
64+
})
4265
})
43-
})
44-
server.Post("/giservices/:spaceName/rest/realspace/login.json", func(ctx *fiber.Ctx) error {
45-
return ctx.JSON(fiber.Map{
46-
"postResultType": "CreateChild",
47-
"succeed": true,
66+
server.Get("/giservices/:spaceName/rest/realspace/_setup.json", func(ctx *fiber.Ctx) error {
67+
ctx.Response().Header.SetContentType(fiber.MIMEApplicationJSONCharsetUTF8)
68+
return ctx.SendString(`{"isCloudLicenseLogin":false,"serviceLanguage":"chinese","isUGODllError":false,"licenseMode":"DefaultLicense","iserverFeaturesPackageType":"ALL","isEduLicense":false,"isLicenseFinished":true,"isServiceNode":false,"isExpress":false,"cloudLicenseSetting":null,"computerName":"iZ25gt8gjcwZ","cloudLicenseValid":false,"isLicenseError":false,"licErrorMsg":"","iserverLicenseInfo":{"cloudLicenseSetting":null,"isCloudLicenseLogin":false,"entryInfos":[{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21002","licenseID":21002,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21007","licenseID":21007,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21004","licenseID":21004,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21006","licenseID":21006,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21003","licenseID":21003,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21005","licenseID":21005,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21010","licenseID":21010,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21009","licenseID":21009,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21011","licenseID":21011,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21014","licenseID":21014,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21012","licenseID":21012,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21013","licenseID":21013,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21015","licenseID":21015,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0}],"productVersion":null,"iserverVersion":"SuperMap iServer高级版","summaryInfo":null,"companyName":"SuperMap","isEduLicense":false,"masterServerAddress":null,"user":"SuperMap","licenseServer":null,"isSuperMapStaff":false},"isSuperMapStaff":false,"serviceLanguages":[],"eduLicenseSetting":null,"isExtendModule":false,"javaActualVersion":"1.8.0_332","iserverUGOVersion":"11.0.1.21420","webLicenseValid":true,"eduLicenseValid":true,"isSupportHardwareLicMode":true,"isPortal":false,"stepParam":null,"systemUGOVersion":"11.0.1.21420","isAdminExist":true,"coreLicExtendExist":false,"isAix":false,"isJDKVersionError":false,"isUGOVersionError":false,"javaExpectedVersion":"1.8","coreLicExistButUnavailable":false}`)
4869
})
49-
})
50-
server.Get("/giservices/:spaceName/rest/realspace/_setup.json", func(ctx *fiber.Ctx) error {
51-
ctx.Response().Header.SetContentType(fiber.MIMEApplicationJSONCharsetUTF8)
52-
return ctx.SendString(`{"isCloudLicenseLogin":false,"serviceLanguage":"chinese","isUGODllError":false,"licenseMode":"DefaultLicense","iserverFeaturesPackageType":"ALL","isEduLicense":false,"isLicenseFinished":true,"isServiceNode":false,"isExpress":false,"cloudLicenseSetting":null,"computerName":"iZ25gt8gjcwZ","cloudLicenseValid":false,"isLicenseError":false,"licErrorMsg":"","iserverLicenseInfo":{"cloudLicenseSetting":null,"isCloudLicenseLogin":false,"entryInfos":[{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21002","licenseID":21002,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21007","licenseID":21007,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21004","licenseID":21004,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21006","licenseID":21006,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21003","licenseID":21003,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21005","licenseID":21005,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21010","licenseID":21010,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21009","licenseID":21009,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21011","licenseID":21011,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21014","licenseID":21014,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21012","licenseID":21012,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21013","licenseID":21013,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0},{"expireDateTime":"2026-11-12","useWith":-1,"licenseStatus":true,"licenseModel":null,"expireDate":{"date":12,"hours":23,"seconds":59,"month":10,"year":126,"minutes":59,"time":1794499199704},"hardwareKeyType":null,"licenseName":"21015","licenseID":21015,"isTrial":false,"userTrademark":"SuperMap","watermarkMode":0}],"productVersion":null,"iserverVersion":"SuperMap iServer高级版","summaryInfo":null,"companyName":"SuperMap","isEduLicense":false,"masterServerAddress":null,"user":"SuperMap","licenseServer":null,"isSuperMapStaff":false},"isSuperMapStaff":false,"serviceLanguages":[],"eduLicenseSetting":null,"isExtendModule":false,"javaActualVersion":"1.8.0_332","iserverUGOVersion":"11.0.1.21420","webLicenseValid":true,"eduLicenseValid":true,"isSupportHardwareLicMode":true,"isPortal":false,"stepParam":null,"systemUGOVersion":"11.0.1.21420","isAdminExist":true,"coreLicExtendExist":false,"isAix":false,"isJDKVersionError":false,"isUGOVersionError":false,"javaExpectedVersion":"1.8","coreLicExistButUnavailable":false}`)
53-
})
70+
}
5471
}

internal/controller/Layer.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,48 @@ func (*layerController) Add(ctx *fiber.Ctx) error {
4545
})
4646
}
4747
}
48+
func (*layerController) Update(ctx *fiber.Ctx) error {
49+
data := new(model.SceneLayer)
50+
if err := ctx.BodyParser(data); err != nil {
51+
logger.Errorln(err)
52+
return ctx.SendStatus(fiber.StatusInternalServerError)
53+
}
54+
if data.Id == 0 {
55+
return ctx.JSON(&server.CommonResponse{
56+
Code: -1,
57+
Msg: "id must be provided",
58+
})
59+
}
60+
err := service.LayerService.Update(data)
61+
if err != nil {
62+
return ctx.SendStatus(fiber.StatusInternalServerError)
63+
}
64+
return ctx.JSON(&server.CommonResponse{})
65+
}
66+
func (*layerController) List(ctx *fiber.Ctx) error {
67+
condition := new(model.SceneLayer)
68+
if err := ctx.QueryParser(condition); err != nil {
69+
logger.Errorln(err)
70+
return ctx.SendStatus(fiber.StatusInternalServerError)
71+
}
72+
limit, offset, orderBy, err := server.ParsePaginationInfoFromQuery(ctx)
73+
if err != nil {
74+
logger.Errorln(err)
75+
return ctx.SendStatus(fiber.StatusInternalServerError)
76+
}
77+
total, list, err := service.LayerService.List(condition, offset, limit, orderBy)
78+
if err != nil {
79+
return ctx.SendStatus(fiber.StatusInternalServerError)
80+
}
81+
return ctx.JSON(&server.CommonResponse{
82+
Data: &server.Paginate{
83+
Total: total,
84+
Offset: offset,
85+
Limit: limit,
86+
Items: list,
87+
},
88+
})
89+
}
4890

4991
func (c *layerController) GetLayerExtendXml(ctx *fiber.Ctx) error {
5092
sceneIdStr := ctx.Params("sceneId")

internal/controller/Scene.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,48 @@ func (*sceneController) Add(ctx *fiber.Ctx) error {
4141
})
4242
}
4343
}
44+
func (*sceneController) Update(ctx *fiber.Ctx) error {
45+
data := new(model.Scene)
46+
if err := ctx.BodyParser(data); err != nil {
47+
logger.Errorln(err)
48+
return ctx.SendStatus(fiber.StatusInternalServerError)
49+
}
50+
if data.Id == 0 {
51+
return ctx.JSON(&server.CommonResponse{
52+
Code: -1,
53+
Msg: "id must be provided",
54+
})
55+
}
56+
err := service.SceneService.Update(data)
57+
if err != nil {
58+
return ctx.SendStatus(fiber.StatusInternalServerError)
59+
}
60+
return ctx.JSON(&server.CommonResponse{})
61+
}
62+
func (*sceneController) List(ctx *fiber.Ctx) error {
63+
condition := new(model.Scene)
64+
if err := ctx.QueryParser(condition); err != nil {
65+
logger.Errorln(err)
66+
return ctx.SendStatus(fiber.StatusInternalServerError)
67+
}
68+
limit, offset, orderBy, err := server.ParsePaginationInfoFromQuery(ctx)
69+
if err != nil {
70+
logger.Errorln(err)
71+
return ctx.SendStatus(fiber.StatusInternalServerError)
72+
}
73+
total, list, err := service.SceneService.List(condition, offset, limit, orderBy)
74+
if err != nil {
75+
return ctx.SendStatus(fiber.StatusInternalServerError)
76+
}
77+
return ctx.JSON(&server.CommonResponse{
78+
Data: &server.Paginate{
79+
Total: total,
80+
Offset: offset,
81+
Limit: limit,
82+
Items: list,
83+
},
84+
})
85+
}
4486

4587
func (c *sceneController) SceneInfo(ctx *fiber.Ctx) error {
4688
sceneIdStr := ctx.Params("sceneId")

internal/controller/Space.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,48 @@ func (*spaceController) Add(ctx *fiber.Ctx) error {
4040
})
4141
}
4242
}
43+
func (*spaceController) Update(ctx *fiber.Ctx) error {
44+
data := new(model.Space)
45+
if err := ctx.BodyParser(data); err != nil {
46+
logger.Errorln(err)
47+
return ctx.SendStatus(fiber.StatusInternalServerError)
48+
}
49+
if data.Id == 0 {
50+
return ctx.JSON(&server.CommonResponse{
51+
Code: -1,
52+
Msg: "id must be provided",
53+
})
54+
}
55+
err := service.SpaceService.Update(data)
56+
if err != nil {
57+
return ctx.SendStatus(fiber.StatusInternalServerError)
58+
}
59+
return ctx.JSON(&server.CommonResponse{})
60+
}
61+
func (*spaceController) List(ctx *fiber.Ctx) error {
62+
condition := new(model.Space)
63+
if err := ctx.QueryParser(condition); err != nil {
64+
logger.Errorln(err)
65+
return ctx.SendStatus(fiber.StatusInternalServerError)
66+
}
67+
limit, offset, orderBy, err := server.ParsePaginationInfoFromQuery(ctx)
68+
if err != nil {
69+
logger.Errorln(err)
70+
return ctx.SendStatus(fiber.StatusInternalServerError)
71+
}
72+
total, list, err := service.SpaceService.List(condition, offset, limit, orderBy)
73+
if err != nil {
74+
return ctx.SendStatus(fiber.StatusInternalServerError)
75+
}
76+
return ctx.JSON(&server.CommonResponse{
77+
Data: &server.Paginate{
78+
Total: total,
79+
Offset: offset,
80+
Limit: limit,
81+
Items: list,
82+
},
83+
})
84+
}
4385

4486
func (c *spaceController) SpaceInfo(ctx *fiber.Ctx) error {
4587
spaceName := ctx.Params("spaceName")

0 commit comments

Comments
 (0)