|
@@ -2,7 +2,9 @@ package service
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "fmt"
|
|
|
"math/rand"
|
|
|
+ "strconv"
|
|
|
"time"
|
|
|
"youngee_b_api/db"
|
|
|
"youngee_b_api/model/gorm_model"
|
|
@@ -35,15 +37,16 @@ func (*enterprise) CreateEnterpriseUser(ctx context.Context, newEnterprise http_
|
|
|
return nil, err
|
|
|
} else {
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
- th := conv.MustString(time.Now().Hour())
|
|
|
- tm := conv.MustString(time.Now().Minute())
|
|
|
+ th := strconv.Itoa(time.Now().Hour())
|
|
|
+ tm := strconv.Itoa(time.Now().Minute())
|
|
|
if len(tm) < 2 {
|
|
|
tm = "0" + tm
|
|
|
}
|
|
|
if len(th) < 2 {
|
|
|
th = "0" + th
|
|
|
}
|
|
|
- ShowEnterpriseID := "1" + th + tm + conv.MustString(rand.Intn(10000-1000)+1000)
|
|
|
+ //ShowEnterpriseID := "1" + th + tm + conv.MustString(rand.Intn(10000-1000)+1000
|
|
|
+ ShowEnterpriseID := "1" + th + tm + fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000))
|
|
|
enterprise := &gorm_model.Enterprise{
|
|
|
EnterpriseID: ShowEnterpriseID,
|
|
|
Industry: newEnterprise.Industry,
|