package admin import ( "common/connection" "time" ) func init() { //注册数据库 connection.RegisterDBModel(&Admin{}) connection.RegisterDBModel(&RecordLoginOfWxUser{}) connection.RegisterDBModel(&RecordWatchADOfWxUser{}) } type Admin struct { ID int64 `gorm:"column:id;primary_key;comment:管理员id;autoIncrementIncrement" json:"id"` //账号 Account string `gorm:"column:account;comment:账号" json:"account"` Name string `gorm:"column:name;comment:管理员名称" json:"name"` Password string `gorm:"column:password;comment:管理员密码" json:"password"` //性别 Sex int32 `gorm:"column:sex;comment:性别" json:"sex"` //生日 Birthday string `gorm:"column:birthday;comment:生日" json:"birthday"` //手机 Phone int64 `gorm:"column:phone;comment:手机" json:"phone"` //邮箱 Email string `gorm:"column:email;comment:邮箱" json:"email"` //微信群【方便发送通知】 WechatGroup string `gorm:"column:wechat_group;comment:微信群" json:"wechat_group"` //备注 Describe string `gorm:"column:describe;comment:备注" json:"describe"` } // 登录相关的记录 type RecordLoginOfWxUser struct { ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"` Uid int64 `gorm:"column:uid;comment:用户唯一Id" json:"uid"` LoginInTime int64 `gorm:"column:loginintime;comment:登录时间" json:"loginintime"` LoginOutTime int64 `gorm:"column:loginouttime;comment:登出时间" json:"loginouttime"` PlayTimes int64 `gorm:"column:playtimes;comment:游玩时长" json:"playtimes"` } // 看广告相关记录 // 记录日期便于按天统计 type RecordWatchADOfWxUser struct { ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"` RecordDate time.Time `gorm:"column:recorddate;type:date;comment:记录日期" json:"recorddate"` Uid int64 `gorm:"column:uid;comment:用户唯一Id" json:"uid"` WatchADNum int32 `gorm:"column:watchadnum;comment:看广告次数" json:"watchadnum"` } func (Admin) TableName() string { return "admin" } func (RecordLoginOfWxUser) TableName() string { return "recordloginofwxuser" } func (RecordWatchADOfWxUser) TableName() string { return "recordwatchadofwxuser" }