aa
This commit is contained in:
@@ -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) {
|
func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs []int) (getManageStatisticsResult *GetManageStatisticsResult, err error) {
|
||||||
endTime := jobTime.AddDate(0, 0, 1)
|
endTime := jobTime.AddDate(0, 0, 1)
|
||||||
sqlParams := []interface{}{}
|
sqlParams := []interface{}{}
|
||||||
getManageStatisticsResult = &GetManageStatisticsResult{
|
|
||||||
Date: jobTime,
|
|
||||||
}
|
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.count accept_count, t2.count finish_count, t3.count cancel_count, t4.browse_count, t6.total_cash
|
SELECT t1.count accept_count, t2.count finish_count, t3.count cancel_count, t4.browse_count, t6.total_cash
|
||||||
FROM
|
FROM
|
||||||
@@ -455,12 +452,19 @@ func GetManageStatistics(db *DaoDB, cityCodes []int, jobTime time.Time, jobIDs [
|
|||||||
)t6
|
)t6
|
||||||
`
|
`
|
||||||
err = GetRow(db, &getManageStatisticsResult, sql, sqlParams)
|
err = GetRow(db, &getManageStatisticsResult, sql, sqlParams)
|
||||||
if getManageStatisticsResult.BrowseCount == 0 {
|
if getManageStatisticsResult == nil {
|
||||||
getManageStatisticsResult.InversionRate = 0
|
return &GetManageStatisticsResult{
|
||||||
|
Date: jobTime,
|
||||||
|
}, err
|
||||||
} else {
|
} 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 {
|
type GetManageStatisticsJobResult struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user