diff --git a/sdk/requests/json_request.go b/sdk/requests/json_request.go index d05de34..4e6b866 100644 --- a/sdk/requests/json_request.go +++ b/sdk/requests/json_request.go @@ -40,7 +40,11 @@ func (request *JsonRequest) GetStyle() string { func (request *JsonRequest) BuildQueries() string { path := strings.TrimLeft(strings.TrimSpace(request.GetActionName()), "/") - request.queries = "/" + path + "?" + utils.GetUrlFormedMap(request.QueryParams) + mod := "&" + if !strings.Contains(path, "?") { + mod = "?" + } + request.queries = "/" + path + mod + utils.GetUrlFormedMap(request.QueryParams) return request.queries } diff --git a/services/oss/client_test.go b/services/oss/client_test.go index daafc0a..e9d37fa 100644 --- a/services/oss/client_test.go +++ b/services/oss/client_test.go @@ -43,10 +43,16 @@ func TestUpload_Del(t *testing.T) { func TestCreateInitMultipartUpload(t *testing.T) { req := CreateInitMultipartUploadRequest() - req.Filepath = "test.jpg" + + extInfo := map[string]any{"game_byname": "tech_test_tencent"} + bExtInfo, _ := json.Marshal(extInfo) + + req.UploadType = "package" req.TargetType = "oss" req.TargetName = "image" req.FileHash = "51c68615b8d21f9b72b02f48c400cb87" + req.Filepath = "q5-01.zip" + req.ExtInfo = string(bExtInfo) client, err := NewClient() if err != nil { t.Error(err) diff --git a/services/oss/multipart_init.go b/services/oss/multipart_init.go index afb18a6..1d0c94d 100644 --- a/services/oss/multipart_init.go +++ b/services/oss/multipart_init.go @@ -15,10 +15,12 @@ const ( type InitMultipartUploadRequest struct { *requests.JsonRequest - Filepath string `position:"Body" field:"filepath"` + UploadType string `position:"Body" field:"upload_type"` TargetType string `position:"Body" field:"target_type"` TargetName string `position:"Body" field:"target_name"` FileHash string `position:"Body" field:"file_hash"` + Filepath string `position:"Body" field:"filepath"` + ExtInfo string `position:"Body" field:"ext_info"` } type InitMultipartUploadResponse struct { @@ -50,7 +52,7 @@ func CreateInitMultipartUploadRequest() (req *InitMultipartUploadRequest) { JsonRequest: &requests.JsonRequest{}, } - req.InitWithApiInfo(HOST, VERSION, "/api/upload/multipart/init?ts="+ts+"&sign="+sign) + req.InitWithApiInfo(HOST, VERSION, "/api/upload/multipart/init?_ts="+ts+"&_sign="+sign) return }