refactor(dingtalk): Rename cardInstanceIds to cardInstanceIDs for consistency

This commit is contained in:
zhaoyunxing 2026-03-09 00:46:28 +08:00
parent 1dd9c83ff6
commit 4352ac6e11

View file

@ -32,8 +32,8 @@ type DingTalkChannel struct {
cancel context.CancelFunc cancel context.CancelFunc
// Map to store session webhooks for each chat // Map to store session webhooks for each chat
sessionWebhooks sync.Map // chatID -> sessionWebhook sessionWebhooks sync.Map // chatID -> sessionWebhook
// chatID -> cardInstanceId // chatID -> cardInstanceID
cardInstanceIds sync.Map cardInstanceIDs sync.Map
} }
// NewDingTalkChannel creates a new DingTalk channel instance // NewDingTalkChannel creates a new DingTalk channel instance
@ -113,7 +113,7 @@ func (c *DingTalkChannel) Send(ctx context.Context, msg bus.OutboundMessage) err
return channels.ErrNotRunning return channels.ErrNotRunning
} }
// Check if we have a card instance ID for this chat (indicating we can send a card reply) // Check if we have a card instance ID for this chat (indicating we can send a card reply)
cardInstanceIdRaw, ok := c.cardInstanceIds.LoadAndDelete(msg.ChatID) cardInstanceIdRaw, ok := c.cardInstanceIDs.LoadAndDelete(msg.ChatID)
if !ok { if !ok {
return c.SendDirectReply(ctx, msg) return c.SendDirectReply(ctx, msg)
} }
@ -261,6 +261,6 @@ func (c *DingTalkChannel) tryCardCreateAndDeliver(ctx context.Context, chatID st
if err != nil { if err != nil {
return err return err
} }
c.cardInstanceIds.Store(chatID, cardInstanceId) c.cardInstanceIDs.Store(chatID, cardInstanceId)
return nil return nil
} }