Skip to content

Commit

Permalink
优化文件上传
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Dec 24, 2021
1 parent 019418f commit 8d72f2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controller/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func UploadProgressWs(c *gin.Context) *ResponseBody {
}
for _, v := range core.WcList {
if v.Id == id {
wsConn.WriteMessage(1, []byte(strconv.FormatInt(v.Total, 10)))
wsConn.WriteMessage(1, []byte(strconv.Itoa(v.Total)))
find = true
if !ready {
ready = true
Expand Down
4 changes: 2 additions & 2 deletions core/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ var WcList []*WriteCounter

// WriteCounter 结构体
type WriteCounter struct {
Total int64
Total int
Id string
}

// Write: implement Write interface to write bytes from ssh server into bytes.Buffer.
func (wc *WriteCounter) Write(p []byte) (int, error) {
n := len(p)
wc.Total += int64(n)
wc.Total += n
return n, nil
}

Expand Down

0 comments on commit 8d72f2f

Please sign in to comment.