1
|
package v1
|
1
|
package v1
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
|
|
4
|
+ "bytes"
|
|
|
5
|
+ "fmt"
|
4
|
"opp/controllers"
|
6
|
"opp/controllers"
|
5
|
"opp/protocol"
|
7
|
"opp/protocol"
|
6
|
"opp/services/upload"
|
8
|
"opp/services/upload"
|
|
@@ -52,14 +54,17 @@ func (this *UploadController) Voice() { |
|
@@ -52,14 +54,17 @@ func (this *UploadController) Voice() { |
52
|
var request = &protocol.FileRequest{}
|
54
|
var request = &protocol.FileRequest{}
|
53
|
if len(this.Ctx.Request.MultipartForm.File) != 0 {
|
55
|
if len(this.Ctx.Request.MultipartForm.File) != 0 {
|
54
|
var tmp *protocol.FileResponse
|
56
|
var tmp *protocol.FileResponse
|
55
|
- for _, v := range this.Ctx.Request.MultipartForm.File {
|
|
|
56
|
- request.Files = v
|
57
|
+ var logBuf = bytes.NewBufferString("")
|
|
|
58
|
+ for _, key := range upload.GetSortFileKeys(this.Ctx.Request.MultipartForm.File) {
|
|
|
59
|
+ request.Files = this.Ctx.Request.MultipartForm.File[key]
|
|
|
60
|
+ logBuf.WriteString(fmt.Sprintf(" key:%v 文件数量:%v ", key, len(request.Files)))
|
57
|
if tmp, err = upload.Voice(request); err != nil {
|
61
|
if tmp, err = upload.Voice(request); err != nil {
|
58
|
log.Error(err)
|
62
|
log.Error(err)
|
59
|
return
|
63
|
return
|
60
|
}
|
64
|
}
|
61
|
rsp.Paths = append(rsp.Paths, tmp.Paths...)
|
65
|
rsp.Paths = append(rsp.Paths, tmp.Paths...)
|
62
|
}
|
66
|
}
|
|
|
67
|
+ log.Debug("【上传音频文件】 ", logBuf.String())
|
63
|
}
|
68
|
}
|
64
|
msg = protocol.NewReturnResponse(rsp, err)
|
69
|
msg = protocol.NewReturnResponse(rsp, err)
|
65
|
}
|
70
|
}
|
|
@@ -80,7 +85,7 @@ func (this *UploadController) Video() { |
|
@@ -80,7 +85,7 @@ func (this *UploadController) Video() { |
80
|
var tmp *protocol.FileResponse
|
85
|
var tmp *protocol.FileResponse
|
81
|
for _, v := range this.Ctx.Request.MultipartForm.File {
|
86
|
for _, v := range this.Ctx.Request.MultipartForm.File {
|
82
|
request.Files = v
|
87
|
request.Files = v
|
83
|
- if tmp, err = upload.Video(request); err != nil {
|
88
|
+ if tmp, err = upload.Voice(request); err != nil {
|
84
|
log.Error(err)
|
89
|
log.Error(err)
|
85
|
return
|
90
|
return
|
86
|
}
|
91
|
}
|