feat: add WeCom outbox management features including retry and ignore actions, permissions, and UI integration

This commit is contained in:
mlogclub
2026-08-02 14:03:23 +08:00
parent c69b30a659
commit 1d6c0e37db
16 changed files with 457 additions and 1 deletions
@@ -31,3 +31,7 @@ type DeleteChannelRequest struct {
type ResetChannelUserTokenSecretRequest struct {
ID int64 `json:"id"`
}
type ChannelMessageOutboxActionRequest struct {
ID int64 `json:"id"`
}
@@ -3,6 +3,7 @@ package response
import (
"agent-desk/internal/models"
"agent-desk/internal/pkg/enums"
"agent-desk/internal/pkg/utils"
)
type ChannelResponse struct {
@@ -26,6 +27,23 @@ type WxWorkKFAccountResponse struct {
ManagePrivilege bool `json:"managePrivilege"`
}
type ChannelMessageOutboxResponse struct {
ID int64 `json:"id"`
ChannelType string `json:"channelType"`
ConversationID int64 `json:"conversationId"`
MessageID int64 `json:"messageId"`
Payload string `json:"payload"`
SendStatus string `json:"sendStatus"`
RetryCount int `json:"retryCount"`
NextRetryAt string `json:"nextRetryAt"`
LastError string `json:"lastError"`
SentAt string `json:"sentAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
CreateUserName string `json:"createUserName"`
UpdateUserName string `json:"updateUserName"`
}
func BuildChannelResponse(item *models.Channel) ChannelResponse {
if item == nil {
return ChannelResponse{}
@@ -43,3 +61,25 @@ func BuildChannelResponse(item *models.Channel) ChannelResponse {
Remark: item.Remark,
}
}
func BuildChannelMessageOutboxResponse(item *models.ChannelMessageOutbox) ChannelMessageOutboxResponse {
if item == nil {
return ChannelMessageOutboxResponse{}
}
return ChannelMessageOutboxResponse{
ID: item.ID,
ChannelType: item.ChannelType,
ConversationID: item.ConversationID,
MessageID: item.MessageID,
Payload: item.Payload,
SendStatus: item.SendStatus,
RetryCount: item.RetryCount,
NextRetryAt: utils.FormatTimePtr(item.NextRetryAt),
LastError: item.LastError,
SentAt: utils.FormatTimePtr(item.SentAt),
CreatedAt: utils.FormatTime(item.CreatedAt),
UpdatedAt: utils.FormatTime(item.UpdatedAt),
CreateUserName: item.CreateUserName,
UpdateUserName: item.UpdateUserName,
}
}