58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
package logic
|
|
|
|
import (
|
|
"ecs/proto/old"
|
|
"fmt"
|
|
)
|
|
|
|
const TableUser = "user"
|
|
|
|
type User struct {
|
|
Id string `bson:"_id"`
|
|
UserId uint64 `bson:"user_id"`
|
|
Platform uint32 `bson:"platform"`
|
|
Channel uint32 `bson:"channel"`
|
|
Username string `bson:"username"`
|
|
Password string `bson:"password"`
|
|
CreateTime int64 `bson:"create_time"`
|
|
RecentServer uint32 `bson:"recent_server"`
|
|
BanLogin bool `bson:"ban_login"`
|
|
BanLoginTime int64 `bson:"ban_login_time"`
|
|
|
|
ThirdInfo map[string]interface{} `bson:"third_info"`
|
|
}
|
|
|
|
func UserKey(channel uint32, username string) string {
|
|
return fmt.Sprintf("%d:%s", channel, username)
|
|
}
|
|
|
|
type LoginResult struct {
|
|
Token string
|
|
Username string
|
|
RecentServer uint32
|
|
}
|
|
|
|
const TableCdkey = "cdkey"
|
|
|
|
type Cdkey struct {
|
|
Key string `bson:"_id"`
|
|
Channel uint32 `bson:"channel"`
|
|
Expiration int64 `bson:"expiration"`
|
|
ItemId []uint32 `bson:"item_id"`
|
|
ItemNum []uint32 `bson:"item_num"`
|
|
}
|
|
|
|
func (this *Cdkey) BuildMsgCdkey() *old.Cdkey {
|
|
return &old.Cdkey{
|
|
Channel: this.Channel,
|
|
Key: this.Key,
|
|
Expiration: this.Expiration,
|
|
ItemId: this.ItemId,
|
|
ItemNum: this.ItemNum,
|
|
}
|
|
}
|
|
|
|
type QueryTotal struct {
|
|
Total uint32 `bson:"total"`
|
|
}
|