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