|
@@ -4,6 +4,7 @@ import (
|
|
|
"context"
|
|
|
"github.com/suyuan32/simple-admin-common/msg/errormsg"
|
|
|
"github.com/suyuan32/simple-admin-common/utils/pointy"
|
|
|
+ "github.com/suyuan32/simple-admin-core/rpc/types/core"
|
|
|
"time"
|
|
|
"wechat-api/ent/predicate"
|
|
|
"wechat-api/ent/usagedetail"
|
|
@@ -78,6 +79,8 @@ func (l *GetUsageDetailListLogic) GetUsageDetailList(req *types.UsageDetailListR
|
|
|
resp.Msg = errormsg.Success
|
|
|
resp.Data.Total = data.PageDetails.Total
|
|
|
|
|
|
+ orgaMap := make(map[uint64]string)
|
|
|
+
|
|
|
for _, v := range data.List {
|
|
|
app := "未知"
|
|
|
if v.App == 1 {
|
|
@@ -97,6 +100,17 @@ func (l *GetUsageDetailListLogic) GetUsageDetailList(req *types.UsageDetailListR
|
|
|
} else if v.App == 4 {
|
|
|
request = "节点判断"
|
|
|
}
|
|
|
+
|
|
|
+ organizationName := ""
|
|
|
+ if oname, ok := orgaMap[v.OrganizationID]; ok {
|
|
|
+ organizationName = oname
|
|
|
+ } else {
|
|
|
+ departmentInfo, err := l.svcCtx.CoreRpc.GetDepartmentById(l.ctx, &core.IDReq{Id: v.OrganizationID})
|
|
|
+ if err == nil {
|
|
|
+ organizationName = *departmentInfo.Name
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
resp.Data.Data = append(resp.Data.Data,
|
|
|
types.UsageDetailInfo{
|
|
|
BaseIDInfo: types.BaseIDInfo{
|
|
@@ -116,6 +130,7 @@ func (l *GetUsageDetailListLogic) GetUsageDetailList(req *types.UsageDetailListR
|
|
|
PromptTokens: &v.PromptTokens,
|
|
|
CompletionTokens: &v.CompletionTokens,
|
|
|
OrganizationId: &v.OrganizationID,
|
|
|
+ OrganizationName: &organizationName,
|
|
|
})
|
|
|
}
|
|
|
|