Compare commits
No commits in common. "76a0ea3c0132829ebc99fd382350c8c8cdb4ae4c" and "8cd7d5748876c42bda5c9fbe25faa7821d447682" have entirely different histories.
76a0ea3c01
...
8cd7d57488
@ -2,13 +2,13 @@ package robot
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"fonchain-fiee/api/accountFiee"
|
"fonchain-fiee/api/accountFiee"
|
||||||
"fonchain-fiee/pkg/common/ws"
|
"fonchain-fiee/pkg/common/ws"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"fonchain-fiee/pkg/service/asChat/chatCache"
|
"fonchain-fiee/pkg/service/asChat/chatCache"
|
||||||
"fonchain-fiee/pkg/service/asChat/dto"
|
"fonchain-fiee/pkg/service/asChat/dto"
|
||||||
"fonchain-fiee/pkg/service/asChat/logic"
|
"fonchain-fiee/pkg/service/asChat/logic"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,12 +17,11 @@ func NewReplyWhenUserJoinSession() IRobotTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReplyWhenUserJoinSession struct {
|
type ReplyWhenUserJoinSession struct {
|
||||||
Response string
|
Response string
|
||||||
Sender *accountFiee.ChatUserData
|
Receiver *accountFiee.ChatUserData
|
||||||
Msg string
|
Sender *accountFiee.ChatUserData
|
||||||
Resp string
|
Msg string
|
||||||
sessionId string
|
Resp string
|
||||||
atUserId int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReplyWhenUserJoinSession) Hit(event ws.ListenEventData, sender *accountFiee.ChatUserData) (hit bool) {
|
func (r ReplyWhenUserJoinSession) Hit(event ws.ListenEventData, sender *accountFiee.ChatUserData) (hit bool) {
|
||||||
@ -56,17 +55,17 @@ func (r ReplyWhenUserJoinSession) Hit(event ws.ListenEventData, sender *accountF
|
|||||||
}
|
}
|
||||||
hit = true
|
hit = true
|
||||||
r.Sender = sender
|
r.Sender = sender
|
||||||
r.sessionId = event.Client.SessionId
|
r.Receiver = event.ChatUser
|
||||||
r.atUserId, _ = strconv.Atoi(event.Client.SessionId)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ReplyWhenUserJoinSession) Run(cache *chatCache.ChatCache) (err error) {
|
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{
|
err = logic.NewMessage(context.Background(), cache, r.Sender, dto.NewMessageRequest{
|
||||||
Waiter: true,
|
Waiter: true,
|
||||||
Robot: true,
|
Robot: true,
|
||||||
AtUserId: int64(r.atUserId),
|
AtUserId: r.Receiver.ID,
|
||||||
SessionId: r.sessionId,
|
SessionId: clientSessionId,
|
||||||
Message: dto.Message{
|
Message: dto.Message{
|
||||||
MsgType: 1,
|
MsgType: 1,
|
||||||
Text: r.Resp,
|
Text: r.Resp,
|
||||||
|
Loading…
Reference in New Issue
Block a user