chore: update implementation

This commit is contained in:
JustSong 2024-01-07 14:07:34 +08:00
parent 9706df061d
commit 3ebc8024c7
4 changed files with 11 additions and 8 deletions

View File

@ -259,17 +259,17 @@ func GetUserDashboard(c *gin.Context) {
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无法获取统计信息.",
"message": "无法获取统计信息",
"data": nil,
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": dashboards,
})
return
}
func GenerateAccessToken(c *gin.Context) {

View File

@ -193,7 +193,7 @@ type LogStatistic struct {
CompletionTokens int `gorm:"column:completion_tokens"`
}
func SearchLogsByDayAndModel(user_id, start, end int) (LogStatistics []*LogStatistic, err error) {
func SearchLogsByDayAndModel(userId, start, end int) (LogStatistics []*LogStatistic, err error) {
groupSelect := "DATE_FORMAT(FROM_UNIXTIME(created_at), '%Y-%m-%d') as day"
if common.UsingPostgreSQL {
@ -212,13 +212,13 @@ func SearchLogsByDayAndModel(user_id, start, end int) (LogStatistics []*LogStati
sum(completion_tokens) as completion_tokens
FROM logs
WHERE type=2
AND user_id= ?
AND userId= ?
AND created_at BETWEEN ? AND ?
GROUP BY day, model_name
ORDER BY day, model_name
`, user_id, start, end).Scan(&LogStatistics).Error
`, userId, start, end).Scan(&LogStatistics).Error
fmt.Println(user_id, start, end)
fmt.Println(userId, start, end)
return LogStatistics, err
}

View File

@ -40,7 +40,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && mv -f build ../build/berry",
"build": "GENERATE_SOURCEMAP=false react-scripts build && mv -f build ../build/berry",
"test": "react-scripts test",
"eject": "react-scripts eject"
},

View File

@ -22,7 +22,10 @@ const Footer = () => {
<Link href="https://github.com/songquanpeng" target="_blank">
JustSong
</Link>{' '}
构建源代码遵循
构建主题 berry 来自{' '}
<Link href="https://github.com/MartialBE" target="_blank">
MartialBE
</Link>{' '}
<Link href="https://opensource.org/licenses/mit-license.php"> MIT 协议</Link>
</>
)}