2025-01-06 16:01:02 +08:00
|
|
|
|
package admin
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"common/connection"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
//注册数据库
|
|
|
|
|
|
connection.RegisterDBModel(&Admin{})
|
2025-02-08 16:30:07 +08:00
|
|
|
|
connection.RegisterDBModel(&RecordAveragePlayTimes{})
|
|
|
|
|
|
connection.RegisterDBModel(&RecordAverageWatchADNum{})
|
2025-01-06 16:01:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-23 16:12:49 +08:00
|
|
|
|
// 登录相关的记录
|
|
|
|
|
|
type RecordLoginOfWxUser struct {
|
|
|
|
|
|
ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"`
|
|
|
|
|
|
Uid int64 `gorm:"column:uid;comment:用户唯一Id" json:"uid"`
|
2025-02-08 16:30:07 +08:00
|
|
|
|
SeverId int32 `gorm:"column:severId;comment:区服Id" json:"severId"`
|
|
|
|
|
|
RecordDate int64 `gorm:"column:recorddate;comment:记录日期" json:"recorddate"` //只记录当天0点的时间戳,方便查询某一日的数据
|
2025-01-23 16:12:49 +08:00
|
|
|
|
LoginInTime int64 `gorm:"column:loginintime;comment:登录时间" json:"loginintime"`
|
|
|
|
|
|
LoginOutTime int64 `gorm:"column:loginouttime;comment:登出时间" json:"loginouttime"`
|
|
|
|
|
|
PlayTimes int64 `gorm:"column:playtimes;comment:游玩时长" json:"playtimes"`
|
2025-02-08 16:30:07 +08:00
|
|
|
|
//用于统计当日的总上线人数 0=否,1=是
|
|
|
|
|
|
IsFirstLogin int32 `gorm:"column:isfirstlogin;comment:是否首次登录" json:"isfirstlogin"`
|
2025-01-23 16:12:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 看广告相关记录
|
|
|
|
|
|
// 记录日期便于按天统计
|
|
|
|
|
|
type RecordWatchADOfWxUser struct {
|
2025-02-08 16:30:07 +08:00
|
|
|
|
ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"`
|
|
|
|
|
|
RecordDate int64 `gorm:"column:recorddate;comment:记录日期" json:"recorddate"` //只记录当天0点的时间戳,方便查询某一日的数据
|
|
|
|
|
|
Uid int64 `gorm:"column:uid;comment:用户唯一Id" json:"uid"`
|
|
|
|
|
|
SeverId int32 `gorm:"column:severId;comment:区服Id" json:"severId"`
|
|
|
|
|
|
WatchADNum int32 `gorm:"column:watchadnum;comment:看广告次数" json:"watchadnum"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 历史平均看广告次数的记录
|
|
|
|
|
|
// 再次查询的时候就不用计算了
|
|
|
|
|
|
type RecordAverageWatchADNum struct {
|
|
|
|
|
|
ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"`
|
|
|
|
|
|
RecordDate int64 `gorm:"column:recorddate;comment:记录日期" json:"recorddate"` //只记录当天0点的时间戳,方便查询某一日的数据
|
|
|
|
|
|
SeverId int32 `gorm:"column:severid;comment:区服ID" json:"severid"`
|
|
|
|
|
|
AverageWatchADNum float32 `gorm:"column:averageplaytimes;comment:平均看广告次数" json:"averageplaytimes"`
|
|
|
|
|
|
PlayerNum int64 `gorm:"column:playernum;comment:当日看广告人数人数" json:"playernum"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 历史平均在线时长的记录
|
|
|
|
|
|
// 再次查询的时候就不用计算了
|
|
|
|
|
|
type RecordAveragePlayTimes struct {
|
|
|
|
|
|
ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"`
|
|
|
|
|
|
RecordDate int64 `gorm:"column:recorddate;comment:记录日期" json:"recorddate"` //只记录当天0点的时间戳,方便查询某一日的数据
|
|
|
|
|
|
SeverId int32 `gorm:"column:severid;comment:区服ID" json:"severid"`
|
|
|
|
|
|
AveragePlayTimes int64 `gorm:"column:averageplaytimes;comment:平均在线时长" json:"averageplaytimes"`
|
|
|
|
|
|
PlayerNum int64 `gorm:"column:playernum;comment:当日上线人数" json:"playernum"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 记录当前为止的开服数
|
|
|
|
|
|
type WxUserSeverList struct {
|
|
|
|
|
|
ID int64 `gorm:"column:id;primary_key;comment:自增索引;autoIncrementIncrement" json:"id"`
|
|
|
|
|
|
SeverId int32 `gorm:"column:severId;comment:区服Id" json:"severId"`
|
2025-01-23 16:12:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-06 16:01:02 +08:00
|
|
|
|
func (Admin) TableName() string {
|
|
|
|
|
|
return "admin"
|
|
|
|
|
|
}
|
2025-01-23 16:12:49 +08:00
|
|
|
|
|
2025-02-08 16:30:07 +08:00
|
|
|
|
func (RecordAveragePlayTimes) TableName() string {
|
|
|
|
|
|
return "recordaverageplaytimes"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (RecordAverageWatchADNum) TableName() string {
|
|
|
|
|
|
return "recordaveragewatchadnum"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (WxUserSeverList) TableName() string {
|
|
|
|
|
|
return "wxuserseverlist"
|
2025-01-23 16:12:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (RecordWatchADOfWxUser) TableName() string {
|
|
|
|
|
|
return "recordwatchadofwxuser"
|
|
|
|
|
|
}
|
2025-02-08 16:30:07 +08:00
|
|
|
|
|
|
|
|
|
|
func (RecordLoginOfWxUser) TableName() string {
|
|
|
|
|
|
return "recordloginofwxuser"
|
|
|
|
|
|
}
|