|
@@ -15,6 +15,7 @@ import (
|
15
|
15
|
"spaceofcheng/services/service/events"
|
16
|
16
|
"spaceofcheng/services/utils"
|
17
|
17
|
"strconv"
|
|
18
|
+ "strings"
|
18
|
19
|
"time"
|
19
|
20
|
)
|
20
|
21
|
|
|
@@ -202,6 +203,12 @@ func (s *CustomerServ) GenerateCustomerBarcode() string {
|
202
|
203
|
}
|
203
|
204
|
temp4 := strconv.Itoa(rand.Intn(9))
|
204
|
205
|
temp5, _ := models.GetSeqID(temp2)
|
|
206
|
+ minus := 4 - len(temp5)
|
|
207
|
+ if minus < 0 {
|
|
208
|
+ minus = 0
|
|
209
|
+ temp5 = temp5[0:4]
|
|
210
|
+ }
|
|
211
|
+ temp5 = strings.Repeat("0", minus) + temp5
|
205
|
212
|
code := temp1 + temp2 + temp3 + temp4 + temp5
|
206
|
213
|
return code
|
207
|
214
|
}
|