123456789101112131415161718192021222324252627 |
- package utils
- import (
- "fmt"
- "math/rand"
- "time"
- )
- var GetUuid = getUuid{}
- type getUuid struct {
- }
- func (*getUuid) GetTalentId() string {
- now := time.Now()
- nowStr := time.Time.String(now)
- str1 := nowStr[11:13] + nowStr[14:16]
- str2 := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000))
- tid := "2" + str1 + str2
- return tid
- }
- func (*getUuid) GetTaskId(ProjectId string, EnterpriseId string, TalentId string) string {
- str1 := ProjectId[len(ProjectId)-2:] + EnterpriseId[len(EnterpriseId)-1:] + TalentId[len(TalentId)-2:]
- str2 := fmt.Sprintf("%05v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(100000))
- tid := str1 + str2
- return tid
- }
|