Coins

package
v0.0.0-...-1562072 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package Coins

Index

Constants

This section is empty.

Variables

View Source
var (
	LevelArray = [...]int{0, 1, 2, 5, 10, 20, 35, 55, 75, 100, 120, 180, 260, 360, 480, 600}
)

Functions

func ChangeProtectStatus

func ChangeProtectStatus(sdb *Scoredb, uid int64, statusID int64) (err error)

func CheckUserCoins

func CheckUserCoins(coins int) bool

func GetHourWord

func GetHourWord(t time.Time) (reply string)

func GetLevel

func GetLevel(count int) int

func InsertOrUpdateScoreByUID

func InsertOrUpdateScoreByUID(sdb *Scoredb, uid int64, score int) (err error)

InsertOrUpdateScoreByUID 插入或更新打卡累计 初始化更新临时保存

func InsertOrUpdateSignInCountByUID

func InsertOrUpdateSignInCountByUID(sdb *Scoredb, uid int64, count int) (err error)

InsertOrUpdateSignInCountByUID 插入或更新签到次数

func InsertUserCoins

func InsertUserCoins(sdb *Scoredb, uid int64, coins int) (err error)

func UpdateUserSignInValue

func UpdateUserSignInValue(sdb *Scoredb, uid int64) (err error)

func UpdateUserTime

func UpdateUserTime(sdb *Scoredb, counttime int, times string) (err error)

func UpdateWagerUserStatus

func UpdateWagerUserStatus(sdb *Scoredb, uid int64, time int64, coins int64) (err error)

UpdateWagerUserStatus update WagerUserStatus

func WagerCoinsInsert

func WagerCoinsInsert(sdb *Scoredb, modifyCoins int, winner int, expected int) (err error)

Types

type Globaltable

type Globaltable struct {
	Counttime int `gorm:"column:counttime;default:0"`
	Times     string
}

Globaltable 总体结构体

func GetCurrentCount

func GetCurrentCount(sdb *Scoredb, times string) (si Globaltable)

GetCurrentCount 取得现在的人数

func (Globaltable) TableName

func (Globaltable) TableName() string

TableName ...

type ProtectModeIndex

type ProtectModeIndex struct {
	UID    int64 `gorm:"column:uid;primary_key"`
	Time   int64 `gorm:"column:time;default:0"`
	Status int64 `gorm:"column:status;default:0"` // 1 mean enabled || else none.
}

ProtectModeIndex Protect User From taking part in games, user can only change their mode in 24h.

func GetProtectModeStatus

func GetProtectModeStatus(sdb *Scoredb, uid int64) (s ProtectModeIndex)

GetProtectModeStatus Get Status

func (ProtectModeIndex) TableName

func (ProtectModeIndex) TableName() string

type Scoredb

type Scoredb gorm.DB

Scoredb 分数数据库

func Initialize

func Initialize(dbpath string) *Scoredb

Initialize 初始化ScoreDB数据库

type Scoretable

type Scoretable struct {
	UID   int64 `gorm:"column:uid;primary_key"`
	Score int   `gorm:"column:score;default:0"`
}

Scoretable 分数结构体

func GetScoreByUID

func GetScoreByUID(sdb *Scoredb, uid int64) (s Scoretable)

GetScoreByUID 取得分数

func (Scoretable) TableName

func (Scoretable) TableName() string

TableName ...

type Signintable

type Signintable struct {
	UID         int64 `gorm:"column:uid;primary_key"`
	Count       int   `gorm:"column:count;default:0"`
	Coins       int   `gorm:"column:coins;default:0"`
	SignUpdated int64 `gorm:"column:sign;default:0"` // fix : score shown error.
	UpdatedAt   time.Time
}

Signintable 签到结构体

func GetSignInByUID

func GetSignInByUID(sdb *Scoredb, uid int64) (si Signintable)

GetSignInByUID 取得签到次数

func GetUserIsSignInToday

func GetUserIsSignInToday(sdb *Scoredb, uid int64) (getStat bool, si Signintable)

GetUserIsSignInToday Check user is signin today.

func (Signintable) TableName

func (Signintable) TableName() string

TableName ...

type WagerTable

type WagerTable struct {
	Wagercount int `gorm:"column:wagercount;default:0"`
	Expected   int `gorm:"column:expected;default:0"`
	Winner     int `gorm:"column:winner;default:0"`
}

WagerTable wager Table Struct

func GetWagerStatus

func GetWagerStatus(sdb *Scoredb) (si WagerTable)

GetWagerStatus Get Status (total)

func (WagerTable) TableName

func (WagerTable) TableName() string

type WagerUserInputTable

type WagerUserInputTable struct {
	UID                    int64 `gorm:"column:uid;primary_key"`
	InputCountNumber       int64 `gorm:"column:coin;default:0"`
	UserExistedStoppedTime int64 `gorm:"column:time;default:0"`
}

WagerUserInputTable Get Wager Table User Input In Times

func GetWagerUserStatus

func GetWagerUserStatus(sdb *Scoredb, uid int64) (si WagerUserInputTable)

GetWagerUserStatus Get Status

func (WagerUserInputTable) TableName

func (WagerUserInputTable) TableName() string

Jump to

Keyboard shortcuts

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