胡轶钦 6 年之前
父節點
當前提交
176cd2b61a
共有 1 個檔案被更改,包括 7 行新增0 行删除
  1. 7
    0
      service/customer/customer.go

+ 7
- 0
service/customer/customer.go 查看文件

15
 	"spaceofcheng/services/service/events"
15
 	"spaceofcheng/services/service/events"
16
 	"spaceofcheng/services/utils"
16
 	"spaceofcheng/services/utils"
17
 	"strconv"
17
 	"strconv"
18
+	"strings"
18
 	"time"
19
 	"time"
19
 )
20
 )
20
 
21
 
202
 	}
203
 	}
203
 	temp4 := strconv.Itoa(rand.Intn(9))
204
 	temp4 := strconv.Itoa(rand.Intn(9))
204
 	temp5, _ := models.GetSeqID(temp2)
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
 	code := temp1 + temp2 + temp3 + temp4 + temp5
212
 	code := temp1 + temp2 + temp3 + temp4 + temp5
206
 	return code
213
 	return code
207
 }
214
 }