This commit is contained in:
laodaming 2023-06-16 11:43:11 +08:00
parent 86d8e19a97
commit 186a30d429

View File

@ -18,7 +18,7 @@ import (
func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
/* var ( var (
// 定义错误变量 // 定义错误变量
err error err error
// 定义用户信息变量 // 定义用户信息变量
@ -51,7 +51,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} else { } else {
// 如果claims为nil,则认为用户身份为白板用户 // 如果claims为nil,则认为用户身份为白板用户
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0} userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
}*/ }
var req types.UploadQrcodeReq var req types.UploadQrcodeReq
// 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据 // 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据
@ -65,7 +65,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} }
// 创建一个业务逻辑层实例 // 创建一个业务逻辑层实例
l := logic.NewUploadQrcodeLogic(r.Context(), svcCtx) l := logic.NewUploadQrcodeLogic(r.Context(), svcCtx)
resp := l.UploadQrcode(&req, &auth.UserInfo{39, 0}) resp := l.UploadQrcode(&req, userinfo)
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应; // 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
if resp != nil { if resp != nil {
httpx.OkJsonCtx(r.Context(), w, resp) httpx.OkJsonCtx(r.Context(), w, resp)