正在显示
1 个修改的文件
包含
11 行增加
和
9 行删除
@@ -362,30 +362,32 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query | @@ -362,30 +362,32 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query | ||
362 | queryOptions = tool_funs.SimpleStructToMap(&request) | 362 | queryOptions = tool_funs.SimpleStructToMap(&request) |
363 | 363 | ||
364 | var dividends = &CreditAccountStatisticsResponse{} | 364 | var dividends = &CreditAccountStatisticsResponse{} |
365 | - var beginTime, endTime time.Time | 365 | + year, month := time.Now().Year(), time.Now().Month() |
366 | + var beginTime = time.Date(year, month, 1, 0, 0, 0, 0, time.Local) | ||
367 | + var endTime time.Time | ||
366 | var increaseDay = 5 | 368 | var increaseDay = 5 |
367 | - var monthEnd = utils.GetFirstDateOfMonth(time.Now()).Add(-time.Second) | 369 | + var monthEnd = time.Date(year, month+1, 1, 0, 0, 0, 0, time.Local).Add(-time.Second) |
368 | var xAxisData []string | 370 | var xAxisData []string |
369 | var values []float64 | 371 | var values []float64 |
370 | for { | 372 | for { |
371 | if beginTime.AddDate(0, 0, increaseDay).After(monthEnd) { | 373 | if beginTime.AddDate(0, 0, increaseDay).After(monthEnd) { |
372 | endTime = monthEnd | 374 | endTime = monthEnd |
373 | - } | ||
374 | - if endTime.After(monthEnd) { | ||
375 | break | 375 | break |
376 | + } else { | ||
377 | + endTime = beginTime.AddDate(0, 0, increaseDay).Add(-time.Second) | ||
376 | } | 378 | } |
377 | - | ||
378 | xAxisData = append(xAxisData, endTime.Format("01-02")) | 379 | xAxisData = append(xAxisData, endTime.Format("01-02")) |
379 | queryOptions["beginTime"] = beginTime | 380 | queryOptions["beginTime"] = beginTime |
380 | - queryOptions["endTime"] = endTime | 381 | + queryOptions["endTime"] = beginTime.AddDate(0, 0, increaseDay) |
381 | if err := creditAccountDao.DividendsStatistics(queryOptions, dividends); err != nil { | 382 | if err := creditAccountDao.DividendsStatistics(queryOptions, dividends); err != nil { |
382 | return nil, err | 383 | return nil, err |
383 | } | 384 | } |
384 | dividends.Accounting = dividends.Total - dividends.Accounted | 385 | dividends.Accounting = dividends.Total - dividends.Accounted |
385 | values = append(values, dividends.Paid) | 386 | values = append(values, dividends.Paid) |
386 | - | ||
387 | - beginTime = endTime.AddDate(0, 0, increaseDay) | ||
388 | - endTime = endTime.AddDate(0, 0, increaseDay) | 387 | + beginTime = endTime |
388 | + if endTime == monthEnd { | ||
389 | + break | ||
390 | + } | ||
389 | } | 391 | } |
390 | return map[string]interface{}{ | 392 | return map[string]interface{}{ |
391 | "xAxis": map[string]interface{}{ | 393 | "xAxis": map[string]interface{}{ |
-
请 注册 或 登录 后发表评论