Documentation ¶
Index ¶
- Constants
- Variables
- func GetTid(serviceType model.ServiceType, v interface{}) string
- type Dao
- func (d *Dao) AddGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) AddIapGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) AddSilver(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) BeginTx(c context.Context) (conn *sql.Tx, err error)
- func (d *Dao) CacheVersion(c context.Context) int32
- func (d *Dao) ChangeCostBase(c context.Context, uid int64, num int64) (affect int64, err error)
- func (d *Dao) Close()
- func (d *Dao) ConsumeCoin(c context.Context, coinNum int, uid int64, coinTypeNo int32, seeds int64, ...) (success bool, err error)
- func (d *Dao) ConsumeGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) ConsumeIapGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) ConsumeSilver(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) DelWalletCache(c context.Context, uid int64) (err error)
- func (d *Dao) Detail(c context.Context, uid int64) (detail *model.Detail, err error)
- func (d *Dao) DetailWithoutDefault(c context.Context, uid int64) (detail *model.Detail, err error)
- func (d *Dao) DoTx(c context.Context, doFunc func(conn *sql.Tx) (v interface{}, err error)) (v interface{}, err error)
- func (d *Dao) ExchangeCoinInTx(conn *sql.Tx, uid int64, srcSysCoinTypeNo int32, srcNum int64, ...) (affect int64, err error)
- func (d *Dao) ForceUnLock(ctx context.Context, key string) (err error)
- func (d *Dao) GetCoin(c context.Context, coinTypeNo int32, uid int64) (interface{}, error)
- func (d *Dao) GetCoinStreamByTid(c context.Context, tid string) (record *model.CoinStreamRecord, err error)
- func (d *Dao) GetCoinStreamByTidAndOffset(c context.Context, tid string, offset int) (record *model.CoinStreamRecord, err error)
- func (d *Dao) GetCoinStreamByUidTid(c context.Context, uid int64, tid string) (record *model.CoinStreamRecord, err error)
- func (d *Dao) GetDetailByCache(c context.Context, uid int64) (wallet *model.Detail, err error)
- func (d *Dao) GetMelonseedByCache(c context.Context, uid int64) (wallet *model.Melonseed, err error)
- func (d *Dao) GetMetal(c context.Context, uid int64) (metal float64, err error)
- func (d *Dao) InitWallet(c context.Context, uid int64, gold int64, iap_gold int64, silver int64) (row int64, err error)
- func (d *Dao) InitWalletInTx(conn *sql.Tx, uid int64, gold int64, iap_gold int64, silver int64) (row int64, err error)
- func (d *Dao) IsLockFailedError(err error) bool
- func (d *Dao) IsNewVersion(c context.Context, detail *model.McDetail) bool
- func (d *Dao) Lock(ctx context.Context, key string, ttl int, retry int, retryDelay int) (err error, gotLock bool, lockValue string)
- func (d *Dao) LockTransactionId(ctx context.Context, tid string) (err error)
- func (d *Dao) LockUser(ctx context.Context, uid int64) (err error, gotLock bool, lockValue string)
- func (d *Dao) Melonseed(c context.Context, uid int64) (wallet *model.Melonseed, err error)
- func (d *Dao) ModifyCntInTx(conn *sql.Tx, uid int64, goldPay int, goldRecharge int, silverPay int) (int64, error)
- func (d *Dao) ModifyCoin(c context.Context, coinNum int, uid int64, coinTypeNo int32, delCache bool) (bool, error)
- func (d *Dao) ModifyCoinInTx(conn *sql.Tx, uid int64, sysCoinTypeNo int32, num int64, ...) (affect int64, err error)
- func (d *Dao) ModifyMetal(c context.Context, uid int64, coins int64, seeds int64, reason interface{}) (success bool, code int, err error)
- func (d *Dao) NewCoinExchangeRecord(c context.Context, record *model.CoinExchangeRecord) (int64, error)
- func (d *Dao) NewCoinExchangeRecordInTx(conn *sql.Tx, record *model.CoinExchangeRecord) (int64, error)
- func (d *Dao) NewCoinStreamRecord(c context.Context, record *model.CoinStreamRecord) (int64, error)
- func (d *Dao) NewCoinStreamRecordInTx(conn *sql.Tx, record *model.CoinStreamRecord) (int64, error)
- func (d *Dao) PayCoinInTx(conn *sql.Tx, uid int64, sysCoinTypeNo int32, num int64, ...) (affect int64, err error)
- func (d *Dao) Ping(c context.Context) (err error)
- func (d *Dao) PingRedis(c context.Context) (err error)
- func (d *Dao) Pub(c context.Context, uid int64, msg interface{}) error
- func (d *Dao) RechargeCoin(c context.Context, coinNum int, uid int64, coinTypeNo int32, delCache bool) (bool, error)
- func (d *Dao) RechargeCoinInTx(conn *sql.Tx, uid int64, sysCoinTypeNo int32, num int64, ...) (affect int64, err error)
- func (d *Dao) RechargeGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) RechargeIapGold(c context.Context, uid int64, num int) (affect int64, err error)
- func (d *Dao) SetWalletCache(c context.Context, detail *model.McDetail, expire int32) (err error)
- func (d *Dao) UnLock(ctx context.Context, key string, lockValue string) (err error)
- func (d *Dao) UnLockUser(ctx context.Context, uid int64, lockValue string) error
- func (d *Dao) UpdateSnapShotTime(context context.Context, uid int64, time string) (int64, error)
- func (d *Dao) WalletCache(c context.Context, uid int64) (detail *model.McDetail, err error)
- func (d *Dao) WalletForUpdate(conn *sql.Tx, uid int64) (wallet *model.DetailWithSnapShot, err error)
Constants ¶
View Source
const ( ModifyUrl = "http://api.bilibili.co/x/internal/v1/coin/user/modify" InfoUrl = "http://api.bilibili.co/x/internal/v1/coin/user/count" ExchangeSilverReason = "兑换直播银瓜子 %d" ExchangeMetalReason = "银瓜子兑换硬币" )
Variables ¶
View Source
var ( UnLockGetWrong = "UnLockGetWrong" LockFailed = "LockFailed" UserWalletPrefix = "user_wallet_lock_uid_" ErrUnLockGet = errors.New(UnLockGetWrong) ErrLockFailed = errors.New(LockFailed) )
Functions ¶
func GetTid ¶
func GetTid(serviceType model.ServiceType, v interface{}) string
Types ¶
type Dao ¶
type Dao struct {
// contains filtered or unexported fields
}
func (*Dao) AddIapGold ¶
RechargeGold 添加IOS金瓜子
func (*Dao) ChangeCostBase ¶
func (*Dao) ConsumeCoin ¶
func (*Dao) ConsumeGold ¶
AddSilver 消费金瓜子 记入消费总值
func (*Dao) ConsumeIapGold ¶
AddSilver 消费IOS金瓜子 记入消费总值
func (*Dao) ConsumeSilver ¶
ConsumeSilver 消费银瓜子 记入消费总值
func (*Dao) DelWalletCache ¶
DelWalletCache 删除等级缓存
func (*Dao) DetailWithoutDefault ¶
func (*Dao) ExchangeCoinInTx ¶
func (*Dao) GetCoinStreamByTid ¶
func (*Dao) GetCoinStreamByTidAndOffset ¶
func (*Dao) GetCoinStreamByUidTid ¶
func (*Dao) GetDetailByCache ¶
func (*Dao) GetMelonseedByCache ¶
func (d *Dao) GetMelonseedByCache(c context.Context, uid int64) (wallet *model.Melonseed, err error)
Melonseed 获取瓜子数
func (*Dao) InitWallet ¶
func (d *Dao) InitWallet(c context.Context, uid int64, gold int64, iap_gold int64, silver int64) (row int64, err error)
InitExp 初始化用户钱包,用于首次查询
func (*Dao) InitWalletInTx ¶
func (d *Dao) InitWalletInTx(conn *sql.Tx, uid int64, gold int64, iap_gold int64, silver int64) (row int64, err error)
InitExp 初始化用户钱包,用于首次查询
func (*Dao) IsLockFailedError ¶
func (*Dao) IsNewVersion ¶
func (*Dao) Lock ¶
func (d *Dao) Lock(ctx context.Context, key string, ttl int, retry int, retryDelay int) (err error, gotLock bool, lockValue string)
ttl ms retry 重试次数 retryDelay us
func (*Dao) LockTransactionId ¶
func (*Dao) ModifyCntInTx ¶
func (*Dao) ModifyCoin ¶
func (*Dao) ModifyCoinInTx ¶
func (*Dao) ModifyMetal ¶
func (*Dao) NewCoinExchangeRecord ¶
func (*Dao) NewCoinExchangeRecordInTx ¶
func (*Dao) NewCoinStreamRecord ¶
func (*Dao) NewCoinStreamRecordInTx ¶
func (*Dao) PayCoinInTx ¶
func (*Dao) RechargeCoin ¶
func (*Dao) RechargeCoinInTx ¶
func (d *Dao) RechargeCoinInTx(conn *sql.Tx, uid int64, sysCoinTypeNo int32, num int64, originWallet *model.DetailWithSnapShot) (affect int64, err error)
RechargeGold 充值IOS金瓜子 记入充值总值
func (*Dao) RechargeGold ¶
RechargeGold 充值金瓜子 记入充值总值
func (*Dao) RechargeIapGold ¶
RechargeGold 充值IOS金瓜子 记入充值总值
func (*Dao) SetWalletCache ¶
SetWalletCache 设置钱包缓存
func (*Dao) UnLockUser ¶
func (*Dao) UpdateSnapShotTime ¶
更新镜像时间 方便测试
func (*Dao) WalletCache ¶
WalletCache 获取钱包缓存
func (*Dao) WalletForUpdate ¶
func (d *Dao) WalletForUpdate(conn *sql.Tx, uid int64) (wallet *model.DetailWithSnapShot, err error)
为了后续的更新获取数据
Click to show internal directories.
Click to hide internal directories.