Skip to content

Commit

Permalink
[bug] fix upload file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Mar 3, 2023
1 parent fbd3fc4 commit 9649a1d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions xfs/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/aliyun/alibaba-cloud-sdk-go/services/sts"
jsoniter "github.com/json-iterator/go"
"github.com/yaoapp/gou"
"github.com/yaoapp/gou/session"
"github.com/yaoapp/kun/any"
Expand All @@ -33,9 +34,16 @@ func init() {
// processUpload 上传文件到本地服务器
func processUpload(process *gou.Process) interface{} {
process.ValidateArgNums(1)
tmpfile, ok := process.Args[0].(xun.UploadFile)
if !ok {
exception.New("上传文件参数错误", 400, process.Args[0]).Throw()

var tmpfile xun.UploadFile
data, err := jsoniter.Marshal(process.Args[0])
if err != nil {
exception.New("上传文件参数错误 %s %v", 400, err.Error(), process.Args[0]).Throw()
}

err = jsoniter.Unmarshal(data, &tmpfile)
if err != nil {
exception.New("上传文件参数错误 %s %v", 400, err.Error(), process.Args[0]).Throw()
}

hash := md5.Sum([]byte(time.Now().Format("20060102-15:04:05")))
Expand Down

0 comments on commit 9649a1d

Please sign in to comment.