|
|
@@ -114,7 +114,7 @@ func QueryUserStaticData(startTime int64, endTime int64) []*UserBusinessAnalysis |
|
|
|
return userBusinessAnalysisReturnList |
|
|
|
} |
|
|
|
|
|
|
|
func CountData(wikiCountMap map[string]int) { |
|
|
|
func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime time.Time) { |
|
|
|
log.Info("start to count other user info data") |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
@@ -125,12 +125,12 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
currentTimeNow := time.Now() |
|
|
|
log.Info("current time:" + currentTimeNow.Format("2006-01-02 15:04:05")) |
|
|
|
|
|
|
|
yesterday := currentTimeNow.AddDate(0, 0, -1) |
|
|
|
startTime := time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location()) |
|
|
|
//yesterday := currentTimeNow.AddDate(0, 0, -1) |
|
|
|
//startTime := time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location()) |
|
|
|
start_unix := startTime.Unix() |
|
|
|
log.Info("DB query time:" + startTime.Format("2006-01-02 15:04:05")) |
|
|
|
|
|
|
|
endTime := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 0, 0, 0, currentTimeNow.Location()) |
|
|
|
//endTime := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 0, 0, 0, currentTimeNow.Location()) |
|
|
|
end_unix := endTime.Unix() |
|
|
|
|
|
|
|
CountDate := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 1, 0, 0, currentTimeNow.Location()) |
|
|
@@ -155,11 +155,17 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
CreateRepoCountMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
LoginCountMap := queryLoginCount(start_unix, end_unix) |
|
|
|
|
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
|
defer statictisSess.Close() |
|
|
|
|
|
|
|
for i, userRecord := range userList { |
|
|
|
var dateRecord UserBusinessAnalysis |
|
|
|
dateRecord.ID = userRecord.ID |
|
|
|
log.Info("i=" + fmt.Sprint(i) + " userName=" + userRecord.Name) |
|
|
|
dateRecord.CountDate = CountDate.Unix() |
|
|
|
|
|
|
|
statictisSess.Delete(&dateRecord) |
|
|
|
|
|
|
|
dateRecord.Email = userRecord.Email |
|
|
|
dateRecord.RegistDate = userRecord.CreatedUnix |
|
|
|
dateRecord.Name = userRecord.Name |
|
|
@@ -244,13 +250,26 @@ func CountData(wikiCountMap map[string]int) { |
|
|
|
|
|
|
|
dateRecord.CommitModelCount = 0 |
|
|
|
|
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
|
defer statictisSess.Close() |
|
|
|
statictisSess.Insert(&dateRecord) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func CountData(wikiCountMap map[string]int) { |
|
|
|
|
|
|
|
currentTimeNow := time.Now() |
|
|
|
log.Info("current time:" + currentTimeNow.Format("2006-01-02 15:04:05")) |
|
|
|
|
|
|
|
yesterday := currentTimeNow.AddDate(0, 0, -1) |
|
|
|
startTime := time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location()) |
|
|
|
|
|
|
|
log.Info("DB query time:" + startTime.Format("2006-01-02 15:04:05")) |
|
|
|
|
|
|
|
endTime := time.Date(currentTimeNow.Year(), currentTimeNow.Month(), currentTimeNow.Day(), 0, 0, 0, 0, currentTimeNow.Location()) |
|
|
|
|
|
|
|
CounDataByDate(wikiCountMap, startTime, endTime) |
|
|
|
} |
|
|
|
|
|
|
|
func querySolveIssue(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
//select issue_assignees.* from issue_assignees,issue where issue.is_closed=true and issue.id=issue_assignees.issue_id |
|
|
|
sess := x.NewSession() |
|
|
|