优化代码

This commit is contained in:
Sakurasan
2023-04-27 02:31:35 +08:00
parent a100d75c00
commit a202dfadca
2 changed files with 44 additions and 35 deletions

View File

@@ -58,7 +58,7 @@ func QueryUsage(from, to string) ([]CalcUsage, error) {
--SUM(prompt_units) AS prompt_units,
-- SUM(completion_units) AS completion_units,
SUM(total_unit) AS total_unit,
SUM(cost) AS cost`).
printf('%.6f', SUM(cost)) AS cost`).
Group("user_id").
Where("date >= ? AND date < ?", from, to).
Find(&results).Error