diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index cd9868a9d..457559711 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -409,9 +409,6 @@ func getWhereSqlManage(cityCodes []int, jobTime, endTime time.Time, jobIDs []int func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs []int) (getManageStatisticsResult *GetManageStatisticsResult, err error) { endTime := jobTime.AddDate(0, 0, 1) sqlParams := []interface{}{} - getManageStatisticsResult = &GetManageStatisticsResult{ - Date: jobTime, - } sql := ` SELECT t1.count accept_count, t2.count finish_count, t3.count cancel_count, t4.browse_count, t6.total_cash FROM @@ -455,12 +452,19 @@ func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs [ )t6 ` err = GetRow(db, &getManageStatisticsResult, sql, sqlParams) - if getManageStatisticsResult.BrowseCount == 0 { - getManageStatisticsResult.InversionRate = 0 + if getManageStatisticsResult == nil { + return &GetManageStatisticsResult{ + Date: jobTime, + }, err } else { - getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount)) + getManageStatisticsResult.Date = jobTime + if getManageStatisticsResult.BrowseCount == 0 { + getManageStatisticsResult.InversionRate = 0 + } else { + getManageStatisticsResult.InversionRate = math.Round(float64(getManageStatisticsResult.FinishCount) / float64(getManageStatisticsResult.BrowseCount)) + } + return getManageStatisticsResult, err } - return getManageStatisticsResult, err } type GetManageStatisticsJobResult struct {