修改
continuous-integration/drone/push Build is passing Details

main
jhc 9 months ago
parent 42ccd8ec4a
commit 6f76dd871e

@ -24,8 +24,6 @@ func (d *DciProvider) GetUploadUrl(_ context.Context, req *dci.GetUploadUrlReque
} }
res, err = d.file.Upload(req) res, err = d.file.Upload(req)
res.ResultMsg = "WORK_CATEGORY_INVALID"
res.ResultCode = "BAD_REQUEST"
return return
} }

@ -9,7 +9,6 @@ import (
"encoding/base64" "encoding/base64"
"errors" "errors"
"fmt" "fmt"
"github.com/alibabacloud-go/tea/tea"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client" bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/jinzhu/copier" "github.com/jinzhu/copier"
"strings" "strings"
@ -93,16 +92,18 @@ func (f *File) Upload(req *dci.GetUploadUrlRequest) (res *dci.GetUploadUrlRespon
fmt.Println("====== =========== =================== 1 ===============") fmt.Println("====== =========== =================== 1 ===============")
if res.ResultCode != "OK" { if res.ResultCode != "OK" {
return res, errCommon.ReturnError(errors.New(res.ResultMsg), res.ResultMsg, "获取授权访问OSS链接 错误:") errCommon.NoReturnError(errors.New(res.ResultMsg), "获取授权访问OSS链接 错误:")
return res, nil
} }
fmt.Println("====== =========== =================== 2 ===============") fmt.Println("====== =========== =================== 2 ===============")
if res.Url == "" || res.FileId == "" { if res.Url == "" || res.FileId == "" {
return res, errCommon.ReturnError(errors.New(res.ResultMsg), res.ResultMsg, "获取授权访问OSS链接 错误:") errCommon.NoReturnError(errors.New(res.ResultMsg), "获取授权访问OSS链接 错误:")
return res, nil
} }
fmt.Println("====== =========== =================== 3 ===============") fmt.Println("====== =========== =================== 3 ===============")
code, result := utils.PutFromFileUrlWithStream(tea.ToString(res.Url), fileName, req.FileName) code, result := utils.PutFromFileUrlWithStream(res.Url, fileName, req.FileName)
if code != 200 { if code != 200 {
return res, errCommon.ReturnError(errors.New(result), result, "上传文件 错误:") return res, errCommon.ReturnError(errors.New(result), result, "上传文件 错误:")
} }

Loading…
Cancel
Save