anchorReward

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//NewRewardCache have new reward.
	NewRewardCache = "new_reward:v1:%d"
	//HasRewardCache have a reward
	HasRewardCache = "has_reward:v1:%d"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao struct {
	// contains filtered or unexported fields
}

Dao dao

func New

func New(c *conf.Config) (dao *Dao)

New init mysql db

func (*Dao) AddCacheRewardConf

func (d *Dao) AddCacheRewardConf(c context.Context, id int64, val *model.AnchorRewardConf) (err error)

AddCacheRewardConf 保存奖励配置

func (*Dao) AddExpireCountCache

func (d *Dao) AddExpireCountCache(c context.Context, k string, times int64) (err error)

AddExpireCountCache .

func (*Dao) AddReward

func (d *Dao) AddReward(c context.Context, iRewardID int64, uid int64, iSource int64, iRoomid int64, iLifespan int64) (err error)

AddReward add Reward to a user.

func (*Dao) CacheRewardConf

func (d *Dao) CacheRewardConf(c context.Context, id int64) (res *model.AnchorRewardConf, err error)

CacheRewardConf 获取奖励配置

func (*Dao) CheckOrderID

func (d *Dao) CheckOrderID(c context.Context, id string) (exist int64, err error)

CheckOrderID check orderid is valid.

func (*Dao) ClearExpireCountCache

func (d *Dao) ClearExpireCountCache(c context.Context, k string) (err error)

ClearExpireCountCache .

func (*Dao) CountExpire

func (d *Dao) CountExpire(interval int64, now time.Time) (err error)

CountExpire .

func (*Dao) DelLockCache

func (d *Dao) DelLockCache(c context.Context, k string) (err error)

DelLockCache del lock cache.

func (*Dao) GetById

func (d *Dao) GetById(id int64) (reward *model.AnchorReward, err error)

GetById get reward by id.

func (*Dao) GetByUidPage

func (d *Dao) GetByUidPage(c context.Context, uid int64, page int64, pageSize int64, status []int64) (pager *model.AnchorRewardPager, list []*model.AnchorRewardObject, err error)

GetByUidPage get reward by uid and page.

func (*Dao) GetExpireCountCache

func (d *Dao) GetExpireCountCache(c context.Context, k string) (count int64, err error)

GetExpireCountCache .

func (*Dao) GetHasReward

func (d *Dao) GetHasReward(c context.Context, uid int64) (r int64, err error)

GetHasReward .

func (*Dao) GetNewReward

func (d *Dao) GetNewReward(c context.Context, uid int64) (r int64, err error)

GetNewReward set MRRecord to mc

func (*Dao) GetOrder

func (d *Dao) GetOrder(c context.Context, id string) (exists int64, err error)

GetOrder get order by id from cache.

func (*Dao) HasNewReward

func (d *Dao) HasNewReward(c context.Context, uid int64) (rst int64, err error)

HasNewReward .

func (*Dao) HasReward

func (d *Dao) HasReward(c context.Context, uid int64) (r int64, err error)

HasReward returns if a user have reward.

func (*Dao) Ping

func (d *Dao) Ping(c context.Context) (err error)

Ping dao ping

func (*Dao) RawRewardConf

func (d *Dao) RawRewardConf(c context.Context, id int64) (res *model.AnchorRewardConf, err error)

RawRewardConf return reward config from db.

func (*Dao) RewardConf

func (d *Dao) RewardConf(c context.Context, id int64) (res *model.AnchorRewardConf, err error)

RewardConf get data from cache if miss will call source method, then add to cache.

func (*Dao) SaveOrder

func (d *Dao) SaveOrder(c context.Context, id string) (err error)

SaveOrder save orderid in cache.

func (*Dao) SaveOrderID

func (d *Dao) SaveOrderID(c context.Context, id string) error

SaveOrderID save order id.

func (*Dao) SendBroadcast

func (d *Dao) SendBroadcast(uid int64, roomid int64, rewardId int64) (err error)

SendBroadcast .

func (*Dao) SendBroadcastV2

func (d *Dao) SendBroadcastV2(c context.Context, uid int64, roomid int64, rewardId int64) (err error)

SendBroadcastV2 .

func (*Dao) SetExpire

func (d *Dao) SetExpire(now time.Time) (err error)

SetExpire .

func (*Dao) SetHasReward

func (d *Dao) SetHasReward(c context.Context, uid int64, isHave int64) (err error)

SetHasReward save whether one user have reward.

func (*Dao) SetNewReward

func (d *Dao) SetNewReward(c context.Context, uid int64, hasNew int64) (err error)

SetNewReward get MRRecord from mc

func (*Dao) SetNxLock

func (d *Dao) SetNxLock(c context.Context, k string, times int64) (res bool, err error)

SetNxLock redis lock.

func (*Dao) UseReward

func (d *Dao) UseReward(id int64, usePlat string) (rst bool, err error)

UseReward use reward by id.

type HasNewReward

type HasNewReward struct {
	HasNewReward int64 `json:"has_new_reward"`
}

HasNewReward .

Jump to

Keyboard shortcuts

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