-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何将响应结果的 msg 改为 message? #49
Comments
查了一下,实现 func LoginAfterFunc(r *ghttp.Request, respData gtoken.Resp) {
r.Response.WriteJson(g.Map{
"code": respData.Code,
"message": respData.Msg,
"data": respData.Data,
})
} |
但是如果未认证,的 response 如何重新呢?尝试了 AuthAfterFunc,它会使实际响应不执行,直接返回 AuthAfterFunc 的 response: func AuthAfterFunc(r *ghttp.Request, respData gtoken.Resp) {
r.Response.WriteJson(g.Map{
"code": respData.Code,
"message": respData.Msg,
"data": respData.Data,
})
} {
"code": 0,
"data": {
"createTime": 1673083704166,
"data": "1",
"refreshTime": 1673515704166,
"userKey": "test",
"uuid": "feca4c8130990b85bc2ba63944e666fc"
},
"message": "success"
} 有没有通过更简单的配置来重新定义 response,比如将 msg 改为 message,有实现此功能吗? |
这个库更新太慢了,也不理会issue或pr,建议fork后自己改,或者自己写个 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我知道在
gtoken_resp.go
文件中可以直接修改,有没有不修改库本身文件的方法?The text was updated successfully, but these errors were encountered: