fix
This commit is contained in:
parent
83e45f26b2
commit
f7da17778e
|
@ -23,7 +23,7 @@ func NewFsMapLibraryModel(db *gorm.DB) *FsMapLibraryModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ml *FsMapLibraryModel) GetAllEnabledList(ctx context.Context) (resp []FsMapLibrary, err error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,16 @@ import (
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
|
||||||
|
"fusenapi/utils/auth"
|
||||||
|
"fusenapi/utils/basic"
|
||||||
|
|
||||||
"fusenapi/server/map_library/internal/logic"
|
"fusenapi/server/map_library/internal/logic"
|
||||||
"fusenapi/server/map_library/internal/svc"
|
"fusenapi/server/map_library/internal/svc"
|
||||||
"fusenapi/utils/auth"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
/*// 解析jwtToken
|
// 解析jwtToken
|
||||||
claims, err := svcCtx.ParseJwtToken(r)
|
claims, err := svcCtx.ParseJwtToken(r)
|
||||||
// 如果解析出错,则返回未授权的JSON响应并记录错误消息
|
// 如果解析出错,则返回未授权的JSON响应并记录错误消息
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -36,10 +38,10 @@ func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
})
|
})
|
||||||
logx.Info("unauthorized:", err.Error())
|
logx.Info("unauthorized:", err.Error())
|
||||||
return
|
return
|
||||||
}*/
|
}
|
||||||
|
|
||||||
l := logic.NewGetMapLibraryListLogic(r.Context(), svcCtx)
|
l := logic.NewGetMapLibraryListLogic(r.Context(), svcCtx)
|
||||||
resp := l.GetMapLibraryList(&auth.UserInfo{86})
|
resp := l.GetMapLibraryList(userinfo)
|
||||||
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
||||||
// 否则,发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
|
// 否则,发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
|
|
|
@ -75,5 +75,5 @@ func (l *GetMapLibraryListLogic) GetMapLibraryList(userinfo *auth.UserInfo) (res
|
||||||
data.Info = info
|
data.Info = info
|
||||||
list = append(list, data)
|
list = append(list, data)
|
||||||
}
|
}
|
||||||
return resp.SetStatus(basic.CodeOK)
|
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,12 @@ type MapLibraryListInfo struct {
|
||||||
Align string `json:"align"`
|
Align string `json:"align"`
|
||||||
VerticalAlign string `json:"verticalAlign"`
|
VerticalAlign string `json:"verticalAlign"`
|
||||||
Material string `json:"material"`
|
Material string `json:"material"`
|
||||||
QRcodeType string `json:"QRcodeType"`
|
QRcodeType int64 `json:"QRcodeType"`
|
||||||
Width float64 `json:"width"`
|
Width float64 `json:"width"`
|
||||||
Height float64 `json:"height"`
|
Height float64 `json:"height"`
|
||||||
X float64 `json:"x"`
|
X float64 `json:"x"`
|
||||||
Y float64 `json:"y"`
|
Y float64 `json:"y"`
|
||||||
Opacity int64 `json:"opacity"`
|
Opacity float64 `json:"opacity"`
|
||||||
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
|
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
|
||||||
ZIndex int64 `json:"zIndex"`
|
ZIndex int64 `json:"zIndex"`
|
||||||
SvgPath string `json:"svgPath"`
|
SvgPath string `json:"svgPath"`
|
||||||
|
|
|
@ -38,12 +38,12 @@ type MapLibraryListInfo {
|
||||||
Align string `json:"align"`
|
Align string `json:"align"`
|
||||||
VerticalAlign string `json:"verticalAlign"`
|
VerticalAlign string `json:"verticalAlign"`
|
||||||
Material string `json:"material"`
|
Material string `json:"material"`
|
||||||
QRcodeType string `json:"QRcodeType"`
|
QRcodeType int64 `json:"QRcodeType"`
|
||||||
Width float64 `json:"width"`
|
Width float64 `json:"width"`
|
||||||
Height float64 `json:"height"`
|
Height float64 `json:"height"`
|
||||||
X float64 `json:"x"`
|
X float64 `json:"x"`
|
||||||
Y float64 `json:"y"`
|
Y float64 `json:"y"`
|
||||||
Opacity int64 `json:"opacity"`
|
Opacity float64 `json:"opacity"`
|
||||||
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
|
OptionalColor []MapLibraryListOptionalColorItem `json:"optionalColor"`
|
||||||
ZIndex int64 `json:"zIndex"`
|
ZIndex int64 `json:"zIndex"`
|
||||||
SvgPath string `json:"svgPath"`
|
SvgPath string `json:"svgPath"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user