Browse Source

#1249

Optimized the generation of serial numbers
tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
6b5eed268b
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      services/reward/serial.go

+ 1
- 1
services/reward/serial.go View File

@@ -21,7 +21,7 @@ func GetSerialNoByRedis() (string, error) {
redis_client.Expire(redis_key.RewardSerialCounter(now), 2*time.Minute)
}
//when the counter n exceeds 1000, the length of the serial number will become longer
if n > 1000 {
if n >= 1000 {
return now.Format("200601021504") + fmt.Sprintf("%d", n) + fmt.Sprint(rand.Intn(10)), nil
}
return now.Format("200601021504") + fmt.Sprintf("%03d", n) + fmt.Sprint(rand.Intn(10)), nil


Loading…
Cancel
Save