parent
2d0bac9d1b
commit
0f63c824fd
@ -0,0 +1,36 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/taoshihan1991/imaptool/models"
|
||||||
|
"github.com/taoshihan1991/imaptool/tools"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetChartStatistic(c *gin.Context) {
|
||||||
|
kefuName, _ := c.Get("kefu_name")
|
||||||
|
|
||||||
|
dayNumMap := make(map[string]string)
|
||||||
|
result := models.CountVisitorsEveryDay(kefuName.(string))
|
||||||
|
for _, item := range result {
|
||||||
|
dayNumMap[item.Day] = tools.Int2Str(item.Num)
|
||||||
|
}
|
||||||
|
|
||||||
|
nowTime := time.Now()
|
||||||
|
list := make([]map[string]string, 0)
|
||||||
|
for i := 0; i > -46; i-- {
|
||||||
|
getTime := nowTime.AddDate(0, 0, i) //年,月,日 获取一天前的时间
|
||||||
|
resTime := getTime.Format("06-01-02") //获取的时间的格式
|
||||||
|
tmp := make(map[string]string)
|
||||||
|
tmp["day"] = resTime
|
||||||
|
tmp["num"] = dayNumMap[resTime]
|
||||||
|
list = append(list, tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, gin.H{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "ok",
|
||||||
|
"result": list,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,15 @@
|
|||||||
|
{{template "header" }}
|
||||||
|
<div id="app" style="width:100%;background: #eef0f6">
|
||||||
|
<template>
|
||||||
|
<div style="background: #fff;margin: 10px;padding: 10px" id="visitorNums">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script src="/static/js/echarts.min.js?v=1.0.0"></script>
|
||||||
|
<script>
|
||||||
|
const ACTION="pannel";
|
||||||
|
</script>
|
||||||
|
{{template "setting_bottom" .}}
|
Loading…
Reference in new issue