package model import ( "gorm.io/gorm" ) // PersonalCustomer 个人客户模型(微信用户) // 说明:个人客户由微信 OpenID/UnionID 唯一标识 // 手机号、ICCID、设备号通过关联表存储 type PersonalCustomer struct { gorm.Model WxOpenID string `gorm:"column:wx_open_id;type:varchar(100);uniqueIndex:idx_personal_customer_wx_open_id,where:deleted_at IS NULL;not null;comment:微信OpenID(唯一标识)" json:"wx_open_id"` WxUnionID string `gorm:"column:wx_union_id;type:varchar(100);index;not null;comment:微信UnionID" json:"wx_union_id"` Nickname string `gorm:"column:nickname;type:varchar(100);comment:微信昵称" json:"nickname"` AvatarURL string `gorm:"column:avatar_url;type:varchar(500);comment:微信头像URL" json:"avatar_url"` Status int `gorm:"column:status;type:int;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"` } // TableName 指定表名 func (PersonalCustomer) TableName() string { return "tb_personal_customer" }