utils

package
v0.0.0-...-dcc0b38 Latest Latest
Warning

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

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

Documentation

Overview

*

  • Redis实现 用户分布式锁

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DistributionGiftPool

func DistributionGiftPool() int

把所有奖品填充奖品池

func GetCacheCodeNum

func GetCacheCodeNum(giftId int, codeService services.CodeService) (int, int)

func GetGiftPoolNum

func GetGiftPoolNum(id int) int

从Redis奖品池获取id奖品数量

func ImportCacheCodes

func ImportCacheCodes(giftId int, code string) bool

导入优惠券编码到Redis缓存

func IncrIpLuckyNum

func IncrIpLuckyNum(strIp string) int64

今天的IP抽奖次数递增,返回递增后的数值

func IncrUserLuckyNum

func IncrUserLuckyNum(uid int) int64

func InitUserLuckyNum

func InitUserLuckyNum(uid int, num int64)

func LockLucky

func LockLucky(uid int) bool

加锁 避免一个用户重复连续点击抽奖按钮,个人并发多次抽奖重入

func PrizeCodeDiff

func PrizeCodeDiff(giftId int, codeService services.CodeService) string

func PrizeCodeDiffDeprecated

func PrizeCodeDiffDeprecated(giftId int, codeService services.CodeService) string

TODO : NOTICE 优惠券发放MySQL版本,废弃 func PrizeCodeDiff_MySQL(giftId int, codeService services.CodeService) string {

func PrizeGift

func PrizeGift(id, leftNum int) bool

发奖 指定的奖品是否还可以发出来奖品

func RecacheCodes

func RecacheCodes(giftId int, codeService services.CodeService) (succNum, failNum int)

重新整理优惠券编码到缓存

func ResetGiftPrizeData

func ResetGiftPrizeData(giftInfo *models.LtGift, giftService services.GiftService)

奖品的发奖计划

func UnlockLucky

func UnlockLucky(uid int) bool

解锁 用户调用抽奖接口完成及时释放锁,避免死锁

Types

This section is empty.

Jump to

Keyboard shortcuts

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