From 0adaa00a4c6e6540f825937c3de7ae2eb6cf78ca Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 8 Aug 2023 14:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/handler/userlogolisthandler.go | 2 +- .../internal/handler/orderrefundhandler.go | 2 +- .../internal/handler/stripewebhookhandler.go | 2 +- .../internal/handler/uploadcallbackhandler.go | 2 +- .../internal/handler/uploadfilebasehandler.go | 2 +- .../handler/uploadfilesbackendhandler.go | 2 +- .../handler/uploadfilesfrontendhandler.go | 2 +- .../internal/handler/uploadlogohandler.go | 2 +- .../internal/logic/datatransferlogic.go | 4 +++- .../websocket/internal/logic/mq_consumer.go | 1 + .../internal/logic/ws_render_image_logic.go | 1 + server/websocket/internal/types/types.go | 19 ++++++++++++++++++- utils/basic/basic.go | 3 +++ 13 files changed, 34 insertions(+), 10 deletions(-) diff --git a/server/home-user-auth/internal/handler/userlogolisthandler.go b/server/home-user-auth/internal/handler/userlogolisthandler.go index 873ab4d5..4774154d 100644 --- a/server/home-user-auth/internal/handler/userlogolisthandler.go +++ b/server/home-user-auth/internal/handler/userlogolisthandler.go @@ -15,7 +15,7 @@ func UserLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UserLogoListReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/pay/internal/handler/orderrefundhandler.go b/server/pay/internal/handler/orderrefundhandler.go index 3d7998ff..697fe416 100644 --- a/server/pay/internal/handler/orderrefundhandler.go +++ b/server/pay/internal/handler/orderrefundhandler.go @@ -15,7 +15,7 @@ func OrderRefundHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.OrderRefundReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/pay/internal/handler/stripewebhookhandler.go b/server/pay/internal/handler/stripewebhookhandler.go index ca7689d0..7a679aee 100644 --- a/server/pay/internal/handler/stripewebhookhandler.go +++ b/server/pay/internal/handler/stripewebhookhandler.go @@ -25,7 +25,7 @@ func StripeWebhookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { var req types.StripeWebhookReq - // userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + // userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) // if err != nil { // return // } diff --git a/server/upload/internal/handler/uploadcallbackhandler.go b/server/upload/internal/handler/uploadcallbackhandler.go index 3882a06b..4b72d49a 100644 --- a/server/upload/internal/handler/uploadcallbackhandler.go +++ b/server/upload/internal/handler/uploadcallbackhandler.go @@ -15,7 +15,7 @@ func UploadCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UploadCallbackReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/upload/internal/handler/uploadfilebasehandler.go b/server/upload/internal/handler/uploadfilebasehandler.go index 21c9e02f..db910fcd 100644 --- a/server/upload/internal/handler/uploadfilebasehandler.go +++ b/server/upload/internal/handler/uploadfilebasehandler.go @@ -15,7 +15,7 @@ func UploadFileBaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UploadFileBaseReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/upload/internal/handler/uploadfilesbackendhandler.go b/server/upload/internal/handler/uploadfilesbackendhandler.go index 38fe3326..870dae6e 100644 --- a/server/upload/internal/handler/uploadfilesbackendhandler.go +++ b/server/upload/internal/handler/uploadfilesbackendhandler.go @@ -15,7 +15,7 @@ func UploadFilesBackendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UploadFilesReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/upload/internal/handler/uploadfilesfrontendhandler.go b/server/upload/internal/handler/uploadfilesfrontendhandler.go index f28f5eb1..d8572915 100644 --- a/server/upload/internal/handler/uploadfilesfrontendhandler.go +++ b/server/upload/internal/handler/uploadfilesfrontendhandler.go @@ -15,7 +15,7 @@ func UploadFilesFrontendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UploadFilesReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/upload/internal/handler/uploadlogohandler.go b/server/upload/internal/handler/uploadlogohandler.go index 52c58424..b398fe37 100644 --- a/server/upload/internal/handler/uploadlogohandler.go +++ b/server/upload/internal/handler/uploadlogohandler.go @@ -15,7 +15,7 @@ func UploadLogoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UploadLogoReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) + userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req) if err != nil { return } diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index d999d8e3..d2926142 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -8,14 +8,16 @@ import ( "fusenapi/utils/auth" "fusenapi/utils/id_generator" "fusenapi/utils/websocket_data" - "github.com/gorilla/websocket" "net/http" "sync" "time" + "github.com/gorilla/websocket" + "context" "fusenapi/server/websocket/internal/svc" + "github.com/zeromicro/go-zero/core/logx" ) diff --git a/server/websocket/internal/logic/mq_consumer.go b/server/websocket/internal/logic/mq_consumer.go index 7488e229..6276f39c 100644 --- a/server/websocket/internal/logic/mq_consumer.go +++ b/server/websocket/internal/logic/mq_consumer.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fusenapi/constants" "fusenapi/utils/websocket_data" + "github.com/zeromicro/go-zero/core/logx" ) diff --git a/server/websocket/internal/logic/ws_render_image_logic.go b/server/websocket/internal/logic/ws_render_image_logic.go index 978154d0..dbe14335 100644 --- a/server/websocket/internal/logic/ws_render_image_logic.go +++ b/server/websocket/internal/logic/ws_render_image_logic.go @@ -5,6 +5,7 @@ import ( "fusenapi/constants" "fusenapi/utils/hash" "fusenapi/utils/websocket_data" + "github.com/zeromicro/go-zero/core/logx" ) diff --git a/server/websocket/internal/types/types.go b/server/websocket/internal/types/types.go index 70ec268a..266a1bbf 100644 --- a/server/websocket/internal/types/types.go +++ b/server/websocket/internal/types/types.go @@ -5,6 +5,23 @@ import ( "fusenapi/utils/basic" ) +type RequestToUnity struct { +} + +type RequestReadImages struct { +} + +type RenderNotifyReq struct { + Sign string `json:"sign"` + Time int64 `json:"time"` + Info NotifyInfo `json:"info"` +} + +type NotifyInfo struct { + TaskId string `json:"task_id"` //任务id + Image string `json:"image"` +} + type Request struct { } @@ -72,4 +89,4 @@ func (resp *Response) SetStatusWithMessage(sr *basic.StatusResponse, msg string, newResp.Data = data[0] } return newResp -} +} \ No newline at end of file diff --git a/utils/basic/basic.go b/utils/basic/basic.go index ffd4ca75..28f90a5d 100644 --- a/utils/basic/basic.go +++ b/utils/basic/basic.go @@ -81,6 +81,9 @@ var ( CodeAesCbcEncryptionErr = &StatusResponse{5106, "encryption data err"} // 加密数据失败 CodeAesCbcDecryptionErr = &StatusResponse{5107, "decryption data err"} // 解密数据失败 + CodeSharedStateErr = &StatusResponse{5201, "shared state server err"} // 状态机错误 + CodeEmailConfirmationErr = &StatusResponse{5202, "email confirmation err"} // email 验证错误 + CodeFileUploadErr = &StatusResponse{5110, "file upload err"} // 文件上传失败 CodeFileUploadLogoErr = &StatusResponse{5111, "logo upload err"} // 用户上传LOGO失败 )