From 7a19292ae2c49b19248195ddea329f00eceeb793 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 19 Jun 2023 14:53:21 +0800 Subject: [PATCH] fix --- .../internal/logic/getmaplibrarylistlogic.go | 9 +-- server/map-library/internal/types/types.go | 68 ++----------------- server_api/map-library.api | 63 ++--------------- 3 files changed, 9 insertions(+), 131 deletions(-) diff --git a/server/map-library/internal/logic/getmaplibrarylistlogic.go b/server/map-library/internal/logic/getmaplibrarylistlogic.go index 762a5451..97eb8193 100644 --- a/server/map-library/internal/logic/getmaplibrarylistlogic.go +++ b/server/map-library/internal/logic/getmaplibrarylistlogic.go @@ -1,7 +1,6 @@ package logic import ( - "encoding/json" "fusenapi/model/gmodel" "fusenapi/server/map-library/internal/svc" "fusenapi/server/map-library/internal/types" @@ -60,6 +59,7 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(userinfo *auth.UserInfo) (res data := types.GetMapLibraryListRsp{ Mid: v.Id, Ctime: time.Unix(*v.Ctime, 0).Format("2006-01-02 15:04:05"), + Info: *v.Info, } //tag拼装 if tagIndex, ok := mapTag[*v.TagId]; ok { @@ -68,13 +68,6 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(userinfo *auth.UserInfo) (res Title: *templateTagList[tagIndex].Title, } } - //解析info - var info types.MapLibraryListInfo - if err = json.Unmarshal([]byte(*v.Info), &info); err != nil { - logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeServiceErr, "json parse info err") - } - data.Info = info list = append(list, data) } return resp.SetStatusWithMessage(basic.CodeOK, "success", list) diff --git a/server/map-library/internal/types/types.go b/server/map-library/internal/types/types.go index 75af6051..6ea4f440 100644 --- a/server/map-library/internal/types/types.go +++ b/server/map-library/internal/types/types.go @@ -6,70 +6,10 @@ import ( ) type GetMapLibraryListRsp struct { - Mid int64 `json:"mid"` - Ctime string `json:"ctime"` - Tag MapLibraryListTag `json:"tag"` - Info MapLibraryListInfo `json:"info"` -} - -type MapLibraryListInfo struct { - Id string `json:"id"` - Tag string `json:"tag"` - Title string `json:"title"` - Type string `json:"type"` - Text string `json:"text"` - Fill string `json:"fill"` - FontSize int64 `json:"fontSize"` - FontFamily string `json:"fontFamily"` - IfBr bool `json:"ifBr"` - IfShow bool `json:"ifShow"` - IfGroup bool `json:"ifGroup"` - MaxNum int64 `json:"maxNum"` - Rotation int64 `json:"rotation"` - Align string `json:"align"` - VerticalAlign string `json:"verticalAlign"` - Material string `json:"material"` - QRcodeType int64 `json:"QRcodeType"` - Width float64 `json:"width"` - Height float64 `json:"height"` - X float64 `json:"x"` - Y float64 `json:"y"` - Opacity float64 `json:"opacity"` - OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"` - ZIndex int64 `json:"zIndex"` - SvgPath string `json:"svgPath"` - Follow MapLibraryListFollow `json:"follow"` - Group []MapLibraryListGroup `json:"group"` - CameraStand MapLibraryListCameraStand `json:"cameraStand"` - MaterialTime string `json:"materialTime"` - MaterialName string `json:"materialName"` -} - -type MapLibraryListCameraStand struct { - X int64 `json:"x"` - Y int64 `json:"y"` - Z int64 `json:"z"` -} - -type MapLibraryListGroup struct { - Tag string `json:"tag"` - Text string `json:"text"` - Title string `json:"title"` - IfBr bool `json:"ifBr"` - IfShow bool `json:"ifShow"` - MaxNum int64 `json:"maxNum"` -} - -type MapLibraryListFollow struct { - Fill string `json:"fill"` - IfShow string `json:"ifShow"` - Content string `json:"content"` -} - -type MapLibraryListOptionalColorItem struct { - Color string `json:"color"` - Name string `json:"name"` - Default bool `json:"default"` + Mid int64 `json:"mid"` + Ctime string `json:"ctime"` + Tag MapLibraryListTag `json:"tag"` + Info string `json:"info"` } type MapLibraryListTag struct { diff --git a/server_api/map-library.api b/server_api/map-library.api index db3a3436..d182e68c 100644 --- a/server_api/map-library.api +++ b/server_api/map-library.api @@ -16,65 +16,10 @@ service map-library { //获取贴图库列表 type GetMapLibraryListRsp { - Mid int64 `json:"mid"` - Ctime string `json:"ctime"` - Tag MapLibraryListTag `json:"tag"` - Info MapLibraryListInfo `json:"info"` -} -type MapLibraryListInfo { - Id string `json:"id"` - Tag string `json:"tag"` - Title string `json:"title"` - Type string `json:"type"` - Text string `json:"text"` - Fill string `json:"fill"` - FontSize int64 `json:"fontSize"` - FontFamily string `json:"fontFamily"` - IfBr bool `json:"ifBr"` - IfShow bool `json:"ifShow"` - IfGroup bool `json:"ifGroup"` - MaxNum int64 `json:"maxNum"` - Rotation int64 `json:"rotation"` - Align string `json:"align"` - VerticalAlign string `json:"verticalAlign"` - Material string `json:"material"` - QRcodeType int64 `json:"QRcodeType"` - Width float64 `json:"width"` - Height float64 `json:"height"` - X float64 `json:"x"` - Y float64 `json:"y"` - Opacity float64 `json:"opacity"` - OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"` - ZIndex int64 `json:"zIndex"` - SvgPath string `json:"svgPath"` - Follow MapLibraryListFollow `json:"follow"` - Group []MapLibraryListGroup `json:"group"` - CameraStand MapLibraryListCameraStand `json:"cameraStand"` - MaterialTime string `json:"materialTime"` - MaterialName string `json:"materialName"` -} -type MapLibraryListCameraStand { - X int64 `json:"x"` - Y int64 `json:"y"` - Z int64 `json:"z"` -} -type MapLibraryListGroup { - Tag string `json:"tag"` - Text string `json:"text"` - Title string `json:"title"` - IfBr bool `json:"ifBr"` - IfShow bool `json:"ifShow"` - MaxNum int64 `json:"maxNum"` -} -type MapLibraryListFollow { - Fill string `json:"fill"` - IfShow string `json:"ifShow"` - Content string `json:"content"` -} -type MapLibraryListOptionalColorItem { - Color string `json:"color"` - Name string `json:"name"` - Default bool `json:"default"` + Mid int64 `json:"mid"` + Ctime string `json:"ctime"` + Tag MapLibraryListTag `json:"tag"` + Info string `json:"info"` } type MapLibraryListTag { Id int64 `json:"id"`