fix
This commit is contained in:
parent
956b18a72e
commit
156ec586f0
@ -1,14 +1,12 @@
|
|||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
"fusenapi/utils/websocket_data"
|
"fusenapi/utils/websocket_data"
|
||||||
"time"
|
|
||||||
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"fusenapi/server/render/internal/svc"
|
"fusenapi/server/render/internal/svc"
|
||||||
"fusenapi/server/render/internal/types"
|
"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) {
|
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")
|
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
|
//验证签名 sha256
|
||||||
/*notifyByte, _ := json.Marshal(req.Info)
|
/*notifyByte, _ := json.Marshal(req.Info)
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
h.Write([]byte(fmt.Sprintf(constants.RENDER_NOTIFY_SIGN_KEY, string(notifyByte), req.Time)))
|
h.Write([]byte(fmt.Sprintf(constants.RENDER_NOTIFY_SIGN_KEY, string(notifyByte), req.Time)))
|
||||||
signHex := h.Sum(nil)
|
signHex := h.Sum(nil)
|
||||||
sign := hex.EncodeToString(signHex)
|
sign := hex.EncodeToString(signHex)
|
||||||
//fmt.Println(sign)
|
|
||||||
if req.Sign != sign {
|
if req.Sign != sign {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid sign")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid sign")
|
||||||
}*/
|
}*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user