data

package
v0.0.0-...-4a0720b Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

*********************************************************

  • Author : Michael
  • Email : dolotech@163.com
  • Last modified : 2016-01-23 10:07
  • Filename : user.go
  • Description : 用户基础存储数据
  • ******************************************************

*********************************************************

  • Author : Michael
  • Email : dolotech@163.com
  • Last modified : 2016-06-11 16:22
  • Filename : widget.go
  • Description : 游戏道具的数据
  • ******************************************************

Index

Constants

View Source
const (
	OPERATE_KIND_DEL_ADMIN    uint32 = 1 //  删除管理员
	OPERATE_KIND_ADD_ADMIN    uint32 = 2 // 添加管理员
	OPERATE_KIND_MODIFY_ADMIN uint32 = 3 // 修改管理员信息

	OPERATE_KIND_WIDGET_MODIFY uint32 = 4 // 修改玩家道具数量,数量可以是负值
	OPERATE_KIND_PLAYER_MODIFY uint32 = 5 // 修改玩家信息

	OPERATE_KIND_DEL_GROUP    uint32 = 6 //  删除组
	OPERATE_KIND_ADD_GROUP    uint32 = 7 // 添加组
	OPERATE_KIND_MODIFY_GROUP uint32 = 8 // 修改组
	OPERATE_KIND_SEND_MAIL    uint32 = 9 // 发送邮件

)
View Source
const (
	USERS_INDEX string = "admins_users_index"
	USERS       string = "admins_users:"

	//USER_GROUP_INDEX string = "admins_user_group_index"
	USER_GROUP       string = "admins_user_group"
	USER_GROUP_INDEX string = "admins_user_group_index"

	USER_LOG_INDEX  string = "admins_user_log_index"
	USERS_LIST      string = "admins_users_list"
	USER_LOG        string = "admins_user_log"
	PROPS_ISSUE_LOG string = "admins_props_issue_log"
	LOGIN_SESSION   string = "admins_login_session"

	ADMIN_RECORD string = "admins_admin_record:"

	// 登陆时密码输入5次自动锁定禁止该IP登陆
	ADMIN_LOGIN_IP_LIMIT string = "admins_login_ip_limit"
)
View Source
const (
	KEY_GAIN_COIN  string = "rankgain"
	KEY_TOTAL_COIN string = "ranktotal"
	KEY_EXP        string = "rankexp"
	KEY_WIN        string = "rankwin"
	KEY_DIAMOND    string = "rankdiamond"

	KEY_LAST_GAIN_COIN  string = "ranklastgain"
	KEY_LAST_TOTAL_COIN string = "ranklasttotal"
	KEY_LAST_EXP        string = "ranklastexp"
	KEY_LAST_WIN        string = "ranklastwin"
	KEY_LAST_DIAMOND    string = "ranklastdiamond"

	KEY_PHONE_INDEX   string = "phoneindex"
	KEY_CIRCLE_NAME   string = "circlename"
	KEY_SOCIAL_ID     string = "socialid"
	KEY_ROOM_ID       string = "roomid"
	KEY_WECHAT_OPNEID string = "wechatid"

	KEY_ROOM                    string = "room"
	KEY_ROOM_CREATE_RECORD      string = "room_create_recode"       //  房间创建记录
	KEY_ROOM_USER_CREATE_RECORD string = "room_user_create_recode:" //   房间针对玩家创建记录
	KEY_TASK                    string = "task:"
	KEY_USER                    string = "user:"

	KEY_FEEDBACK string = "feedback:"

	KEY_GAME_RECORD               string = "gamerecord:"               // 金币场牌局个人记录,用于后台系统
	KEY_GAME_RECORD_QUEUE         string = "gamerecord_queue:"         // 金币场牌局个人记录列表,存储金币场牌局个人记录引用
	KEY_PRIVATE_GAME_RECORD       string = "private_gamerecord:"       // 私人局牌局个人记录,用于后台系统
	KEY_PRIVATE_GAME_RECORD_QUEUE string = "private_gamerecord_queue:" // 私人局牌局个人记录列表,存储私人局牌局个人记录引用
	KEY_MATCH_GAME_RECORD         string = "match_gamerecord:"         // 比赛场牌局个人记录,用于后台系统
	KEY_MATCH_GAME_RECORD_QUEUE   string = "match_gamerecord_queue:"   // 比赛场牌局个人记录列表,存储比赛场牌局个人记录引用

	KEY_CARD_RECORD       string = "card_record"        // 打牌记录
	KEY_CARD_RECORD_INDEX string = "card_record_index:" // 打牌记录累ID

	KEY_ACTIVITY     string = "activity:"
	KEY_NOTICE       string = "notice"
	KEY_TRADE        string = "trade"
	KEY_TRADE_INFO   string = "tradeinfo:"
	KEY_TRADE_RECORD string = "traderecord:"

	KEY_TRADE_INFO_RECORD string = "tradeinforecord:"

	KEY_GAME_RECORD_PRIVATE string = "recordprivate:"
	KEY_GAIN_IN_SOCIAL      string = "gaininsocial:"    // 玩家在某圈子的输赢
	KEY_GAIN_IN_ROOM        string = "gaininroom:"      // 玩家在某房间的输赢
	KEY_SOCIAL_TOTAL_COIN   string = "socialtotalcoin:" //   玩家在指定圈子的总输赢
	KEY_GAME_RECORD_MATCH   string = "recordmatch:"

	KEY_SIGNIN string = "signin:"

	KEY_POSTBOX      string = "postbox:"
	KEY_POSTBOX_LIST string = "postboxlist:"

	KEY_APPLY_MSG string = "applymsg:"
	KEY_AGREE_MSG string = "agreemsg:"

	KEY_LAST_USER_ID string = "lastuserid:"

	KEY_USER_ACTIVE string = "user_active:"

	KEY_CIRCLE string = "circle:"

	KEY_CIRCLE_USER     string = "circleuser:"
	KEY_USERS_IN_CIRCLE string = "usersincircle:"

	KEY_BANKRUPT string = "bankrupt:"
	KEY_ARCHIVE  string = "archive:"

	KEY_OFFLINE_REWARDS string = "offline_rewards:"

	KEY_USER_CHARGEORDER string = "user_chargeorder:"
	KEY_CPORDERID        string = "cporderid"
	KEY_CHARGEORDER      string = "chargeorder:"
	KEY_TRADINGRESULTS   string = "tradingresults:"
	KEY_TRADINGOFFLINE   string = "tradingoffline:"

	KEY_PRIVATE_RECORD  string = "private_record:"         // 私人局牌局记录roomid
	KEY_PRIVATE_RECORDS string = "private_records:"        // 私人局牌局记录
	KEY_ONLINE          string = "online"                  // 在线玩家id列表
	KEY_RESOURCE_CHANGE string = "resource_change_record:" // 资源变动记录

	KEY_ONLINE_STATISTICS      string = "online_statistics"        // 在线统计
	KEY_NEWUSER_STATISTICS     string = "newuser_statistics"       // 新增统计
	KEY_NEWUSER_STATISTICS_QUE string = "newuser_statistics_queue" // 新增统计
	KEY_ACTIVE_STATISTICS      string = "active_statistics"        // 活跃统计
)

Variables

View Source
var ADMIN = "yisen@qq.com"
View Source
var GROUPIDS = map[string]string{
	"1": "超级管理员",
	"2": "普通管理员",
}
View Source
var Version string

Functions

func AddLimitCount

func AddLimitCount(ip string, userid string)

func AddNotice

func AddNotice(ntype uint32, expire int64, title, content string)

func DelLimitIPInDb

func DelLimitIPInDb(ip string) error

func DelLimitLogin

func DelLimitLogin(ip string)

func GenerateUserid

func GenerateUserid() (string, error)

生成玩家唯一id

func GetCurrentUserID

func GetCurrentUserID(c echo.Context) string

func InitAdmin

func InitAdmin()

func LoadConf

func LoadConf(path string)

func LoadLimitIPs

func LoadLimitIPs()

Types

type Admin

type Admin struct {
	Id          string //登录账号
	Status      uint32 // '激活状态',
	Passwd      string // '密码(md5)',
	Name        string // '真实姓名',
	Description string // '描述',
	Last_visit  uint32 // '最后登录时间',
	Last_ip     uint32 // '最后登录点IP',
	Login_times uint32 // '登录次数',
	Group_id    int64  // '所属用户组ID',
	Ip_limit    string // 限制登录的IP
	Error_ip    string // '出错的ip',
	Error_time  int64  // '出错时间',
	Error_num   uint32 // '出错次数',
	Members     string // '属下成员后台登录名称',
	Platforms   string
	Create_time uint32 // 账户创建时间
}

func GetCurrentUser

func GetCurrentUser(c echo.Context) *Admin

func UserList

func UserList() ([]*Admin, error)

func (*Admin) Del

func (u *Admin) Del() error

func (*Admin) Exist

func (u *Admin) Exist() bool

检测管理员是否存在

func (*Admin) Get

func (u *Admin) Get() error

func (*Admin) Save

func (u *Admin) Save() error

type AdminRecord

type AdminRecord struct {
	Timestamp int64  //  系统时间戳
	AdminID   string // 当前操作动作管理员ID
	Kind      uint32 // 操作类型
	WindgetID uint32 // 道具类型
	Count     int    // 操作资源数量,可为负值
	Pre       string // 修改前的值
	After     string // 修改后的值
	Target    string // 目标管理员ID或者玩家ID
	Desc      string
	Param     H // 可以任意附带参数存储
}

管理员操作记录

func GetAdminRecord

func GetAdminRecord(adminID string, start int, limit int) ([]*AdminRecord, int64, error)

func (*AdminRecord) Save

func (this *AdminRecord) Save() error

type ChargeOrder

type ChargeOrder struct {
	Orderid   string // 订单号
	Userid    string // userid
	Phone     string // phone
	Transid   string // 流水号
	Waresid   uint32 // 商品编号
	Money     string // 交易金额
	Platform  uint32 // 平台
	OrderRes  uint32 // 下单结果 0成功,1失败
	Ctime     int64  // 创建时间(下单时间)
	Result    uint32 // 交易结果 0成功,1失败
	Transtime string // 交易完成时间
	Status    uint32 // 发货结果 0成功,1失败
}

交易记录

func GetChargeOrder

func GetChargeOrder(day string, offset int, limit int) ([]*ChargeOrder, int64, error)

func GetChargeOrderByUserid

func GetChargeOrderByUserid(day string, userid string, offset int, limit int) ([]*ChargeOrder, int64, error)

type Config

type Config struct {
	Db              SSDB   `json:"db"`
	Log             Scribe `json:"log"`
	Port            string `json:"port"`
	ImageDir        string `json:"imagedir"`
	ImagePort       int    `json:"imageport"`
	Pprof           int    `json:"pprof"`
	Ipay            int    `json:"ipay"`
	ServerId        uint64 `json:"serverid"`
	RobotPort       int    `json:"robotport"`
	RobotIP         string `json:"robotip"`
	Version         string `json:"version"`
	DiscardsTimeout int    `json:"discards_timeout"`
	Mode            int    `json:"mode"`
	CallServer      string `json:"callserver"` // 逻辑服务器提供给管理系统调用的URL
}
var Conf Config

type DataPostbox

type DataPostbox struct {
	Id           uint32
	Title        string
	Appendixname string
	Appendix     []*WidgetData //
	Content      string
	Sender       string
	Receiver     string
	Createtime   uint32 //
	Read         bool   //
	Expire       uint32 //
	Kind         uint32 //
	Draw         bool   //
	Status       uint32
}

func (*DataPostbox) Cleanup

func (this *DataPostbox) Cleanup() error

Cleanup cleanup all emails

func (*DataPostbox) CleanupRead

func (this *DataPostbox) CleanupRead() error

CleanupRead cleanup all readed emails

func (*DataPostbox) Delete

func (this *DataPostbox) Delete() error

Delete delete an email

func (*DataPostbox) Get

func (this *DataPostbox) Get() error

func (*DataPostbox) OpenAppendix

func (this *DataPostbox) OpenAppendix() ([]*WidgetData, error)

func (*DataPostbox) ReadAll

func (this *DataPostbox) ReadAll() ([]*DataPostbox, error)

func (*DataPostbox) ReadPost

func (this *DataPostbox) ReadPost() error

func (*DataPostbox) Save

func (this *DataPostbox) Save() error

type GameRecord

type GameRecord struct {
	Userid        string
	Zhuang        uint32 //
	Seat          uint32 //
	Paoseat       uint32 //
	Ante          uint32 //
	Ji            byte   //
	HeroJi        uint32 // 0:无,1:英雄鸡,2:责任鸡,3:责任鸡碰方
	HuCard        byte
	Handcard      []byte
	Peng          []uint32
	Kong          []uint32
	Otherids      []string
	Rtype         uint32 //
	Coin          int32  //
	Tingvalue     uint32 //
	Hutype        uint32 //
	Huvalue       uint32 //
	Create_time   uint32 //
	OutCards      []byte
	CardRecord    string
	StartHandCard []byte // 起手牌
}

金币场牌局记录,用于后台系统

func GetDestopRecord

func GetDestopRecord(userid string, createTime string) ([]*GameRecord, error)

获取同桌数据

func GetNormalRecord

func GetNormalRecord(userid string, offset, limit int) ([]*GameRecord, int64, error)

func (*GameRecord) Save

func (this *GameRecord) Save() error

type GameRecordMatch

type GameRecordMatch struct {
	Userid        string
	Zhuang        uint32 //
	Seat          uint32 //
	Paoseat       uint32 //
	Ante          uint32 //
	Ji            byte   //
	HeroJi        uint32 // 0:无,1:英雄鸡,2:责任鸡,3:责任鸡碰方
	HuCard        byte
	Handcard      []byte
	Peng          []uint32
	Kong          []uint32
	Otherids      []string
	Rtype         uint32 //
	Score         int32  //
	Tingvalue     uint32 //
	Hutype        uint32 //
	Huvalue       uint32 //
	Create_time   uint32 //
	OutCards      []byte
	CardRecord    string
	StartHandCard []byte // 起手牌
}

比赛场牌局记录,用于后台系统

func GetMatchDestopRecord

func GetMatchDestopRecord(userid string, createTime string) ([]*GameRecordMatch, error)

-----------------------------------------比赛场------------------------------------------------------------ 获取同桌数据

func GetMatchRecord

func GetMatchRecord(userid string, offset, limit int) ([]*GameRecordMatch, int64, error)

func (*GameRecordMatch) Save

func (this *GameRecordMatch) Save() error

type GameRecordPrivate

type GameRecordPrivate struct {
	Userid    string
	Zhuang    uint32 //
	Seat      uint32 //
	Paoseat   uint32 //
	Ante      uint32 //
	Ji        byte   //
	HeroJi    uint32 // 0:无,1:英雄鸡,2:责任鸡,3:责任鸡碰方
	HuCard    byte
	Handcard  []byte
	Peng      []uint32
	Kong      []uint32
	Otherids  []string
	Rtype     uint32 //
	Score     int32  //
	Tingvalue uint32 //
	Hutype    uint32 //
	Huvalue   uint32 //

	OutCards      []byte
	CardRecord    string
	StartHandCard []byte // 起手牌

	Create_userid string //  房主
	CTime         uint32 // 房间创建时间
	Invitecode    string
	Expire        uint32
	Payment       uint32 //付费方式1=AA or 0=房主支付
	Updownji      uint32 //是否有上下鸡
	Rname         string
	Round         uint32 //剩余牌局数
	RoundTotal    uint32 //总牌局数
	Create_time   uint32 //记录创建时间
}

私人局牌局记录,用于后台系统

func GetPrivateDestopRecord

func GetPrivateDestopRecord(userid string, createTime string) ([]*GameRecordPrivate, error)

-----------------------------------------私人局------------------------------------------------------------ 获取同桌数据

func GetPrivateRecord

func GetPrivateRecord(userid string, offset, limit int) ([]*GameRecordPrivate, int64, error)

func (*GameRecordPrivate) Save

func (this *GameRecordPrivate) Save() error

type Group

type Group struct {
	Id    int64
	Name  string
	Desc  string
	Power int
}

func ListGroup

func ListGroup() []*Group

func (*Group) Del

func (this *Group) Del() error

func (*Group) Get

func (this *Group) Get() error

func (*Group) Save

func (this *Group) Save() error

type H

type H map[string]interface{}

type IapppayOrder

type IapppayOrder struct {
	Appid         string `json:"appid"`         // 应用编号
	Waresid       uint32 `json:"waresid"`       // 商品编号
	Waresname     string `json:"waresname"`     // 商品名称
	Cporderid     string `json:"cporderid"`     // 商户订单号
	Price         uint32 `json:"price"`         // 支付金额
	Currency      string `json:"currency"`      // 货币类型
	Appuserid     string `json:"appuserid"`     // 用户在商户应用的唯一标识
	Cpprivateinfo string `json:"cpprivateinfo"` // 商户私有信息
	Notifyurl     string `json:"notifyurl"`     // 支付结果通知地址
}

下单请求参数

type IapppayQuery

type IapppayQuery struct {
	Appid     string `json:"appid"`     // 应用编号
	Cporderid string `json:"cporderid"` // 商户订单号
}

主动请求交易结果请求参数

type LoginLimitIP

type LoginLimitIP struct {
	IP            string
	Userids       []string
	LastLoginTime int64
	Count         uint32
}

func GetLimitCount

func GetLimitCount(ip string) *LoginLimitIP

func GetLimitIPHash

func GetLimitIPHash() []*LoginLimitIP

type NewUserCountStatistics

type NewUserCountStatistics struct {
	Unix  uint32
	Count uint32
}

func GetNewUserStatitics

func GetNewUserStatitics(timestamp string) ([]*NewUserCountStatistics, error)

type NewUserStatistics

type NewUserStatistics struct {
	Unix   uint32
	Userid string
}

func GetAllNewuser

func GetAllNewuser(timestamp string) ([]*NewUserStatistics, error)

获取当日所有新增用户数据

type Notice

type Notice struct {
	Id      int64 // time.Now().Unix()
	Type    uint32
	Title   string
	Content string
	CTime   int64
	Expire  int64
}

进入游戏弹出的公告内容,

func GetNotice

func GetNotice() []*Notice

type OnlineStatistics

type OnlineStatistics struct {
	Unix  uint32
	Count uint32
}

func GetOnlineStatitics

func GetOnlineStatitics(timestamp string) ([]*OnlineStatistics, error)

func (*OnlineStatistics) Save

func (this *OnlineStatistics) Save() error

type QueryResults

type QueryResults struct {
	Cporderid string  `json:"cporderid"` // 商户订单号
	Transid   string  `json:"transid"`   // 交易流水号
	Appuserid string  `json:"appuserid"` // 用户在商户应
	Appid     string  `json:"appid"`     // 游戏id
	Waresid   uint32  `json:"waresid"`   // 商品编码
	Feetype   int     `json:"feetype"`   // 计费方式
	Money     float32 `json:"money"`     // 交易金额
	Currency  string  `json:"currency"`  // 货币类型	RMB
	Result    int     `json:"result"`    // 交易结果	0–交易成功 1–交易失败
	Transtime string  `json:"transtime"` // 交易完成时间 yyyy-mm-dd hh24:mi:ss
	Cpprivate string  `json:"cpprivate"` // 商户私有信息
	Paytype   uint32  `json:"paytype"`   // 支付方式
}

主动请求交易结果

type SSDB

type SSDB struct {
	Ip     string `json:"ip"`
	Port   int    `json:"port"`
	Thread int    `json:"thread"`
}

type Scribe

type Scribe struct {
	Ip   string `json:"ip"`
	Port int    `json:"port"`
}

type Session

type Session struct {
	Username string
	Password string
	Expire   uint32
}

func GetCurrentSession

func GetCurrentSession(c echo.Context) *Session

type SessionList

type SessionList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var Sessions *SessionList

func (*SessionList) Add

func (this *SessionList) Add(ses *Session) string

func (*SessionList) Del

func (this *SessionList) Del(key string)

func (*SessionList) Get

func (this *SessionList) Get(key string) *Session

type TradingResults

type TradingResults struct {
	Transtype int     `json:"transtype"` // 交易类型0–支付交易;
	Cporderid string  `json:"cporderid"` // 商户订单号
	Transid   string  `json:"transid"`   // 交易流水号
	Appuserid string  `json:"appuserid"` // 用户在商户应
	Appid     string  `json:"appid"`     // 游戏id
	Waresid   uint32  `json:"waresid"`   // 商品编码
	Feetype   int     `json:"feetype"`   // 计费方式
	Money     float32 `json:"money"`     // 交易金额
	Currency  string  `json:"currency"`  // 货币类型	RMB
	Result    int     `json:"result"`    // 交易结果	0–交易成功 1–交易失败
	Transtime string  `json:"transtime"` // 交易完成时间 yyyy-mm-dd hh24:mi:ss
	Cpprivate string  `json:"cpprivate"` // 商户私有信息
	Paytype   uint32  `json:"paytype"`   // 支付方式
}

交易结果通知

func GetAllTransition

func GetAllTransition(day string) ([]*TradingResults, error)

获取当日的所有充值

func GetTransition

func GetTransition(day string, offset int, limit int) ([]*TradingResults, int64, error)

func GetTransitionByUserid

func GetTransitionByUserid(day string, userid string, offset int, limit int) ([]*TradingResults, int64, error)

type TransData

type TransData struct {
	Code   json.Number `json:"code,Number"`
	Errmsg string      `json:"errmsg"`
}

下单请求失败结果

type TransDataId

type TransDataId struct {
	Transid string `json:"transid"`
}

下单请求成功结果

type User

type User struct {
	Userid        string // 用户id
	Nickname      string // 用户昵称
	Sex           uint32 // 用户性别,男1 女2 非男非女3
	Sign          string // 用户签名
	Email         string // 绑定的邮箱地址
	Phone         string // 绑定的手机号码
	Auth          string // 密码验证码
	Pwd           string // MD5密码
	Birth         uint32 // 用户生日日期
	Create_ip     uint32 // 注册账户时的IP地址
	Create_time   uint32 // 注册时间
	Coin          uint32 // 金币
	Exp           uint32 // 经验
	Diamond       uint32 // 钻石
	Ticket        uint32 //入场券
	Exchange      uint32 //兑换券
	Terminal      string // 终端类型名字
	Status        uint32 // 正常1  锁定2  黑名单3
	Address       string //物理地址
	Photo         string //头像
	Qq_uid        string //
	Wechat_uid    string
	Microblog_uid string
	Vip           uint32 //
	VipExpire     uint32 // VIP过期时间
	Win           uint32 // 胜局数
	Lost          uint32 // 败局数
	Ping          uint32 // 平局数
	Platform      uint32 //平台 1:手机登录,2:微信登录
	ChenmiTime    uint32 // 防沉迷限制
	Chenmi        int32  // 防沉迷限制
}

func GetMultiUser

func GetMultiUser(userids []string) []*User

func (*User) ExistNickname

func (this *User) ExistNickname(nickname string) bool

func (*User) ExistPhone

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

func (*User) Get

func (this *User) Get() error

func (*User) GetByPhone

func (this *User) GetByPhone() string

func (*User) GetNickname

func (this *User) GetNickname() error

func (*User) MultiHsetSave

func (this *User) MultiHsetSave(kvs map[string]interface{}) 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) UpdateSex

func (this *User) UpdateSex() error

type WidgetData

type WidgetData struct {
	Id    uint32
	Count uint32
}

func (*WidgetData) GetCount

func (this *WidgetData) GetCount() uint32

func (*WidgetData) GetData

func (this *WidgetData) GetData() *WidgetData

func (*WidgetData) GetId

func (this *WidgetData) GetId() uint32

func (*WidgetData) SetCount

func (this *WidgetData) SetCount(value uint32)

func (*WidgetData) SetId

func (this *WidgetData) SetId(value uint32)

Jump to

Keyboard shortcuts

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