|
@ -50,7 +50,7 @@ const ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func GenRedPack(amount, num int) []int { |
|
|
func GenRedPack(amount, num int) []int { |
|
|
r := rand.New(rand.NewSource(time.Now().UnixNano())) |
|
|
|
|
|
|
|
|
r := rand.New(rand.NewSource(time.Now().Unix())) |
|
|
sumMoney := 0 |
|
|
sumMoney := 0 |
|
|
redPacks := make([]int, 0) |
|
|
redPacks := make([]int, 0) |
|
|
for i := 0; i < num; i++ { |
|
|
for i := 0; i < num; i++ { |
|
@ -82,7 +82,7 @@ func GenRedPack(amount, num int) []int { |
|
|
func GenRedEnvelope(aid int64, name string, rid int64, rule *models.ShakeRedEnvelopeRule) error { |
|
|
func GenRedEnvelope(aid int64, name string, rid int64, rule *models.ShakeRedEnvelopeRule) error { |
|
|
// 判断红包是否存在
|
|
|
// 判断红包是否存在
|
|
|
// 根据算法提前生成红包
|
|
|
// 根据算法提前生成红包
|
|
|
r := rand.New(rand.NewSource(time.Now().UnixNano())) |
|
|
|
|
|
|
|
|
r := rand.New(rand.NewSource(time.Now().Unix())) |
|
|
if rule.Model == define.SHAKERB_RULE_RANDOM { // 随机红包
|
|
|
if rule.Model == define.SHAKERB_RULE_RANDOM { // 随机红包
|
|
|
// 检测红包是否存在
|
|
|
// 检测红包是否存在
|
|
|
randSum := int(rule.RandSum * 100) |
|
|
randSum := int(rule.RandSum * 100) |
|
|