This commit is contained in:
laodaming 2023-08-07 14:16:09 +08:00
parent 956b18a72e
commit 156ec586f0

View File

@ -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")
}*/