feat: add Go backend

This commit is contained in:
richjohnrambo
2026-10-10 20:56:17 +08:00
parent 50fcfd2d3d
commit f6024f0964
1040 changed files with 107169 additions and 0 deletions
@@ -0,0 +1,51 @@
// Package common
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package common
import (
"context"
"hotgo/api/admin/common"
"hotgo/internal/service"
)
var Console = cConsole{}
type cConsole struct{}
// Stat 综合数据统计
func (c *cConsole) Stat(_ context.Context, _ *common.ConsoleStatReq) (res *common.ConsoleStatRes, err error) {
res = new(common.ConsoleStatRes)
// 此处均为模拟数据,可以根据实际业务情况替换成真实数据
res.Visits.DayVisits = 12010
res.Visits.Rise = 13501
res.Visits.Decline = 10502
res.Visits.Amount = 10403
res.Saleroom.WeekSaleroom = 20501
res.Saleroom.Amount = 21002
res.Saleroom.Degree = 83.66
res.OrderLarge.WeekLarge = 39901
res.OrderLarge.Rise = 31012
res.OrderLarge.Decline = 30603
res.OrderLarge.Amount = 36084
res.Volume.WeekLarge = 40021
res.Volume.Rise = 40202
res.Volume.Decline = 45003
res.Volume.Amount = 49004
return
}
func (c *cConsole) Summary(ctx context.Context, req *common.DashboardSummaryReq) (res *common.DashboardSummaryRes, err error) {
data, err := service.SysDashboard().Summary(ctx, &req.DashboardSummaryInp)
if err != nil {
return nil, err
}
return &common.DashboardSummaryRes{DashboardSummaryModel: data}, nil
}