Update ruler_replyWhenUserJoinSession.go
This commit is contained in:
parent
0c682db6e8
commit
65c14cc10c
@ -2,13 +2,13 @@ package robot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"fonchain-fiee/api/accountFiee"
|
||||
"fonchain-fiee/pkg/common/ws"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/asChat/chatCache"
|
||||
"fonchain-fiee/pkg/service/asChat/dto"
|
||||
"fonchain-fiee/pkg/service/asChat/logic"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -17,11 +17,12 @@ func NewReplyWhenUserJoinSession() IRobotTask {
|
||||
}
|
||||
|
||||
type ReplyWhenUserJoinSession struct {
|
||||
Response string
|
||||
Receiver *accountFiee.ChatUserData
|
||||
Sender *accountFiee.ChatUserData
|
||||
Msg string
|
||||
Resp string
|
||||
Response string
|
||||
Sender *accountFiee.ChatUserData
|
||||
Msg string
|
||||
Resp string
|
||||
sessionId string
|
||||
atUserId int
|
||||
}
|
||||
|
||||
func (r ReplyWhenUserJoinSession) Hit(event ws.ListenEventData, sender *accountFiee.ChatUserData) (hit bool) {
|
||||
@ -55,17 +56,17 @@ func (r ReplyWhenUserJoinSession) Hit(event ws.ListenEventData, sender *accountF
|
||||
}
|
||||
hit = true
|
||||
r.Sender = sender
|
||||
r.Receiver = event.ChatUser
|
||||
r.sessionId = event.Client.SessionId
|
||||
r.atUserId, _ = strconv.Atoi(event.Client.SessionId)
|
||||
return
|
||||
}
|
||||
|
||||
func (r ReplyWhenUserJoinSession) Run(cache *chatCache.ChatCache) (err error) {
|
||||
clientSessionId := fmt.Sprintf("%d", r.Receiver.ID)
|
||||
err = logic.NewMessage(context.Background(), cache, r.Sender, dto.NewMessageRequest{
|
||||
Waiter: true,
|
||||
Robot: true,
|
||||
AtUserId: r.Receiver.ID,
|
||||
SessionId: clientSessionId,
|
||||
AtUserId: int64(r.atUserId),
|
||||
SessionId: r.sessionId,
|
||||
Message: dto.Message{
|
||||
MsgType: 1,
|
||||
Text: r.Resp,
|
||||
|
Loading…
Reference in New Issue
Block a user