|
|
@ -2,6 +2,7 @@ package upgrade
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"math/rand"
|
|
|
|
"recook/internal/define"
|
|
|
|
"recook/internal/define"
|
|
|
|
"recook/internal/libs/bean"
|
|
|
|
"recook/internal/libs/bean"
|
|
|
|
"recook/internal/service/baseCode"
|
|
|
|
"recook/internal/service/baseCode"
|
|
|
@ -83,6 +84,7 @@ func (o logic) Sure(args ApplySure) error {
|
|
|
|
if err := mysql.Db.Transaction(func(tx *gorm.DB) error {
|
|
|
|
if err := mysql.Db.Transaction(func(tx *gorm.DB) error {
|
|
|
|
|
|
|
|
|
|
|
|
sql := `select max(id)+floor(1+rand()*5) from recook_user_info`
|
|
|
|
sql := `select max(id)+floor(1+rand()*5) from recook_user_info`
|
|
|
|
|
|
|
|
rd := fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
|
|
|
|
var lastId int64
|
|
|
|
var lastId int64
|
|
|
|
if err := tx.Raw(sql).Count(&lastId).Error; err != nil {
|
|
|
|
if err := tx.Raw(sql).Count(&lastId).Error; err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
@ -94,7 +96,7 @@ func (o logic) Sure(args ApplySure) error {
|
|
|
|
Birthday: formatime.NewSecondFrom(define.DefaultBirthday),
|
|
|
|
Birthday: formatime.NewSecondFrom(define.DefaultBirthday),
|
|
|
|
HeadImgUrl: "",
|
|
|
|
HeadImgUrl: "",
|
|
|
|
Phone: mobile,
|
|
|
|
Phone: mobile,
|
|
|
|
Identifier: time.Now().Format("060102") + baseCode.Encode(uint64(lastId)),
|
|
|
|
Identifier: time.Now().Format("060102") + rd,
|
|
|
|
Level: 2,
|
|
|
|
Level: 2,
|
|
|
|
ParentID: 0,
|
|
|
|
ParentID: 0,
|
|
|
|
RootID: ae.ParentID,
|
|
|
|
RootID: ae.ParentID,
|
|
|
|