From 156ec586f04fea6d6ca3dbc34432fc1c83f4c947 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 7 Aug 2023 14:16:09 +0800 Subject: [PATCH] fix --- .../render/internal/logic/rendernotifylogic.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/render/internal/logic/rendernotifylogic.go b/server/render/internal/logic/rendernotifylogic.go index aa735d6d..af298155 100644 --- a/server/render/internal/logic/rendernotifylogic.go +++ b/server/render/internal/logic/rendernotifylogic.go @@ -1,14 +1,12 @@ package logic import ( + "context" "encoding/json" "fusenapi/constants" "fusenapi/utils/auth" "fusenapi/utils/basic" "fusenapi/utils/websocket_data" - "time" - - "context" "fusenapi/server/render/internal/svc" "fusenapi/server/render/internal/types" @@ -40,16 +38,24 @@ func NewRenderNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Rend // } func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) { - if time.Now().Unix()-120 > req.Time /*|| req.Time > time.Now().Unix() */ { + /*if time.Now().Unix()-120 > req.Time || req.Time > time.Now().Unix() { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param time") + }*/ + if req.Info.TaskId == "" { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id") } + if req.Info.Image == "" { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param image") + } + /* if req.Sign == "" { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param sign") + }*/ //验证签名 sha256 /*notifyByte, _ := json.Marshal(req.Info) h := sha256.New() h.Write([]byte(fmt.Sprintf(constants.RENDER_NOTIFY_SIGN_KEY, string(notifyByte), req.Time))) signHex := h.Sum(nil) sign := hex.EncodeToString(signHex) - //fmt.Println(sign) if req.Sign != sign { return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid sign") }*/