This commit is contained in:
laodaming 2023-06-14 16:04:43 +08:00
parent 83e45f26b2
commit f7da17778e
5 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,7 @@ func NewFsMapLibraryModel(db *gorm.DB) *FsMapLibraryModel {
}
func (ml *FsMapLibraryModel) GetAllEnabledList(ctx context.Context) (resp []FsMapLibrary, err error) {
err = ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`status` = ?", 1).Find(&resp).Error
err = ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`status` = ?", 0).Find(&resp).Error
if err != nil {
return nil, err
}

View File

@ -7,14 +7,16 @@ import (
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/server/map_library/internal/logic"
"fusenapi/server/map_library/internal/svc"
"fusenapi/utils/auth"
)
func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
/*// 解析jwtToken
// 解析jwtToken
claims, err := svcCtx.ParseJwtToken(r)
// 如果解析出错则返回未授权的JSON响应并记录错误消息
if err != nil {
@ -36,10 +38,10 @@ func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
})
logx.Info("unauthorized:", err.Error())
return
}*/
}
l := logic.NewGetMapLibraryListLogic(r.Context(), svcCtx)
resp := l.GetMapLibraryList(&auth.UserInfo{86})
resp := l.GetMapLibraryList(userinfo)
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
// 否则发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
if resp != nil {

View File

@ -75,5 +75,5 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(userinfo *auth.UserInfo) (res
data.Info = info
list = append(list, data)
}
return resp.SetStatus(basic.CodeOK)
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
}

View File

@ -29,12 +29,12 @@ type MapLibraryListInfo struct {
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
QRcodeType string `json:"QRcodeType"`
QRcodeType int64 `json:"QRcodeType"`
Width float64 `json:"width"`
Height float64 `json:"height"`
X float64 `json:"x"`
Y float64 `json:"y"`
Opacity int64 `json:"opacity"`
Opacity float64 `json:"opacity"`
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`

View File

@ -38,12 +38,12 @@ type MapLibraryListInfo {
Align string `json:"align"`
VerticalAlign string `json:"verticalAlign"`
Material string `json:"material"`
QRcodeType string `json:"QRcodeType"`
QRcodeType int64 `json:"QRcodeType"`
Width float64 `json:"width"`
Height float64 `json:"height"`
X float64 `json:"x"`
Y float64 `json:"y"`
Opacity int64 `json:"opacity"`
Opacity float64 `json:"opacity"`
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
ZIndex int64 `json:"zIndex"`
SvgPath string `json:"svgPath"`