From 7ad555a41be8d3f6e254f2221412212023be97ac Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Tue, 10 May 2022 12:20:53 +0800 Subject: [PATCH] add ParseToken --- internal/api/auth/auth.go | 2 ++ pkg/base_info/auth_api_struct.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go index 3f6d52831..59ad579ca 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -10,6 +10,7 @@ import ( open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "github.com/fatih/structs" "github.com/gin-gonic/gin" "net/http" "strings" @@ -119,6 +120,7 @@ func ParseToken(c *gin.Context) { } resp := api.ParseTokenResp{CommResp: api.CommResp{ErrCode: 0, ErrMsg: ""}, ExpireTime: api.ExpireTime{ExpireTimeSeconds: uint32(expireTime)}} + resp.Data = structs.Map(&resp.ExpireTime) log.NewInfo(params.OperationID, "ParseToken return ", resp) c.JSON(http.StatusOK, resp) } diff --git a/pkg/base_info/auth_api_struct.go b/pkg/base_info/auth_api_struct.go index 777072499..431a00c2c 100644 --- a/pkg/base_info/auth_api_struct.go +++ b/pkg/base_info/auth_api_struct.go @@ -53,5 +53,6 @@ type ExpireTime struct { type ParseTokenResp struct { CommResp - ExpireTime ExpireTime `json:"expireTime"` + Data map[string]interface{} `json:"data"` + ExpireTime ExpireTime `json:"-"` }