Files
junhong_cmp_fiber/internal/model/system.go

48 lines
2.4 KiB
Go

package model
import (
"time"
"gorm.io/gorm"
)
// DevCapabilityConfig 开发能力配置模型
// 管理 API 对接参数(AppID、AppSecret、回调地址等)
type DevCapabilityConfig struct {
gorm.Model
BaseModel `gorm:"embedded"`
UserID uint `gorm:"column:user_id;index;not null;comment:用户ID(平台或代理)" json:"user_id"`
AppName string `gorm:"column:app_name;type:varchar(255);comment:应用名称" json:"app_name"`
AppID string `gorm:"column:app_id;type:varchar(100);uniqueIndex:idx_dev_capability_app,where:deleted_at IS NULL;comment:应用ID" json:"app_id"`
AppSecret string `gorm:"column:app_secret;type:varchar(255);comment:应用密钥" json:"app_secret"`
CallbackURL string `gorm:"column:callback_url;type:varchar(500);comment:回调地址" json:"callback_url"`
IPWhitelist string `gorm:"column:ip_whitelist;type:text;comment:IP白名单(多个IP用逗号分隔)" json:"ip_whitelist"`
Status int `gorm:"column:status;type:int;default:1;comment:状态 0=禁用 1=启用" json:"status"`
}
// TableName 指定表名
func (DevCapabilityConfig) TableName() string {
return "tb_dev_capability_config"
}
// CardReplacementRequest 换卡申请模型
// 客户提交的换卡申请管理,处理换卡申请
type CardReplacementRequest struct {
gorm.Model
BaseModel `gorm:"embedded"`
UserID uint `gorm:"column:user_id;index;not null;comment:申请用户ID" json:"user_id"`
OldICCID string `gorm:"column:old_iccid;type:varchar(50);not null;comment:旧卡ICCID" json:"old_iccid"`
NewICCID string `gorm:"column:new_iccid;type:varchar(50);comment:新卡ICCID(审批时填充)" json:"new_iccid"`
Reason string `gorm:"column:reason;type:text;comment:换卡原因" json:"reason"`
Status int `gorm:"column:status;type:int;default:1;comment:状态 1-待处理 2-已通过 3-已拒绝 4-已完成" json:"status"`
ApprovedBy uint `gorm:"column:approved_by;index;comment:处理人用户ID" json:"approved_by"`
ApprovedAt *time.Time `gorm:"column:approved_at;comment:处理时间" json:"approved_at"`
CompletedAt *time.Time `gorm:"column:completed_at;comment:完成时间(新卡激活时间)" json:"completed_at"`
RejectReason string `gorm:"column:reject_reason;type:text;comment:拒绝原因" json:"reject_reason"`
}
// TableName 指定表名
func (CardReplacementRequest) TableName() string {
return "tb_card_replacement_request"
}