diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index 02fc5c06e..d78d03b96 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -6,6 +6,9 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" + "github.com/fatih/structs" + + //"github.com/fatih/structs" "github.com/gin-gonic/gin" sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" "net/http" @@ -57,10 +60,13 @@ func TencentCloudStorageCredential(c *gin.Context) { resp.ErrCode = constant.ErrTencentCredential.ErrCode resp.ErrMsg = err.Error() } else { - resp.Data.Bucket = config.Config.Credential.Tencent.Bucket - resp.Data.Region = config.Config.Credential.Tencent.Region - resp.Data.CredentialResult = res + resp.CosData.Bucket = config.Config.Credential.Tencent.Bucket + resp.CosData.Region = config.Config.Credential.Tencent.Region + resp.CosData.CredentialResult = res } + + resp.Data = structs.Map(&resp.CosData) log.NewInfo(req.OperationID, "TencentCloudStorageCredential return ", resp) + c.JSON(http.StatusOK, resp) } diff --git a/pkg/base_info/cos_api_struct.go b/pkg/base_info/cos_api_struct.go index e3c0237a8..e35931ad9 100644 --- a/pkg/base_info/cos_api_struct.go +++ b/pkg/base_info/cos_api_struct.go @@ -7,12 +7,14 @@ type TencentCloudStorageCredentialReq struct { } type TencentCloudStorageCredentialRespData struct { - *sts.CredentialResult `json:"credentialResult"` - Region string `json:"region"` - Bucket string `json:"bucket"` + *sts.CredentialResult + Region string `json:"region"` + Bucket string `json:"bucket"` } type TencentCloudStorageCredentialResp struct { CommResp - Data TencentCloudStorageCredentialRespData `json:"data"` + CosData TencentCloudStorageCredentialRespData `json:"-"` + + Data map[string]interface{} `json:"data"` }