Commit 05ea1ae1 authored by hujiebin's avatar hujiebin

feat:userDetail

parent f19b2537
...@@ -3,6 +3,7 @@ package resp ...@@ -3,6 +3,7 @@ package resp
import ( import (
"encoding/json" "encoding/json"
"git.hilo.cn/hilo-common/mycontext" "git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"hilo-user/myerr" "hilo-user/myerr"
"hilo-user/req" "hilo-user/req"
...@@ -15,6 +16,7 @@ type Response struct { ...@@ -15,6 +16,7 @@ type Response struct {
MessageData interface{} `json:"messageData"` // 消息详情 MessageData interface{} `json:"messageData"` // 消息详情
OperationMessage interface{} `json:"operationMessage"` // 操作消息 OperationMessage interface{} `json:"operationMessage"` // 操作消息
Data interface{} `json:"data"` // 数据 Data interface{} `json:"data"` // 数据
Edata interface{} `json:"edata"` // 加密数据
} }
type GameResponse struct { type GameResponse struct {
...@@ -36,7 +38,13 @@ func ResponseOk(c *gin.Context, data interface{}) { ...@@ -36,7 +38,13 @@ func ResponseOk(c *gin.Context, data interface{}) {
Code: myerr.GetSuccessCode(), Code: myerr.GetSuccessCode(),
Message: myerr.GetSuccessMsg(), Message: myerr.GetSuccessMsg(),
OperationMessage: myerr.GetSuccessMsg(), OperationMessage: myerr.GetSuccessMsg(),
Data: data, Data: data, // todo,3.9.0覆盖完整之后去掉
}
if _, ok := c.Get(mycontext.InnerEncrypt); ok {
//response.Edata = utils.EncryptionData(data, []byte("484194d4d0f968a7"))
response.Edata = utils.EncryptionData(data, []byte("hilo!@#$%^&*()_+"))
} else {
response.Data = data
} }
printResponseBody(c, &response) printResponseBody(c, &response)
......
...@@ -133,3 +133,9 @@ func LoggerHandle(c *gin.Context) { ...@@ -133,3 +133,9 @@ func LoggerHandle(c *gin.Context) {
latency := end.Sub(start) 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) 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) {
c.Set(mycontext.InnerEncrypt, true)
c.Next()
}
...@@ -28,8 +28,8 @@ func InitRouter() *gin.Engine { ...@@ -28,8 +28,8 @@ func InitRouter() *gin.Engine {
{ {
user.GET("/nameplate", wrapper(user_r.UserNameplate)) user.GET("/nameplate", wrapper(user_r.UserNameplate))
user.GET("/bag/:resType", wrapper(user_r.UserBag)) user.GET("/bag/:resType", wrapper(user_r.UserBag))
user.GET("/detail", wrapper(user_r.UserDetail)) user.GET("/detail", EncryptHandle, wrapper(user_r.UserDetail))
user.GET("/detail/:userExternalId", wrapper(user_r.UserDetailByExternalId)) user.GET("/detail/:userExternalId", EncryptHandle, wrapper(user_r.UserDetailByExternalId))
} }
cp := v2.Group("/cp") cp := v2.Group("/cp")
{ {
......
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