fix(tenant): 收紧双站运营提号与录单边界
This commit is contained in:
@@ -15,15 +15,16 @@ const (
|
||||
// platform / operator 存名称快照:后台删掉选项也不影响历史记录展示。
|
||||
type CSManualEntry struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
EntryNo string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entries_entry_no_group,priority:1" json:"entry_no"`
|
||||
EntryGroup string `gorm:"size:16;not null;default:'collect';uniqueIndex:uk_cs_manual_entries_entry_no_group,priority:2;index" json:"entry_group"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_cs_manual_entries_tenant_entry_group,priority:1;index:idx_cs_manual_entries_tenant_admin_created" json:"tenant_id"`
|
||||
EntryNo string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entries_tenant_entry_group,priority:2" json:"entry_no"`
|
||||
EntryGroup string `gorm:"size:16;not null;default:'collect';uniqueIndex:uk_cs_manual_entries_tenant_entry_group,priority:3;index" json:"entry_group"`
|
||||
Platform string `gorm:"size:64;not null;default:'';index" json:"platform"`
|
||||
Operator string `gorm:"size:64;not null;default:'';index" json:"operator"`
|
||||
AdminID uint64 `gorm:"not null;index" json:"admin_id"`
|
||||
AdminID uint64 `gorm:"not null;index;index:idx_cs_manual_entries_tenant_admin_created,priority:2" json:"admin_id"`
|
||||
AdminName string `gorm:"size:64;not null;default:''" json:"admin_name"`
|
||||
AdminUsername string `gorm:"size:64;not null;default:''" json:"admin_username"`
|
||||
Remark string `gorm:"size:255;not null;default:''" json:"remark"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
CreatedAt time.Time `gorm:"index:idx_cs_manual_entries_tenant_admin_created,priority:3" json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
@@ -36,10 +37,11 @@ func (CSManualEntry) TableName() string {
|
||||
// 操作人选项可通过 group_tag 标记所属组别(收号/出号),录单时用于自动带出组别。
|
||||
type CSManualEntryOption struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Type string `gorm:"size:32;not null;uniqueIndex:uk_cs_manual_entry_options_type_name,priority:1" json:"type"`
|
||||
Name string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entry_options_type_name,priority:2" json:"name"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_cs_manual_entry_options_tenant_type_name,priority:1;index:idx_cs_manual_entry_options_tenant_type_sort,priority:1" json:"tenant_id"`
|
||||
Type string `gorm:"size:32;not null;uniqueIndex:uk_cs_manual_entry_options_tenant_type_name,priority:2;index:idx_cs_manual_entry_options_tenant_type_sort,priority:2" json:"type"`
|
||||
Name string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entry_options_tenant_type_name,priority:3" json:"name"`
|
||||
GroupTag string `gorm:"size:16;not null;default:''" json:"group_tag"`
|
||||
SortOrder int `gorm:"not null;default:0" json:"sort_order"`
|
||||
SortOrder int `gorm:"not null;default:0;index:idx_cs_manual_entry_options_tenant_type_sort,priority:3" json:"sort_order"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@ package model
|
||||
|
||||
import "time"
|
||||
|
||||
// FileUploadOwner 记录用户上传的私有文件归属,用于业务关联创建前的临时访问授权。
|
||||
// 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"`
|
||||
AdminID uint64 `gorm:"not null;default:0;index:idx_file_upload_owners_admin"`
|
||||
ObjectKey string `gorm:"size:512;not null;uniqueIndex"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
// 站内上传完成时入卖家钱包;平台代管完成后进入线下结算。
|
||||
type AdminPickup struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_admin_pickups_tenant_status_created" json:"tenant_id"`
|
||||
SourceTenantID uint64 `gorm:"not null;default:0;index:idx_admin_pickups_source_tenant_status_created" json:"source_tenant_id"`
|
||||
PickupNo string `gorm:"size:64;not null;uniqueIndex" json:"pickup_no"`
|
||||
ListingID uint64 `gorm:"not null;index" json:"listing_id"`
|
||||
AccountID uint64 `gorm:"not null;index" json:"account_id"`
|
||||
|
||||
@@ -5,6 +5,7 @@ import "time"
|
||||
// AdminPickupFinancialAdjustment 保存已完成提号的财务调整,原始结算快照不可修改。
|
||||
type AdminPickupFinancialAdjustment struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;index:idx_pickup_financial_adjustment_tenant" json:"tenant_id"`
|
||||
PickupID uint64 `gorm:"not null;index" json:"pickup_id"`
|
||||
ProfitDeltaCent int64 `gorm:"not null;default:0" json:"profit_delta_cent"`
|
||||
SettleDeltaCent int64 `gorm:"not null;default:0" json:"settle_delta_cent"`
|
||||
|
||||
@@ -5,7 +5,8 @@ import "time"
|
||||
// PickupShop 线下提号店铺配置模型。
|
||||
type PickupShop struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"size:100;not null;uniqueIndex" json:"name"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_pickup_shops_tenant_name,priority:1;index:idx_pickup_shops_tenant_status" json:"tenant_id"`
|
||||
Name string `gorm:"size:100;not null;uniqueIndex:uk_pickup_shops_tenant_name,priority:2" json:"name"`
|
||||
Platform string `gorm:"size:32;not null;default:''" json:"platform"`
|
||||
Status string `gorm:"size:20;not null;default:'active';index" json:"status"`
|
||||
SortOrder int `gorm:"not null;default:0" json:"sort_order"`
|
||||
@@ -21,7 +22,8 @@ func (PickupShop) TableName() string {
|
||||
// PickupShopMapping 线下提号店铺历史映射/别名模型。
|
||||
type PickupShopMapping struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
SourceName string `gorm:"size:100;not null;uniqueIndex" json:"source_name"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_pickup_shop_mappings_tenant_source,priority:1" json:"tenant_id"`
|
||||
SourceName string `gorm:"size:100;not null;uniqueIndex:uk_pickup_shop_mappings_tenant_source,priority:2" json:"source_name"`
|
||||
TargetShopID uint64 `gorm:"not null;default:0" json:"target_shop_id"`
|
||||
TargetShopName string `gorm:"size:100;not null;index" json:"target_shop_name"`
|
||||
MappedCount int64 `gorm:"not null;default:0" json:"mapped_count"`
|
||||
@@ -33,4 +35,3 @@ type PickupShopMapping struct {
|
||||
func (PickupShopMapping) TableName() string {
|
||||
return "pickup_shop_mappings"
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import "time"
|
||||
|
||||
type User struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_users_tenant_phone;index:idx_users_tenant_status" json:"tenant_id"`
|
||||
Phone string `gorm:"size:32;not null;uniqueIndex:uk_users_tenant_phone" json:"phone"`
|
||||
TenantID uint64 `gorm:"not null;default:0;uniqueIndex:uk_users_tenant_site_phone,priority:1;index:idx_users_tenant_status" json:"tenant_id"`
|
||||
Phone string `gorm:"size:32;not null;uniqueIndex:uk_users_tenant_site_phone,priority:3" json:"phone"`
|
||||
PasswordHash string `gorm:"size:255;not null;default:''" json:"-"`
|
||||
Nickname string `gorm:"size:64;not null;default:''" json:"nickname"`
|
||||
AvatarURL string `gorm:"size:512;not null;default:''" json:"avatar_url"`
|
||||
@@ -27,7 +27,7 @@ type User struct {
|
||||
TokenVersion int64 `gorm:"not null;default:0" json:"-"`
|
||||
// 注册归因:注册时由前端携带的推广短码。
|
||||
RegisterTrackCode string `gorm:"size:64;index:idx_users_register_track_code" json:"register_track_code,omitempty"`
|
||||
DistributionSiteID uint64 `gorm:"not null;default:0;index:idx_users_distribution_site_id" json:"distribution_site_id"` // 0=主站, >0=对应分销站点
|
||||
DistributionSiteID uint64 `gorm:"not null;default:0;uniqueIndex:uk_users_tenant_site_phone,priority:2;index:idx_users_distribution_site_id" json:"distribution_site_id"` // 0=主站, >0=对应分销站点
|
||||
InviteCode *string `gorm:"size:32;uniqueIndex:uk_users_tenant_invite_code" json:"invite_code,omitempty"`
|
||||
InvitedByID uint64 `gorm:"not null;default:0;index:idx_users_invited_by_id" json:"invited_by_id,omitempty"`
|
||||
InviteVerifiedAt *time.Time `json:"invite_verified_at,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user