tidy code

This commit is contained in:
wenxu12345 2021-12-28 18:03:51 +08:00
parent 188a90f97d
commit 141936e609
2 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -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"`
}