From a45693685342c0e487698c61d72ee97a0562e5f6 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Mon, 17 Jan 2022 18:25:35 +0800 Subject: [PATCH] Refactor code --- internal/api/third/tencent_cloud_storage_credential.go | 6 +++--- pkg/base_info/cos_api_struct.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index 33aac57b3..537641dee 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -57,9 +57,9 @@ func TencentCloudStorageCredential(c *gin.Context) { resp.ErrCode = constant.ErrTencentCredential.ErrCode resp.ErrMsg = err.Error() } else { - resp.Bucket = config.Config.Credential.Tencent.Bucket - resp.Region = config.Config.Credential.Tencent.Region - resp.CredentialResult = res + resp.Data.Bucket = config.Config.Credential.Tencent.Bucket + resp.Data.Region = config.Config.Credential.Tencent.Region + resp.Data.CredentialResult = res } c.JSON(http.StatusOK, resp) } diff --git a/pkg/base_info/cos_api_struct.go b/pkg/base_info/cos_api_struct.go index 5efda0af1..41568e480 100644 --- a/pkg/base_info/cos_api_struct.go +++ b/pkg/base_info/cos_api_struct.go @@ -6,7 +6,7 @@ type TencentCloudStorageCredentialReq struct { OperationID string `json:"operationID"` } -type tencentCloudStorageCredentialRespData struct { +type TencentCloudStorageCredentialRespData struct { *sts.CredentialResult Region string `json:"region"` Bucket string `json:"bucket"` @@ -14,5 +14,5 @@ type tencentCloudStorageCredentialRespData struct { type TencentCloudStorageCredentialResp struct { CommResp - tencentCloudStorageCredentialRespData `json:"data"` + Data TencentCloudStorageCredentialRespData `json:"data"` }