feat: 新增linux文件上传成功后websocket通知

This commit is contained in:
meilin.huang
2021-11-11 15:56:02 +08:00
parent f6fb732911
commit 78d6c3d1a4
26 changed files with 379 additions and 150 deletions

View File

@@ -2,15 +2,20 @@ package application
import (
"mayfly-go/base/model"
"mayfly-go/base/ws"
"mayfly-go/server/sys/domain/entity"
"mayfly-go/server/sys/domain/repository"
"mayfly-go/server/sys/infrastructure/persistence"
"time"
)
type Msg interface {
GetPageList(condition *entity.Msg, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult
Create(msg *entity.Msg)
// 创建消息并通过ws发送
CreateAndSend(la *model.LoginAccount, msg *ws.Msg)
}
type msgAppImpl struct {
@@ -28,3 +33,10 @@ func (a *msgAppImpl) GetPageList(condition *entity.Msg, pageParam *model.PagePar
func (a *msgAppImpl) Create(msg *entity.Msg) {
a.msgRepo.Insert(msg)
}
func (a *msgAppImpl) CreateAndSend(la *model.LoginAccount, wmsg *ws.Msg) {
now := time.Now()
msg := &entity.Msg{Type: 2, Msg: wmsg.Msg, RecipientId: int64(la.Id), CreateTime: &now, CreatorId: la.Id, Creator: la.Username}
a.msgRepo.Insert(msg)
ws.SendMsg(la.Id, wmsg)
}