mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: linux文件上传成功通知调整
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user