feat(tenant): 隔离客服通知文件与后台任务
This commit is contained in:
@@ -12,6 +12,8 @@ const (
|
||||
|
||||
type Announcement struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
// TenantID 经营租户归属;旧分销站点公告仍保存在同一记录中。
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_announcements_tenant_site" json:"tenant_id"`
|
||||
// DistributionSiteID 公告归属站点:0=主站,>0=对应分站(分站公告中心按站点隔离)。
|
||||
DistributionSiteID uint64 `gorm:"not null;default:0;index" json:"distribution_site_id"`
|
||||
Title string `gorm:"size:255;not null" json:"title"`
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
type ChatConversation struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_chat_conversations_tenant_created" json:"tenant_id"`
|
||||
OrderID *uint64 `gorm:"uniqueIndex" json:"order_id"`
|
||||
ListingID *uint64 `gorm:"index" json:"listing_id"`
|
||||
DistributionSiteID *uint64 `gorm:"index" json:"distribution_site_id,omitempty"`
|
||||
@@ -108,6 +109,7 @@ func (m *ChatMessage) AfterCreate(tx *gorm.DB) error {
|
||||
|
||||
type ChatQrCode struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_chat_qrcode_pool_tenant_site_status" json:"tenant_id"`
|
||||
ImageURL string `gorm:"size:512;not null" json:"image_url"`
|
||||
GroupName string `gorm:"size:128;not null;default:''" json:"group_name"`
|
||||
DistributionSiteID *uint64 `gorm:"index" json:"distribution_site_id,omitempty"`
|
||||
@@ -128,6 +130,7 @@ func (ChatQrCode) TableName() string {
|
||||
|
||||
type ChatQrCodeDeliveryTask struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_chat_qrcode_delivery_tenant_status" json:"tenant_id"`
|
||||
ConversationID uint64 `gorm:"column:conversation_id;not null;uniqueIndex" json:"conversation_id"`
|
||||
Status string `gorm:"size:16;not null;default:'pending';index" json:"status"`
|
||||
QrCodeID *uint64 `gorm:"column:qrcode_id;index" json:"qrcode_id"`
|
||||
@@ -143,7 +146,8 @@ func (ChatQrCodeDeliveryTask) TableName() string {
|
||||
|
||||
type ChatSupportGroup struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Code string `gorm:"size:64;not null;uniqueIndex" json:"code"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_chat_support_groups_tenant_code;index:idx_chat_support_groups_tenant_status" json:"tenant_id"`
|
||||
Code string `gorm:"size:64;not null;uniqueIndex:uk_chat_support_groups_tenant_code" json:"code"`
|
||||
Name string `gorm:"size:64;not null" json:"name"`
|
||||
Description string `gorm:"size:255;not null;default:''" json:"description"`
|
||||
Status string `gorm:"size:16;not null;default:'active';index" json:"status"`
|
||||
|
||||
@@ -4,6 +4,7 @@ import "time"
|
||||
|
||||
type ChatQuickReply struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_chat_quick_replies_tenant_admin_sort" json:"tenant_id"`
|
||||
AdminUserID uint64 `gorm:"not null;default:0;index" json:"admin_user_id"` // 0=全局, >0=个人
|
||||
Title string `gorm:"size:64;not null" json:"title"`
|
||||
Content string `gorm:"type:text;not null" json:"content"`
|
||||
|
||||
@@ -5,6 +5,7 @@ import "time"
|
||||
// FileUploadOwner 记录用户上传的私有文件归属,用于业务关联创建前的临时访问授权。
|
||||
type FileUploadOwner struct {
|
||||
ID uint64 `gorm:"primaryKey"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_file_upload_owners_tenant_user"`
|
||||
UserID uint64 `gorm:"not null;index"`
|
||||
ObjectKey string `gorm:"size:512;not null;uniqueIndex"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
@@ -4,6 +4,7 @@ import "time"
|
||||
|
||||
type Notification struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_notifications_tenant_user_read" json:"tenant_id"`
|
||||
UserID uint64 `gorm:"not null;index" json:"user_id"`
|
||||
Type string `gorm:"size:32;not null" json:"type"`
|
||||
Title string `gorm:"size:128;not null" json:"title"`
|
||||
@@ -21,6 +22,7 @@ func (Notification) TableName() string {
|
||||
|
||||
type AdminNotification struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_admin_notifications_tenant_user_read" json:"tenant_id"`
|
||||
AdminUserID uint64 `gorm:"not null;index" json:"admin_user_id"`
|
||||
Type string `gorm:"size:32;not null" json:"type"`
|
||||
Title string `gorm:"size:128;not null" json:"title"`
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
// 因此短信通道异常不会影响业务提交。
|
||||
type SmsMessage struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_sms_messages_tenant_node_biz_user;index:idx_sms_messages_tenant_status_id" json:"tenant_id"`
|
||||
UserID uint64 `gorm:"not null;default:0" json:"user_id"`
|
||||
Phone string `gorm:"size:32;not null;default:''" json:"phone"`
|
||||
Node string `gorm:"size:64;not null" json:"node"`
|
||||
|
||||
@@ -4,7 +4,8 @@ import "time"
|
||||
|
||||
type SystemConfig struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Key string `gorm:"column:key;size:128;not null;uniqueIndex" json:"key"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_system_configs_tenant_key" json:"tenant_id"`
|
||||
Key string `gorm:"column:key;size:128;not null;uniqueIndex:uk_system_configs_tenant_key" json:"key"`
|
||||
Value string `gorm:"column:value;type:text;not null" json:"value"`
|
||||
Description string `gorm:"size:255;not null;default:''" json:"description"`
|
||||
UpdatedBy *uint64 `json:"updated_by"`
|
||||
|
||||
Reference in New Issue
Block a user