Compare commits
3 Commits
e9862a67ba
...
9942bbc74e
| Author | SHA1 | Date | |
|---|---|---|---|
| 9942bbc74e | |||
| fc9f819787 | |||
| 33a4d25ca9 |
@@ -43,7 +43,7 @@ type Device struct {
|
||||
SoftwareVersion string `gorm:"column:software_version;type:varchar(100);not null;default:'';comment:固件版本号" json:"software_version"`
|
||||
SwitchMode string `gorm:"column:switch_mode;type:varchar(10);not null;default:'0';comment:切卡模式:0=自动 1=手动" json:"switch_mode"`
|
||||
LastGatewaySyncAt *time.Time `gorm:"column:last_gateway_sync_at;comment:最后一次 sync-info 同步时间" json:"last_gateway_sync_at,omitempty"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'none';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
@@ -28,7 +28,7 @@ type DeviceImportTask struct {
|
||||
ErrorMessage string `gorm:"column:error_message;type:text;comment:错误信息" json:"error_message"`
|
||||
StartedAt *time.Time `gorm:"column:started_at;comment:开始处理时间" json:"started_at"`
|
||||
CompletedAt *time.Time `gorm:"column:completed_at;comment:完成时间" json:"completed_at"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'none';not null;comment:导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
@@ -5,7 +5,7 @@ import "time"
|
||||
type ImportDeviceRequest struct {
|
||||
BatchNo string `json:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号"`
|
||||
FileKey string `json:"file_key" validate:"required,min=1,max=500" required:"true" minLength:"1" maxLength:"500" description:"对象存储文件路径(通过 /storage/upload-url 获取)"`
|
||||
RealnamePolicy string `json:"realname_policy" validate:"omitempty,oneof=none before_order after_order" description:"实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 none"`
|
||||
RealnamePolicy string `json:"realname_policy" validate:"omitempty,oneof=none before_order after_order" description:"实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 after_order"`
|
||||
}
|
||||
|
||||
type ImportDeviceResponse struct {
|
||||
|
||||
@@ -70,7 +70,7 @@ type ImportIotCardRequest struct {
|
||||
BatchNo string `json:"batch_no" validate:"omitempty,max=100" maxLength:"100" description:"批次号"`
|
||||
FileKey string `json:"file_key" validate:"required,min=1,max=500" required:"true" minLength:"1" maxLength:"500" description:"对象存储文件路径(通过 /storage/upload-url 获取)"`
|
||||
CardCategory string `json:"card_category" validate:"omitempty,oneof=normal industry" description:"卡业务类型 (normal:普通卡, industry:行业卡),默认 normal"`
|
||||
RealnamePolicy string `json:"realname_policy" validate:"omitempty,oneof=none before_order after_order" description:"实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 none"`
|
||||
RealnamePolicy string `json:"realname_policy" validate:"omitempty,oneof=none before_order after_order" description:"实名认证策略 (none:无需实名, before_order:先实名后充值/购买, after_order:先充值/购买后实名),默认 after_order"`
|
||||
}
|
||||
|
||||
type ImportIotCardResponse struct {
|
||||
|
||||
@@ -54,7 +54,7 @@ type IotCard struct {
|
||||
VirtualNo string `gorm:"column:virtual_no;type:varchar(50);uniqueIndex:idx_iot_card_virtual_no,where:deleted_at IS NULL AND virtual_no IS NOT NULL AND virtual_no <> '';comment:虚拟号(可选,非空时全局唯一)" json:"virtual_no,omitempty"`
|
||||
DeviceVirtualNo string `gorm:"column:device_virtual_no;type:varchar(100);not null;default:'';comment:绑定设备的虚拟号快照(未绑定时为空字符串)" json:"device_virtual_no"`
|
||||
LastGatewayReadingMB float64 `gorm:"column:last_gateway_reading_mb;type:float;not null;default:0;comment:上次轮询时网关返回的流量读数(MB)" json:"last_gateway_reading_mb"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'none';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
@@ -32,7 +32,7 @@ type IotCardImportTask struct {
|
||||
StorageBucket string `gorm:"column:storage_bucket;type:varchar(100);comment:对象存储桶名" json:"storage_bucket,omitempty"`
|
||||
StorageKey string `gorm:"column:storage_key;type:varchar(500);comment:对象存储文件路径" json:"storage_key,omitempty"`
|
||||
CardCategory string `gorm:"column:card_category;type:varchar(20);default:normal;not null;comment:卡业务类型(normal/industry)" json:"card_category"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'none';not null;comment:导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||
}
|
||||
|
||||
// CardItem 卡信息(ICCID + MSISDN + VirtualNo)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-- 回滚:将实名认证策略的列默认值恢复为 none(无需实名)
|
||||
|
||||
ALTER TABLE tb_iot_card
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'none';
|
||||
|
||||
ALTER TABLE tb_device
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'none';
|
||||
|
||||
ALTER TABLE tb_iot_card_import_task
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'none';
|
||||
|
||||
ALTER TABLE tb_device_import_task
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'none';
|
||||
@@ -0,0 +1,14 @@
|
||||
-- 将实名认证策略的列默认值从 none 改为 after_order(先充值/购买后实名)
|
||||
-- 仅影响新增记录,现有记录保持原有值不变
|
||||
|
||||
ALTER TABLE tb_iot_card
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'after_order';
|
||||
|
||||
ALTER TABLE tb_device
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'after_order';
|
||||
|
||||
ALTER TABLE tb_iot_card_import_task
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'after_order';
|
||||
|
||||
ALTER TABLE tb_device_import_task
|
||||
ALTER COLUMN realname_policy SET DEFAULT 'after_order';
|
||||
Reference in New Issue
Block a user