From f721f6e65ee6d6a1b48d13da9f4690f069558960 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 17 Dec 2024 19:08:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_login.go | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/app/hdl/hdl_login.go b/app/hdl/hdl_login.go index 7f50256..6356b11 100644 --- a/app/hdl/hdl_login.go +++ b/app/hdl/hdl_login.go @@ -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 {