Browse Source

验证码

master
huangjiajun 5 days ago
parent
commit
f721f6e65e
1 changed files with 15 additions and 17 deletions
  1. +15
    -17
      app/hdl/hdl_login.go

+ 15
- 17
app/hdl/hdl_login.go View File

@@ -441,23 +441,6 @@ func commReq(c *gin.Context, req md.RegisterReq) {
e.OutErr(c, e.ERR_SUP_NOTFOUND, "上级用户不存在!")
return
}

initLV := 1
ur := new(model.UserRelate)
ur.ParentUid = parentUser.Id
ur.Uid = user.Id
ur.Level = initLV
ur.InviteTime = time.Now().Format("2006-01-02 15:04:05")

userRelateDb := implement.NewUserRelateDb(db.Db)
_, err = userRelateDb.UserRelateInsert(ur)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}

// 插入多级关联
go svc.RoutineMultiRelate(ur.ParentUid, ur.Uid, initLV)
}
var parentUid = func() int64 {
if parentUser != nil {
@@ -514,6 +497,21 @@ func commReq(c *gin.Context, req md.RegisterReq) {
return
}
if parentUid > 0 {
initLV := 1
ur := new(model.UserRelate)
ur.ParentUid = parentUid
ur.Uid = user.Id
ur.Level = initLV
ur.InviteTime = time.Now().Format("2006-01-02 15:04:05")

userRelateDb := implement.NewUserRelateDb(db.Db)
_, err = userRelateDb.UserRelateInsert(ur)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
// 插入多级关联
go svc.RoutineMultiRelate(ur.ParentUid, ur.Uid, initLV)
//TODO::推入mq异步处理
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {


Loading…
Cancel
Save