feat: linux文件上传成功通知调整

This commit is contained in:
meilin.huang
2021-11-12 14:35:34 +08:00
parent 78d6c3d1a4
commit 8fcdde3711
6 changed files with 44 additions and 4 deletions

View File

@@ -8,7 +8,6 @@ import (
"mayfly-go/base/ctx"
"mayfly-go/base/ginx"
"mayfly-go/base/utils"
"mayfly-go/base/ws"
"mayfly-go/server/devops/api/form"
"mayfly-go/server/devops/api/vo"
"mayfly-go/server/devops/application"
@@ -120,10 +119,9 @@ func (m *MachineFile) UploadFile(rc *ctx.ReqCtx) {
g := rc.GinCtx
fid := GetMachineFileId(g)
path := g.PostForm("path")
fileheader, err := g.FormFile("file")
biz.ErrIsNilAppendErr(err, "读取文件失败: %s")
// 通知正在上传
ws.SendMsg(rc.LoginAccount.Id, ws.NewMsg("文件上传", "文件上传中..."))
file, _ := fileheader.Open()
bytes, _ := ioutil.ReadAll(file)

View File

@@ -151,7 +151,7 @@ func (m *machineFileAppImpl) UploadFile(la *model.LoginAccount, fileId uint64, p
createfile.Write(content)
// 保存消息并发送文件上传成功通知
m.msgApp.CreateAndSend(la, ws.SuccessMsg("文件上传", fmt.Sprintf("[%s]文件已成功上传至[%s]", filename, path)))
m.msgApp.CreateAndSend(la, ws.SuccessMsg("文件上传成功", fmt.Sprintf("[%s]文件已成功上传至[%s]", filename, path)))
}

View File

@@ -30,6 +30,7 @@ func (s *System) ConnectWs(g *gin.Context) {
if err = ctx.PermissionHandler(rc); err != nil {
panic(biz.NewBizErr("没有权限"))
}
// 登录账号信息
la := rc.LoginAccount
ws.Put(la.Id, wsConn)