This commit is contained in:
laodaming 2023-06-12 17:16:06 +08:00
parent c71fa6fc12
commit acc6f9c2b4
15 changed files with 28 additions and 16 deletions

View File

@ -25,6 +25,7 @@ func GetCanteenDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func GetCanteenDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.GetCanteenDetailReq var req types.GetCanteenDetailReq
@ -60,5 +62,6 @@ func GetCanteenDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -23,6 +23,5 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: SaveCanteenTypeProductHandler(serverCtx), Handler: SaveCanteenTypeProductHandler(serverCtx),
}, },
}, },
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
) )
} }

View File

@ -25,6 +25,7 @@ func SaveCanteenTypeProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func SaveCanteenTypeProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.SaveCanteenTypeProductReq var req types.SaveCanteenTypeProductReq
@ -60,5 +62,6 @@ func SaveCanteenTypeProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -2,7 +2,6 @@ package handler
import ( import (
"errors" "errors"
"fusenapi/server/data-transfer/internal/types"
"net/http" "net/http"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
@ -25,6 +24,7 @@ func GetQrCodeSetListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,10 +36,11 @@ func GetQrCodeSetListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
l := logic.NewGetQrCodeSetListLogic(r.Context(), svcCtx) l := logic.NewGetQrCodeSetListLogic(r.Context(), svcCtx)
resp := l.GetQrCodeSetList(userinfo) resp := l.GetQrCodeSetList()
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应; // 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
// 否则发送500内部服务器错误的JSON响应并记录错误消息logx.Error。 // 否则发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
if resp != nil { if resp != nil {
@ -49,5 +50,6 @@ func GetQrCodeSetListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -25,6 +25,7 @@ func GetStandardLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func GetStandardLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
l := logic.NewGetStandardLogoListLogic(r.Context(), svcCtx) l := logic.NewGetStandardLogoListLogic(r.Context(), svcCtx)
@ -49,5 +51,6 @@ func GetStandardLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -33,6 +33,5 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: UploadLogoHandler(serverCtx), Handler: UploadLogoHandler(serverCtx),
}, },
}, },
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
) )
} }

View File

@ -25,6 +25,7 @@ func UploadLogoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func UploadLogoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.UploadLogoReq var req types.UploadLogoReq
@ -60,5 +62,6 @@ func UploadLogoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -25,6 +25,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.UploadQrcodeReq var req types.UploadQrcodeReq
@ -60,5 +62,6 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -25,6 +25,7 @@ func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.GetProductListReq var req types.GetProductListReq
@ -60,5 +62,6 @@ func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -25,6 +25,7 @@ func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
l := logic.NewGetSizeByProductLogic(r.Context(), svcCtx) l := logic.NewGetSizeByProductLogic(r.Context(), svcCtx)
@ -49,5 +51,6 @@ func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -25,6 +25,7 @@ func GetSuccessRecommandHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
// 从Token里获取对应的信息 // 从Token里获取对应的信息
@ -36,6 +37,7 @@ func GetSuccessRecommandHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized", Message: "unauthorized",
}) })
logx.Info("unauthorized:", err.Error()) logx.Info("unauthorized:", err.Error())
return
} }
var req types.GetSuccessRecommandReq var req types.GetSuccessRecommandReq
@ -60,5 +62,6 @@ func GetSuccessRecommandHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err) logx.Error(err)
} }
return
} }
} }

View File

@ -28,6 +28,5 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: GetSizeByProductHandler(serverCtx), Handler: GetSizeByProductHandler(serverCtx),
}, },
}, },
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
) )
} }

View File

@ -7,10 +7,6 @@ info (
email: "" email: ""
) )
import "basic.api" import "basic.api"
//验证登录
@server(
jwt: Auth
)
service canteen { service canteen {
//获取餐厅详情 //获取餐厅详情
@handler GetCanteenDetailHandler @handler GetCanteenDetailHandler

View File

@ -9,9 +9,6 @@ info (
import "basic.api" import "basic.api"
@server(
jwt: Auth
)
service data-transfer { service data-transfer {
//获取标准logo列表 //获取标准logo列表
@handler GetStandardLogoListHandler @handler GetStandardLogoListHandler

View File

@ -7,10 +7,6 @@ info (
email: "" email: ""
) )
import "basic.api" import "basic.api"
//验证登录
@server(
jwt: Auth
)
service product { service product {
//获取产品列表 //获取产品列表
@handler GetProductListHandler @handler GetProductListHandler