From 2af6df67baaffd69cc4e1ac0c1f6acf03de2d5d4 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Mon, 3 Jul 2023 17:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E5=AF=B9=E9=82=80=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv/invite_cv/invite_apply.go | 1 + myerr/bizerr/bizCode.go | 2 ++ route/invite_r/party_invite.go | 11 ++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cv/invite_cv/invite_apply.go b/cv/invite_cv/invite_apply.go index 4e37bd1..f658e1e 100644 --- a/cv/invite_cv/invite_apply.go +++ b/cv/invite_cv/invite_apply.go @@ -13,6 +13,7 @@ type CvUserLevel struct { type InviteApplyRes struct { List []*InviteApply `json:"list"` NumList []*InviteApplyNumRes `json:"numList"` + MyCode string `json:"myCode"` } type InviteApply struct { diff --git a/myerr/bizerr/bizCode.go b/myerr/bizerr/bizCode.go index b418077..d5a056d 100755 --- a/myerr/bizerr/bizCode.go +++ b/myerr/bizerr/bizCode.go @@ -31,4 +31,6 @@ var ( CpHaveCancelNoDeal = myerr.NewBusinessCode(50121, "You have a cancel apply", myerr.BusinessData{}) // 有接触申请需要处理 InviteApplyNoPermission = myerr.NewBusinessCode(50122, "This user does not have invitation permission", myerr.BusinessData{}) // 该用户没有邀请权限 InviteApplyAlreadyInvited = myerr.NewBusinessCode(50123, "Already invited by someone else", myerr.BusinessData{}) // 已经被别人邀请了 + InviteApplyCodeInvalid = myerr.NewBusinessCode(50124, "user id invalid", myerr.BusinessData{}) // 邀请人用户id错误 + InviteApplyNewCodeInvalid = myerr.NewBusinessCode(50125, "user id invalid", myerr.BusinessData{}) // 被邀请人用户id错误 ) diff --git a/route/invite_r/party_invite.go b/route/invite_r/party_invite.go index b52ef7a..2475789 100644 --- a/route/invite_r/party_invite.go +++ b/route/invite_r/party_invite.go @@ -65,12 +65,12 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { newUser, err := user_m.GetUserByCode(model, param.NewUserCode) if err != nil { model.Log.Errorf("InviteApply param:%v", param) - return myCtx, err + return myCtx, bizerr.InviteApplyNewCodeInvalid } user, err := user_m.GetUserByCode(model, param.UserCode) if err != nil { model.Log.Errorf("InviteApply param:%v", param) - return myCtx, err + return myCtx, bizerr.InviteApplyCodeInvalid } if newUser.ID == 0 || user.ID == 0 { model.Log.Errorf("InviteApply param:%v", param) @@ -169,6 +169,11 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) { } if param.Type == 0 { // 返回所有Type类型有多少条数 + user, err := user_c.GetUserTinyById(model, userId) + if err != nil { + model.Log.Errorf("GetApplyList param:%v, err:%v", param, err) + return myCtx, bizerr.InvalidParameter + } numList := make([]*invite_cv.InviteApplyNumRes, 0, 4) for _, gType := range []int{1, 2, 3, 4} { // 1.已申请2.待审核3.已通过4.已拒绝 num, err := invite_m.GetInviteApplyNumByType(model, gType, param.BeginTime, param.EndTime, agentIds) @@ -177,7 +182,7 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) { } numList = append(numList, &invite_cv.InviteApplyNumRes{Type: gType, Num: num}) } - resp.ResponsePageOk(c, &invite_cv.InviteApplyRes{NumList: numList}, 0, 0, 0) + resp.ResponsePageOk(c, &invite_cv.InviteApplyRes{NumList: numList, MyCode: user.Code}, 0, 0, 0) return myCtx, nil } -- 2.22.0