// Package entity 数据实体 package entity import "time" // User 用户基础信息 type User struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement;comment:全局唯一用户ID(自增)" json:"id"` Username string `gorm:"column:username;comment:用户名(可选,后台管理用)" json:"username"` Nickname string `gorm:"column:nickname;comment:用户昵称(各平台统一)" json:"nickname"` AvatarURL string `gorm:"column:avatar_url;comment:用户头像URL" json:"avatarUrl"` Phone *string `gorm:"column:phone;comment:手机号(脱敏存储,如138****1234)" json:"phone"` Password *string `gorm:"column:password;comment:登录密码" json:"-"` Salt *string `gorm:"column:salt;comment:密码盐值" json:"-"` Gender int8 `gorm:"column:gender;comment:性别:0-未知,1-男,2-女" json:"gender"` Status int8 `gorm:"column:status;comment:状态:0-禁用,1-正常" json:"status"` CreateTime time.Time `gorm:"column:create_time;autoCreateTime;comment:创建时间" json:"createTime"` UpdateTime time.Time `gorm:"column:update_time;autoUpdateTime;comment:更新时间" json:"updateTime"` Deleted int8 `gorm:"column:deleted;comment:软删除:0-未删,1-已删" json:"deleted"` } // TableName 指定表名 func (User) TableName() string { return "t_user" }