dashboard部分添加最近一周、模型使用统计数据
This commit is contained in:
parent
210daec992
commit
d5ae2cb902
|
|
@ -10,8 +10,8 @@ type DashBoardStatisticsSt struct {
|
||||||
|
|
||||||
// 统计过去一周每天的会话数、消息数
|
// 统计过去一周每天的会话数、消息数
|
||||||
type DashBoardStatisticsWeekSt struct {
|
type DashBoardStatisticsWeekSt struct {
|
||||||
SessionCount []int64 `json:"session_count"`
|
SessionCount map[int]int64 `json:"session_count"`
|
||||||
MessageCount []int64 `json:"message_count"`
|
MessageCount map[int]int64 `json:"message_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DashBoardStatisticsResp struct {
|
type DashBoardStatisticsResp struct {
|
||||||
|
|
|
||||||
|
|
@ -132,17 +132,22 @@ func GetBaseDashboardInfo() proto.DashBoardStatisticsSt {
|
||||||
// 获取最近7天的消息、会话数量
|
// 获取最近7天的消息、会话数量
|
||||||
func GetRecent7DaysMessageSessionCount() (proto.DashBoardStatisticsWeekSt, error) {
|
func GetRecent7DaysMessageSessionCount() (proto.DashBoardStatisticsWeekSt, error) {
|
||||||
var res proto.DashBoardStatisticsWeekSt
|
var res proto.DashBoardStatisticsWeekSt
|
||||||
var err error
|
SessionCounts, err := dao.FindSessionCountByDate()
|
||||||
res.SessionCount, err = dao.FindSessionCountByDate()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("get recent 7 days session count error:", err)
|
log.Println("get recent 7 days session count error:", err)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
res.MessageCount, err = dao.FindMessageCountByDate()
|
for i := 0; i < len(SessionCounts); i++ {
|
||||||
|
res.SessionCount[i] = SessionCounts[i]
|
||||||
|
}
|
||||||
|
MessageCounts, err := dao.FindMessageCountByDate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("get recent 7 days message count error:", err)
|
log.Println("get recent 7 days message count error:", err)
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
for i := 0; i < len(MessageCounts); i++ {
|
||||||
|
res.MessageCount[i] = MessageCounts[i]
|
||||||
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue