feat(shangwutong): sync classifications and update conversations

This commit is contained in:
2026-09-11 17:08:18 +08:00
parent a06d4f4199
commit 31f157a4f5
28 changed files with 2541 additions and 232 deletions
@@ -0,0 +1,26 @@
package model
import (
"time"
"gorm.io/datatypes"
)
// ShangwutongClassificationCache stores the last successful remote catalog per inbox.
// It is deliberately separate from native GoChat tags and CRM categories.
type ShangwutongClassificationCache struct {
InboxID uint `gorm:"primaryKey" json:"inbox_id"`
ConversationKinds datatypes.JSON `gorm:"type:jsonb;not null;default:'[]'" json:"conversation_kinds"`
CustomerColorKinds datatypes.JSON `gorm:"type:jsonb;not null;default:'[]'" json:"customer_color_kinds"`
SyncStatus string `gorm:"size:20;not null;default:never" json:"sync_status"`
SyncedAt *time.Time `json:"synced_at,omitempty"`
LastErrorCode *string `gorm:"size:100" json:"last_error_code,omitempty"`
LastErrorMessage *string `gorm:"type:text" json:"last_error_message,omitempty"`
LastSyncEventID string `gorm:"size:128" json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (ShangwutongClassificationCache) TableName() string {
return "shangwutong_classification_caches"
}