Commit 469ec7ae authored by hujiebin's avatar hujiebin

feature/encrypt

parent 6e2e4198
......@@ -5,6 +5,7 @@ import (
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"hilo-group/myerr/bizerr"
"hilo-group/req"
......@@ -133,3 +134,13 @@ func LoggerHandle(c *gin.Context) {
latency := end.Sub(start)
mycontext.CreateMyContext(c.Keys).Log.Infof("request end fullPath:%v,url:%v, method: %v, traceId:%v, latency:%v userId:%v", c.FullPath(), reqUri, method, traceId, latency, userId)
}
// 加密Handle
func EncryptHandle(c *gin.Context) {
if value, ok := c.Get(mycontext.APP_VERSION); ok {
if high, _ := utils.CompareVersion(value.(string), "> 3.9.0"); high {
c.Set(mycontext.InnerEncrypt, true)
}
}
c.Next()
}
......@@ -17,6 +17,7 @@ import (
func InitRouter() *gin.Engine {
var r = gin.Default()
r.Use(EncryptHandle)
r.GET("/group-swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment