From 141936e609917a6e398029fed98627be4d17981e Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Tue, 28 Dec 2021 18:03:51 +0800 Subject: [PATCH] tidy code --- internal/api/auth/auth.go | 6 +++--- pkg/base_info/auth_api_struct.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go index 315849aa2..4a912beca 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -36,9 +36,8 @@ func UserRegister(c *gin.Context) { client := rpc.NewAuthClient(etcdConn) reply, err := client.UserRegister(context.Background(), req) if err != nil || reply.CommonResp.ErrCode != 0 { - - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": reply.CommonResp.ErrMsg}) log.NewError(req.OperationID, "UserRegister failed ", err, reply.CommonResp.ErrCode) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": reply.CommonResp.ErrMsg}) return } @@ -51,8 +50,9 @@ func UserRegister(c *gin.Context) { } resp := api.UserRegisterResp{CommResp: api.CommResp{ErrCode: replyToken.CommonResp.ErrCode, ErrMsg: replyToken.CommonResp.ErrMsg}, UserToken: api.UserTokenInfo{UserID: req.UserInfo.UserID, Token: replyToken.Token, ExpiredTime: replyToken.ExpiredTime}} - c.JSON(http.StatusOK, resp) log.NewInfo(req.OperationID, "UserRegister return ", resp) + c.JSON(http.StatusOK, resp) + } func UserToken(c *gin.Context) { diff --git a/pkg/base_info/auth_api_struct.go b/pkg/base_info/auth_api_struct.go index 8dd3923a4..a4db08f84 100644 --- a/pkg/base_info/auth_api_struct.go +++ b/pkg/base_info/auth_api_struct.go @@ -17,7 +17,7 @@ type UserRegisterReq struct { } type UserTokenInfo struct { - UserID string `json:"secret"` + UserID string `json:"userID"` Token string `json:"token"` ExpiredTime int64 `json:"expiredTime"` }