Skip to content

Commit

Permalink
Merge pull request #204 from tttao7/develop
Browse files Browse the repository at this point in the history
fix: 发送客服消息的问题
  • Loading branch information
xen0n authored Apr 10, 2024
2 parents 1136f3b + cd495f7 commit 3887053
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
18 changes: 10 additions & 8 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,16 @@ func (c *WorkwxApp) sendMessage(
}

req := reqMessage{
ToUser: recipient.UserIDs,
ToParty: recipient.PartyIDs,
ToTag: recipient.TagIDs,
ChatID: recipient.ChatID,
AgentID: c.AgentID,
MsgType: msgtype,
Content: content,
IsSafe: isSafe,
ToUser: recipient.UserIDs,
ToParty: recipient.PartyIDs,
ToTag: recipient.TagIDs,
ChatID: recipient.ChatID,
AgentID: c.AgentID,
Code: recipient.Code,
OpenKfID: recipient.OpenKfID,
MsgType: msgtype,
Content: content,
IsSafe: isSafe,
}

resp, err := sendRequestFunc(req)
Expand Down
24 changes: 16 additions & 8 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@ type respJSAPITicket struct {

// reqMessage 消息发送请求
type reqMessage struct {
ToUser []string
ToParty []string
ToTag []string
ChatID string
AgentID int64
MsgType string
Content map[string]interface{}
IsSafe bool
ToUser []string
ToParty []string
ToTag []string
ChatID string
AgentID int64
OpenKfID string
Code string
MsgType string
Content map[string]interface{}
IsSafe bool
}

var _ bodyer = reqMessage{}
Expand Down Expand Up @@ -129,6 +131,12 @@ func (x reqMessage) intoBody() ([]byte, error) {
if x.ChatID != "" {
obj["chatid"] = x.ChatID
} else {
if x.Code != "" {
obj["code"] = x.Code
} else if x.OpenKfID != "" {
obj["open_kfid"] = x.OpenKfID
}

obj["touser"] = strings.Join(x.ToUser, "|")
obj["toparty"] = strings.Join(x.ToParty, "|")
obj["totag"] = strings.Join(x.ToTag, "|")
Expand Down

0 comments on commit 3887053

Please sign in to comment.