mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	Refactoring code
This commit is contained in:
		
							parent
							
								
									51702a58e4
								
							
						
					
					
						commit
						f2574eb4fe
					
				@ -6,6 +6,14 @@ import (
 | 
				
			|||||||
	"Open_IM/pkg/common/constant"
 | 
						"Open_IM/pkg/common/constant"
 | 
				
			||||||
	"Open_IM/pkg/common/log"
 | 
						"Open_IM/pkg/common/log"
 | 
				
			||||||
	"Open_IM/pkg/common/token_verify"
 | 
						"Open_IM/pkg/common/token_verify"
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
						"github.com/fatih/structs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//"github.com/fatih/structs"
 | 
				
			||||||
 | 
						"github.com/gin-gonic/gin"
 | 
				
			||||||
 | 
						sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
 | 
				
			||||||
 | 
					>>>>>>> 17954df (Refactoring code)
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -58,10 +66,13 @@ func TencentCloudStorageCredential(c *gin.Context) {
 | 
				
			|||||||
		resp.ErrCode = constant.ErrTencentCredential.ErrCode
 | 
							resp.ErrCode = constant.ErrTencentCredential.ErrCode
 | 
				
			||||||
		resp.ErrMsg = err.Error()
 | 
							resp.ErrMsg = err.Error()
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		resp.Data.Bucket = config.Config.Credential.Tencent.Bucket
 | 
							resp.CosData.Bucket = config.Config.Credential.Tencent.Bucket
 | 
				
			||||||
		resp.Data.Region = config.Config.Credential.Tencent.Region
 | 
							resp.CosData.Region = config.Config.Credential.Tencent.Region
 | 
				
			||||||
		resp.Data.CredentialResult = res
 | 
							resp.CosData.CredentialResult = res
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	log.NewInfo(req.OperationID, "TencentCloudStorageCredential return", resp)
 | 
					
 | 
				
			||||||
 | 
						resp.Data = structs.Map(&resp.CosData)
 | 
				
			||||||
 | 
						log.NewInfo(req.OperationID, "TencentCloudStorageCredential return ", resp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c.JSON(http.StatusOK, resp)
 | 
						c.JSON(http.StatusOK, resp)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,12 +7,14 @@ type TencentCloudStorageCredentialReq struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type TencentCloudStorageCredentialRespData struct {
 | 
					type TencentCloudStorageCredentialRespData struct {
 | 
				
			||||||
	*sts.CredentialResult `json:"credentialResult"`
 | 
						*sts.CredentialResult
 | 
				
			||||||
	Region                string `json:"region"`
 | 
						Region string `json:"region"`
 | 
				
			||||||
	Bucket                string `json:"bucket"`
 | 
						Bucket string `json:"bucket"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type TencentCloudStorageCredentialResp struct {
 | 
					type TencentCloudStorageCredentialResp struct {
 | 
				
			||||||
	CommResp
 | 
						CommResp
 | 
				
			||||||
	Data TencentCloudStorageCredentialRespData `json:"data"`
 | 
						CosData TencentCloudStorageCredentialRespData `json:"-"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Data map[string]interface{} `json:"data"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user