fix:首页日期选择器报错
fix:首页日期选择器报错
This commit is contained in:
commit
1de9c1fa5c
@ -55,14 +55,19 @@ func (s *Statistics) DateRangeStatistics() (statisticsData map[string][]interfac
|
|||||||
|
|
||||||
for i := 0; i < TimeDifference; i++ {
|
for i := 0; i < TimeDifference; i++ {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
sqlDataValue += "SELECT curdate() AS click_date UNION ALL"
|
sqlDataValue += fmt.Sprintf("SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL 0 DAY ) AS click_date UNION ALL", endTime)
|
||||||
} else if i == TimeDifference-1 {
|
} else if i == TimeDifference-1 {
|
||||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub( curdate(), INTERVAL %d DAY ) AS click_date`, i)
|
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date UNION ALL`, endTime, i)
|
||||||
|
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date`, endTime, i + 1)
|
||||||
} else {
|
} else {
|
||||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub( curdate(), INTERVAL %d DAY ) AS click_date UNION ALL`, i)
|
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date UNION ALL`, endTime, i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if TimeDifference == 1 {
|
||||||
|
sqlDataValue += fmt.Sprintf(" SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL 1 DAY ) AS click_date",endTime)
|
||||||
|
}
|
||||||
|
|
||||||
sqlValue = fmt.Sprintf(`SELECT
|
sqlValue = fmt.Sprintf(`SELECT
|
||||||
a.click_date,
|
a.click_date,
|
||||||
ifnull( b.total, 0 ) AS total,
|
ifnull( b.total, 0 ) AS total,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user