|
@@ -574,13 +574,20 @@ func (s *ServiceStatisticsLog) CreateComputerStatisticsData() {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (s *ServiceStatisticsLog) ComputerStatistics(ctx context.Context, api log.StatisticsLog, info request.PageInfo) (interface{}, int64, error) {
|
|
|
|
|
|
|
+func (s *ServiceStatisticsLog) ComputerStatistics(ctx context.Context, api log.LogComputer, info request.PageInfo) (interface{}, int64, error) {
|
|
|
date := api.CreateDate
|
|
date := api.CreateDate
|
|
|
if date == "" {
|
|
if date == "" {
|
|
|
date = s.CurrentDate()
|
|
date = s.CurrentDate()
|
|
|
}
|
|
}
|
|
|
db := global.GVA_DB.Model(&log.LogComputer{})
|
|
db := global.GVA_DB.Model(&log.LogComputer{})
|
|
|
var total int64
|
|
var total int64
|
|
|
|
|
+ db = db.Where("create_date = ?", date)
|
|
|
|
|
+ if api.Operator != "" {
|
|
|
|
|
+ db = db.Where("operator = ?", api.Operator)
|
|
|
|
|
+ }
|
|
|
|
|
+ if api.PcCode != "" {
|
|
|
|
|
+ db = db.Where("pc_code = ?", api.PcCode)
|
|
|
|
|
+ }
|
|
|
err := db.Count(&total).Error
|
|
err := db.Count(&total).Error
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
return nil, 0, err
|
|
@@ -588,7 +595,6 @@ func (s *ServiceStatisticsLog) ComputerStatistics(ctx context.Context, api log.S
|
|
|
limit := info.PageSize
|
|
limit := info.PageSize
|
|
|
offset := info.PageSize * (info.Page - 1)
|
|
offset := info.PageSize * (info.Page - 1)
|
|
|
var statisticsLogs []*log.LogComputer
|
|
var statisticsLogs []*log.LogComputer
|
|
|
- db = db.Where("create_date = ?", date)
|
|
|
|
|
db = db.Limit(limit).Offset(offset)
|
|
db = db.Limit(limit).Offset(offset)
|
|
|
err = db.Order("id").Find(&statisticsLogs).Error
|
|
err = db.Order("id").Find(&statisticsLogs).Error
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -598,12 +604,17 @@ func (s *ServiceStatisticsLog) ComputerStatistics(ctx context.Context, api log.S
|
|
|
for _, statisticsLog := range statisticsLogs {
|
|
for _, statisticsLog := range statisticsLogs {
|
|
|
var gameInfo []*response.GameInfo
|
|
var gameInfo []*response.GameInfo
|
|
|
err = json.Unmarshal([]byte(statisticsLog.GameInfo), &gameInfo)
|
|
err = json.Unmarshal([]byte(statisticsLog.GameInfo), &gameInfo)
|
|
|
- statisticsLogComputer := new(response.ComputerStatisticsReply1)
|
|
|
|
|
- statisticsLogComputer.GameInfo = gameInfo
|
|
|
|
|
- statisticsLogComputer.PcCode = statisticsLog.PcCode
|
|
|
|
|
- statisticsLogComputer.Operator = statisticsLog.Operator
|
|
|
|
|
- statisticsLogComputer.CreateDate = statisticsLog.CreateDate[:10]
|
|
|
|
|
- statisticsLogsComputer = append(statisticsLogsComputer, statisticsLogComputer)
|
|
|
|
|
|
|
+ for i, _ := range gameInfo {
|
|
|
|
|
+ statisticsLogComputer := new(response.ComputerStatisticsReply1)
|
|
|
|
|
+ statisticsLogComputer.GameInfo = gameInfo
|
|
|
|
|
+ statisticsLogComputer.PcCode = statisticsLog.PcCode
|
|
|
|
|
+ statisticsLogComputer.Operator = statisticsLog.Operator
|
|
|
|
|
+ statisticsLogComputer.CreateDate = statisticsLog.CreateDate[:10]
|
|
|
|
|
+ statisticsLogComputer.GameId = gameInfo[i].GameId
|
|
|
|
|
+ statisticsLogComputer.PullAccountNum = gameInfo[i].PullAccountNum
|
|
|
|
|
+ statisticsLogComputer.TaskSuccessNum = gameInfo[i].TaskSuccessNum
|
|
|
|
|
+ statisticsLogsComputer = append(statisticsLogsComputer, statisticsLogComputer)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return statisticsLogsComputer, total, err
|
|
return statisticsLogsComputer, total, err
|
|
|
}
|
|
}
|