service/library/middleware/request_decryptor.go

24 lines
489 B
Go

package middleware
import (
"github.com/gin-gonic/gin"
"service/api/base"
"service/library/logger"
interceptor "service/library/taginterceptor"
)
func RequestDecryptor() gin.HandlerFunc {
return func(ctx *gin.Context) {
req := ctx.MustGet("client_req")
err := interceptor.DecryptTagInterceptorInstance().Intercept(req, "jcrypto")
if !base.CheckBadRequest(ctx, err) {
logger.Error("请求解密失败:%v", err)
return
}
ctx.Set("client_req", req)
ctx.Next()
}
}