|
@@ -492,7 +492,10 @@ func NewHotEnt(isWinner bool, number int) (data []map[string]interface{}) {
|
|
|
}
|
|
|
|
|
|
// 中标喜报
|
|
|
-func WinnerGladTidings() (entBidArr []map[string]interface{}) {
|
|
|
+func WinnerGladTidings(number int) (entBidArr []map[string]interface{}) {
|
|
|
+ seed := time.Now().UnixNano()
|
|
|
+ rand.Seed(seed)
|
|
|
+
|
|
|
redisKey := "winnerGladTidings"
|
|
|
data, _ := redis.Get(RedisNameNew, redisKey).([]interface{})
|
|
|
if len(data) > 0 {
|
|
@@ -534,7 +537,11 @@ WHERE
|
|
|
}
|
|
|
wait.Wait()
|
|
|
if len(entBidArr) > 0 {
|
|
|
- redis.Put(RedisNameNew, redisKey, entBidArr, 24*3600*7)
|
|
|
+ if len(entBidArr) > number {
|
|
|
+ randomNumber := rand.Intn(len(entBidArr) - number)
|
|
|
+ entBidArr = entBidArr[randomNumber : randomNumber+number]
|
|
|
+ }
|
|
|
+ redis.Put(RedisNameNew, redisKey, entBidArr, 24*3600)
|
|
|
}
|
|
|
}
|
|
|
return entBidArr
|