From 5d5848dc0ac13464ea265f524f5c9dc423b02d0b Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Mon, 3 Jul 2023 16:13:56 +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 --- domain/model/invite_m/invite_apply.go | 4 ++-- route/invite_r/party_invite.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/domain/model/invite_m/invite_apply.go b/domain/model/invite_m/invite_apply.go index 2ae9124..c4ac017 100644 --- a/domain/model/invite_m/invite_apply.go +++ b/domain/model/invite_m/invite_apply.go @@ -65,9 +65,9 @@ func IsInInviteApply(model *domain.Model, userId mysql.ID) (bool, error) { } // 检查被邀请人是否存在 -func GetInviteApplyNumByType(model *domain.Model, gType int, beginTime, endTime time.Time, userId uint64) (int, error) { +func GetInviteApplyNumByType(model *domain.Model, gType int, beginTime, endTime time.Time, userIds []uint64) (int, error) { var count int64 - db := model.Db.Model(InviteApply{}).Where("user_id=?", userId).Where("created_time >= ? and created_time <= ?", beginTime, endTime) + db := model.Db.Model(InviteApply{}).Where("user_id in (?)", userIds).Where("created_time >= ? and created_time <= ?", beginTime, endTime) switch gType { // 1.已申请2.待审核3.已通过4.已拒绝 case 2: db = db.Where("`status` = ?", 0) diff --git a/route/invite_r/party_invite.go b/route/invite_r/party_invite.go index f79c4ea..b52ef7a 100644 --- a/route/invite_r/party_invite.go +++ b/route/invite_r/party_invite.go @@ -160,10 +160,18 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) { var model = domain.CreateModelContext(myCtx) + agentIds := []uint64{userId} + if promotion_m.IsPromotionManager(model, userId) { + agentIds, err = promotion_m.GetPromotionManagerAgentList(model, userId) + if err != nil { + return myCtx, err + } + } + if param.Type == 0 { // 返回所有Type类型有多少条数 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, userId) + num, err := invite_m.GetInviteApplyNumByType(model, gType, param.BeginTime, param.EndTime, agentIds) if err != nil { return myCtx, err } @@ -173,14 +181,6 @@ func InviteApplyList(c *gin.Context) (*mycontext.MyContext, error) { return myCtx, nil } - agentIds := []uint64{userId} - if promotion_m.IsPromotionManager(model, userId) { - agentIds, err = promotion_m.GetPromotionManagerAgentList(model, userId) - if err != nil { - return myCtx, err - } - } - list, total, err := invite_m.GetApplyList(model, agentIds, param.PageIndex, param.PageSize, param.Type, param.BeginTime, param.EndTime) if err != nil { model.Log.Errorf("GetApplyList param:%v, err:%v", param, err) -- 2.22.0