This commit is contained in:
parent
42ccd8ec4a
commit
6f76dd871e
@ -24,8 +24,6 @@ func (d *DciProvider) GetUploadUrl(_ context.Context, req *dci.GetUploadUrlReque
|
||||
}
|
||||
|
||||
res, err = d.file.Upload(req)
|
||||
res.ResultMsg = "WORK_CATEGORY_INVALID"
|
||||
res.ResultCode = "BAD_REQUEST"
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
||||
"github.com/jinzhu/copier"
|
||||
"strings"
|
||||
@ -93,16 +92,18 @@ func (f *File) Upload(req *dci.GetUploadUrlRequest) (res *dci.GetUploadUrlRespon
|
||||
|
||||
fmt.Println("====== =========== =================== 1 ===============")
|
||||
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 ===============")
|
||||
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 ===============")
|
||||
code, result := utils.PutFromFileUrlWithStream(tea.ToString(res.Url), fileName, req.FileName)
|
||||
code, result := utils.PutFromFileUrlWithStream(res.Url, fileName, req.FileName)
|
||||
if code != 200 {
|
||||
return res, errCommon.ReturnError(errors.New(result), result, "上传文件 错误:")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user