dashboard sql 适配 MariaDB.
This commit is contained in:
parent
09ea44302e
commit
0318f345b4
@ -14,7 +14,7 @@ func WeeklyStatistics() (statisticsData map[string][]interface{}, err error) {
|
|||||||
var (
|
var (
|
||||||
datetime string
|
datetime string
|
||||||
total int
|
total int
|
||||||
over int
|
overs int
|
||||||
processing int
|
processing int
|
||||||
sqlValue string
|
sqlValue string
|
||||||
rows *sql.Rows
|
rows *sql.Rows
|
||||||
@ -22,7 +22,7 @@ func WeeklyStatistics() (statisticsData map[string][]interface{}, err error) {
|
|||||||
sqlValue = `SELECT
|
sqlValue = `SELECT
|
||||||
a.click_date,
|
a.click_date,
|
||||||
ifnull( b.total, 0 ) AS total,
|
ifnull( b.total, 0 ) AS total,
|
||||||
ifnull( b.over, 0 ) AS over,
|
ifnull( b.overs, 0 ) AS overs,
|
||||||
ifnull( b.processing, 0 ) AS processing
|
ifnull( b.processing, 0 ) AS processing
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
@ -45,7 +45,7 @@ func WeeklyStatistics() (statisticsData map[string][]interface{}, err error) {
|
|||||||
SELECT
|
SELECT
|
||||||
a1.datetime AS datetime,
|
a1.datetime AS datetime,
|
||||||
a1.count AS total,
|
a1.count AS total,
|
||||||
b1.count AS over,
|
b1.count AS overs,
|
||||||
c.count AS processing
|
c.count AS processing
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
@ -86,13 +86,13 @@ func WeeklyStatistics() (statisticsData map[string][]interface{}, err error) {
|
|||||||
}()
|
}()
|
||||||
statisticsData = map[string][]interface{}{}
|
statisticsData = map[string][]interface{}{}
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
err = rows.Scan(&datetime, &total, &over, &processing)
|
err = rows.Scan(&datetime, &total, &overs, &processing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
statisticsData["datetime"] = append(statisticsData["datetime"], datetime[:10])
|
statisticsData["datetime"] = append(statisticsData["datetime"], datetime[:10])
|
||||||
statisticsData["total"] = append(statisticsData["total"], total)
|
statisticsData["total"] = append(statisticsData["total"], total)
|
||||||
statisticsData["over"] = append(statisticsData["over"], over)
|
statisticsData["overs"] = append(statisticsData["overs"], overs)
|
||||||
statisticsData["processing"] = append(statisticsData["processing"], processing)
|
statisticsData["processing"] = append(statisticsData["processing"], processing)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user