diff --git a/domain/service/group_power_s/group_power.go b/domain/service/group_power_s/group_power.go index 9e4bcd3e02b75fb731fb02b7d7460ceef4f97957..83e1783119a128f896d4cbda7437a63f7140429d 100644 --- a/domain/service/group_power_s/group_power.go +++ b/domain/service/group_power_s/group_power.go @@ -16,11 +16,11 @@ import ( "hilo-group/domain/cache/user_c" "hilo-group/domain/event/group_power_ev" "hilo-group/domain/model/groupPower_m" - "time" "hilo-group/domain/model/msg_m" "hilo-group/domain/model/noble_m" "hilo-group/domain/model/user_m" "hilo-group/myerr/bizerr" + "time" ) type GroupPowerService struct { @@ -193,11 +193,12 @@ func CalcGroupPowerMonthRankAct(model *domain.Model) error { lastDayTime := time.Now().AddDate(0, 0, -1) _now := now.New(lastDayTime) calcMonth := _now.BeginningOfMonth().Format(utils.MONTH_FORMAT) + starDate := _now.BeginningOfMonth().Format(utils.COMPACT_MONTH_FORMAT) beginDate, endDate := _now.BeginningOfMonth().Format("2006-01-02"), _now.EndOfMonth().Format("2006-01-02") - return DoCalcGroupPowerMonthRankAct(model, calcMonth, beginDate, endDate) + return DoCalcGroupPowerMonthRankAct(model, calcMonth, beginDate, endDate, starDate) } -func DoCalcGroupPowerMonthRankAct(model *domain.Model, calcMonth, beginDate, endDate string) error { +func DoCalcGroupPowerMonthRankAct(model *domain.Model, calcMonth, beginDate, endDate, starDate string) error { areaList := []int{1, 2} for _, area := range areaList { // 计算获奖 model := domain.CreateModelContext(model.MyContext) @@ -208,7 +209,7 @@ func DoCalcGroupPowerMonthRankAct(model *domain.Model, calcMonth, beginDate, end powerIds := make([]uint64, 0, len(response.Items)) for i, v := range response.Items { powerIds = append(powerIds, v.Id) - response.Items[i].StarList, err = GetGroupPowerStar(model, v.Id, groupPower_e.GroupPowerStarTypeFamous, 0, 10, time.Now().Format(utils.COMPACT_MONTH_FORMAT)) + response.Items[i].StarList, err = GetGroupPowerStar(model, v.Id, groupPower_e.GroupPowerStarTypeFamous, 0, 10, starDate) if err != nil { return err } diff --git a/test/group_power_test.go b/test/group_power_test.go index a659a3ac1c759e24e06fd702c7c957294e5e6fe0..0d84707dcd6e47e6164960724852afe443d8e953 100644 --- a/test/group_power_test.go +++ b/test/group_power_test.go @@ -38,5 +38,5 @@ func TestDoCalcGroupPowerMonthRankAct(t *testing.T) { _now := now.New(lastDayTime) calcMonth := _now.BeginningOfMonth().Format(utils.MONTH_FORMAT) beginDate, endDate := _now.BeginningOfMonth().Format("2006-01-02"), _now.EndOfMonth().Format("2006-01-02") - _ = group_power_s.DoCalcGroupPowerMonthRankAct(domain.CreateModelNil(), calcMonth, beginDate, endDate) + _ = group_power_s.DoCalcGroupPowerMonthRankAct(domain.CreateModelNil(), calcMonth, beginDate, endDate, "") }