diff --git a/models/user_analysis_for_activity.go b/models/user_analysis_for_activity.go index 39f8c545d..6d8201e69 100644 --- a/models/user_analysis_for_activity.go +++ b/models/user_analysis_for_activity.go @@ -470,6 +470,8 @@ func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear { bonusInfo := make(map[string]int) bonusInfo["order"] = record[0] bonusInfo["money"] = record[1] + bonusInfo["week"] = record[2] + bonusInfo["num"] = record[3] bonusInfoJson, _ := json.Marshal(bonusInfo) reList[0].WeekBonusData = string(bonusInfoJson) } diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 9f81f1c27..c18e1f51a 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -900,20 +900,27 @@ func getBonusWeekDataMap() map[int64][]int { userId := getInt64Value(aLine[0]) order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) + week, num := getWeekAndNum(filenames[i]) //email := lines[2] record, ok := bonusMap[userId] if !ok { - record = make([]int, 2) + record = make([]int, 4) record[0] = order record[1] = money + record[2] = week + record[3] = num bonusMap[userId] = record } else { if record[0] > order { record[0] = order record[1] = money + record[2] = week + record[3] = num } else { if record[0] == order && record[1] < money { record[1] = money + record[2] = week + record[3] = num } } } @@ -924,6 +931,17 @@ func getBonusWeekDataMap() map[int64][]int { return bonusMap } +func getWeekAndNum(name string) (int, int) { + name = name[0 : len(name)-4] + tmp := strings.Split(name, "_") + if len(tmp) == 2 { + week := getIntValue(tmp[0]) + num := getIntValue(tmp[1]) + return week, num + } + return 0, 0 +} + func getBonusMap() map[string]map[string]int { bonusMap := make(map[string]map[string]int) url := setting.RecommentRepoAddr + "bonus/record.txt"