|
|
@ -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, "上传文件 错误:")
|
|
|
|
}
|
|
|
|
}
|
|
|
|