data

package
v0.0.0-...-f84f93e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIMIT_MAX = 200 // 每页最大记录数量
	LIMIT_MIN = 20  // 每页最小记录数量
)
View Source
const (
	RESTYPE4 = 4 //私人局
)

Variables

This section is empty.

Functions

func C

func C(collection string) *mgo.Collection

func GenRoomID

func GenRoomID() (uint64, error)

func GenUserID

func GenUserID() (string, error)

func InitIDGen

func InitIDGen()

Types

type CarRecord

type CarRecord struct {
	Id     string   `bson:"_id"`    //
	RoomId uint32   `bson:"RoomId"` //
	Record []uint64 `bson:"Record"` //
	CTime  uint32   `bson:"CTime"`  //
}

func (*CarRecord) Add

func (this *CarRecord) Add() error

func (*CarRecord) Get

func (this *CarRecord) Get() error

type CreateRoomRecord

type CreateRoomRecord struct {
	Userid     string    `bson:"Userid"`     // 开房玩家id
	Roomid     uint32    `bson:"Roomid"`     // 房间id
	Round      uint32    `bson:"Round"`      // 房间局数
	Invitecode string    `bson:"Invitecode"` // 房间邀请码
	Maizi      bool      `bson:"Maizi"`      // 是否买子
	Cost       uint32    `bson:"Cost"`       // 房间消耗
	Ante       uint32    `bson:"Ante"`       // 底分
	Expire     time.Time `bson:"Expire"`     // 房间过期时间
	Date       time.Time `bson:"Date"`       // 时间创建时间戳
}

开房记录

func (*CreateRoomRecord) Save

func (this *CreateRoomRecord) Save() error

type DataResChange

type DataResChange struct {
	Userid   string `bson:"Userid"`   //玩家ID
	Kind     uint32 `bson:"Kind"`     //道具、货币种类
	Time     uint32 `bson:"Time"`     //变动时间
	Channel  uint32 `bson:"Channel"`  //获取、扣除渠道
	Residual uint32 `bson:"Residual"` //剩余量
	Count    int32  `bson:"Count"`    // 变数量
}

type DataResChanges

type DataResChanges []*DataResChange

func (*DataResChanges) Save

func (this *DataResChanges) Save(userid string) error

type DataUserActive

type DataUserActive struct {
	Userid string    `bson:"Userid"` // 用户账号id
	IP     uint32    `bson:"IP"`     // 登录IP
	Time   time.Time `bson:"Time"`   // 时间戳
	Action uint32    `bson:"Action"` // 1:上线,2:下线
}

func (*DataUserActive) Login

func (this *DataUserActive) Login() error

记录登陆时间,没有该玩家数据则插入

func (*DataUserActive) Logout

func (this *DataUserActive) Logout() error

记录退出时间,并累积在线时长

type GameOverRecord

type GameOverRecord struct {
	RoomId     uint32                 `bson:"_id"`           //房间ID
	Invitecode string                 `bson:"Invitecode"`    //房间邀请码
	TotalRound uint32                 `bson:"TotalRound"`    //牌局局数
	Ante       uint32                 `bson:"Ante"`          //底分
	Userids    []string               `bson:"Userids"`       //用户账号id
	Ctime      uint32                 `bson:"Ctime"`         //房间创建时间
	Cid        string                 `bson:"Create_userid"` //房间创建人
	Expire     uint32                 `bson:"Expire"`        //牌局设定的过期时间
	Create     uint32                 `bson:"Create"`        //记录创建时间
	Update     uint32                 `bson:"Update"`        //记录更新时间
	Rounds     []*GameOverRoundRecord `bson:"Rounds"`
}

牌局记录

func (*GameOverRecord) Add

func (this *GameOverRecord) Add() error

func (*GameOverRecord) Get

func (this *GameOverRecord) Get(userid string) error

type GameOverRecords

type GameOverRecords []*GameOverRecord

获取记录

func (*GameOverRecords) Get

func (this *GameOverRecords) Get(userid string, page int, limit int) error

type GameOverRoundRecord

type GameOverRoundRecord struct {
	Users  []*GameOverUserRecord `bson:"Users"`
	Round  uint32                `bson:"Round"`  //牌局局数
	Zhuang uint32                `bson:"Zhuang"` //庄家的座位
	Hutype uint32                `bson:"Hutype"` //1:自摸,2:炮胡,3:黄庄
}

func (*GameOverRoundRecord) Push

func (this *GameOverRoundRecord) Push(roomId uint32) error

type GameOverUserRecord

type GameOverUserRecord struct {
	Seat    uint32 `bson:"Seat"`    //用户位置
	Coin    int32  `bson:"Coin"`    //输赢
	Userid  string `bson:"Userid"`  //用户账号id
	Huvalue uint32 `bson:"Huvalue"` //胡牌状态
	HuCard  uint32 `bson:"HuCard"`  //胡的牌
}

type GameRecordPrivate

type GameRecordPrivate struct {
	Id            string                   `bson:"_id"` //房间ID
	RoomId        uint32                   `bson:"RoomId"`
	Rtype         uint32                   `bson:"Rtype"`   //房间类型
	Ante          uint32                   `bson:"Ante"`    //底分
	Userids       []string                 `bson:"Userids"` //用户账号id
	Users         []*GameRecordPrivateUser `bson:"Users"`
	Ji            byte                     `bson:"Ji"`     //
	HeroJi        uint32                   `bson:"HeroJi"` // 0:无,1:英雄鸡,2:责任鸡,3:责任鸡碰方
	HuCard        byte                     `bson:"HuCard"`
	Ctime         uint32                   `bson:"Ctime"`
	Zhuang        uint32                   `bson:"Zhuang"`
	Invitecode    string                   `bson:"Invitecode"`
	TotalRound    uint32                   `bson:"TotalRound"`    //牌局局数
	Payment       uint32                   `bson:"Payment"`       //付费方式1=AA or 0=房主支付
	Create_userid string                   `bson:"Create_userid"` //房间创建人
	Expire        uint32                   `bson:"Expire"`        //牌局设定的过期时间
	Rname         string                   `bson:"Rname"`         //房间名字
	Round         uint32                   `bson:"Round"`         //牌局局数
}

func (*GameRecordPrivate) Save

func (this *GameRecordPrivate) Save() error

type GameRecordPrivateUser

type GameRecordPrivateUser struct {
	Seat           uint32   `bson:"Seat"`   //用户位置
	Coin           int32    `bson:"Coin"`   //输赢
	Userid         string   `bson:"Userid"` //用户账号id
	StartHandCards []byte   `bson:"StartHandCards"`
	EndHandCards   []byte   `bson:"EndHandCards"`
	OutCards       []byte   `bson:"OutCards"`
	Peng           []uint32 `bson:"Peng"`      //
	Kong           []uint32 `bson:"Kong"`      //
	HuValue        uint32   `bson:"HuValue"`   //胡牌状态
	TingValue      uint32   `bson:"TingValue"` //停牌状态
	HuCard         uint32   `bson:"HuCard"`
}

type RoomIDGen

type RoomIDGen struct {
	ServerID   uint64 `bson:"_id"`
	LastRoomID uint64 `bson:"LastRoomID"`
}

func (*RoomIDGen) Get

func (this *RoomIDGen) Get() (uint64, error)

func (*RoomIDGen) Insert

func (this *RoomIDGen) Insert() error

type ServerIDGen

type ServerIDGen struct {
	ServerID   string `bson:"_id"`
	LastUserID uint64 `bson:"LastUserID"`
}

func (*ServerIDGen) Exists

func (this *ServerIDGen) Exists() bool

func (*ServerIDGen) Get

func (this *ServerIDGen) Get() (string, error)

func (*ServerIDGen) Insert

func (this *ServerIDGen) Insert() error

type Statistics

type Statistics struct {
	Name  string    `bson:"Name"`  // 统计在线的结构体名称
	Date  time.Time `bson:"Date"`  // 时间戳
	Total uint32    `bson:"Total"` // 当前在线的玩家的数据
}

func (*Statistics) Get

func (this *Statistics) Get() error

获取统计数据所以数据

func (*Statistics) GetLatestOne

func (this *Statistics) GetLatestOne() error

获取指手机用户的所以数据

func (*Statistics) Save

func (this *Statistics) Save() error

type User

type User struct {
	Userid        string `bson:"_id"`         // 用户id
	Nickname      string `bson:"Nickname"`    // 用户昵称
	Sex           uint32 `bson:"Sex"`         // 用户性别,男1 女2 非男非女3
	Email         string `bson:"Email"`       // 绑定的邮箱地址
	Phone         string `bson:"Phone"`       // 绑定的手机号码
	Auth          string `bson:"Auth"`        // 密码验证码
	Pwd           string `bson:"Pwd"`         // MD5密码
	Create_ip     uint32 `bson:"Create_ip"`   // 注册账户时的IP地址
	Create_time   uint32 `bson:"Create_time"` // 注册时间
	Terminal      string `bson:"Terminal"`    // 终端类型名字
	Status        uint32 `bson:"Status"`      // 正常1  锁定2  黑名单3
	Address       string `bson:"Address"`     //物理地址
	Photo         string `bson:"Photo"`       //头像
	Qq_uid        string `bson:"Qq_uid"`      //
	Wechat_uid    string `bson:"Wechat_uid"`
	Microblog_uid string `bson:"Microblog_uid"`
	Platform      uint32 `bson:"Platform"`

	Robot    bool   `bson:"Robot"`    //是否是机器人
	RoomCard uint32 `bson:"RoomCard"` //房卡
	Build    string `bson:"Build"`    //绑定id

	Longitude string `bson:"Longitude"` // 经度
	Latitude  string `bson:"Latitude"`  // 纬度
}

func (*User) ExistsPhone

func (this *User) ExistsPhone(phone string) bool

func (*User) Get

func (this *User) Get() error

获取指手机用户的所以数据

func (*User) GetByPhone

func (this *User) GetByPhone() string

func (*User) GetByWechat

func (this *User) GetByWechat(wechat string) error

func (*User) GetPhotoFromDB

func (this *User) GetPhotoFromDB() (string, error)

func (*User) GetPhotoSexName

func (this *User) GetPhotoSexName() error

获取昵称,性别和头像

func (*User) PWDIsOK

func (this *User) PWDIsOK(pwd string) bool

用户登陆密码验证

func (*User) Save

func (this *User) Save() error

func (*User) UpdateNickname

func (this *User) UpdateNickname() error

func (*User) UpdatePWD

func (this *User) UpdatePWD(pwd string) error

func (*User) UpdateParent

func (this *User) UpdateParent() error

func (*User) UpdatePhoto

func (this *User) UpdatePhoto() error

func (*User) UpdateResource

func (this *User) UpdateResource(value map[string]int32) error

批量更改玩家的经济资源

func (*User) UpdateSex

func (this *User) UpdateSex() error

func (*User) VerifyPwdByPhone

func (this *User) VerifyPwdByPhone(pwd string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL