diff --git a/route/group_power_r/group_rank.go b/route/group_power_r/group_rank.go index e5bf02b5b5d083d192fcb9dab9b1e162eb3b2727..d431b3e8bf918f4c090e01ae7ea477610c167143 100644 --- a/route/group_power_r/group_rank.go +++ b/route/group_power_r/group_rank.go @@ -67,11 +67,31 @@ func GroupPowerMonthRankAct(c *gin.Context) (*mycontext.MyContext, error) { } var model = domain.CreateModelContext(myContext) // 国家区域 - _, area, err := user_m.GetUserCountryArea(model, userId) + var area int + // 我的家族 + myGroupPower, err := groupPower_m.GetGroupPowerUserOrNil(model, userId) if err != nil { - model.Log.Errorf("GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v", userId, err) return myContext, err } + if myGroupPower != nil && myGroupPower.GroupPowerId > 0 { + //获取势力主 + mgrUserId, err := groupPower_m.GetGroupPowerMgr(model, myGroupPower.GroupPowerId) + if err != nil { + return myContext, err + } + _, area, err = user_m.GetUserCountryArea(model, mgrUserId) + if err != nil { + model.Log.Errorf("GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v", userId, err) + return myContext, err + } + } + if area == 0 { + _, area, err = user_m.GetUserCountryArea(model, userId) + if err != nil { + model.Log.Errorf("GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v", userId, err) + return myContext, err + } + } // 这个月 beginDate, endDate := now.BeginningOfMonth().Format(utils.DATE_FORMAT), now.EndOfMonth().Format(utils.DATE_FORMAT) response, err := GroupPowerMonthRankActByMonth(model, userId, beginDate, endDate, time.Now().Format(utils.COMPACT_MONTH_FORMAT), area)