This commit is contained in:
2026-02-27 17:05:33 +08:00
parent e42d2d18aa
commit c960fd099a
4 changed files with 61 additions and 41 deletions

View File

@@ -47,6 +47,8 @@ type (
AdminCreateFeatureReq { AdminCreateFeatureReq {
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
} }
// 创建功能响应 // 创建功能响应
AdminCreateFeatureResp { AdminCreateFeatureResp {
@@ -57,6 +59,8 @@ type (
Id string `path:"id"` // 功能ID Id string `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识 ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述 Name *string `json:"name,optional"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
} }
// 更新功能响应 // 更新功能响应
AdminUpdateFeatureResp { AdminUpdateFeatureResp {
@@ -82,6 +86,8 @@ type (
Id string `json:"id"` // 功能ID Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间 UpdateTime string `json:"update_time"` // 更新时间
} }
@@ -99,6 +105,8 @@ type (
Id string `json:"id"` // 功能ID Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间 UpdateTime string `json:"update_time"` // 更新时间
} }

View File

@@ -30,7 +30,7 @@ func (l *AdminGetFeatureDetailLogic) AdminGetFeatureDetail(req *types.AdminGetFe
record, err := l.svcCtx.FeatureModel.FindOne(l.ctx, req.Id) record, err := l.svcCtx.FeatureModel.FindOne(l.ctx, req.Id)
if err != nil { if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"查找功能失败, err: %v, id: %d", err, req.Id) "查找功能失败, err: %v, id: %s", err, req.Id)
} }
// 2. 构建响应 // 2. 构建响应
@@ -38,6 +38,8 @@ func (l *AdminGetFeatureDetailLogic) AdminGetFeatureDetail(req *types.AdminGetFe
Id: record.Id, Id: record.Id,
ApiId: record.ApiId, ApiId: record.ApiId,
Name: record.Name, Name: record.Name,
WhitelistPrice: record.WhitelistPrice,
CostPrice: record.CostPrice,
CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"), CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"), UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"),
} }

View File

@@ -52,6 +52,8 @@ func (l *AdminGetFeatureListLogic) AdminGetFeatureList(req *types.AdminGetFeatur
Id: item.Id, Id: item.Id,
ApiId: item.ApiId, ApiId: item.ApiId,
Name: item.Name, Name: item.Name,
WhitelistPrice: item.WhitelistPrice,
CostPrice: item.CostPrice,
CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"), CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"), UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"),
} }

View File

@@ -92,6 +92,8 @@ type AdminCreateApiResp struct {
type AdminCreateFeatureReq struct { type AdminCreateFeatureReq struct {
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
} }
type AdminCreateFeatureResp struct { type AdminCreateFeatureResp struct {
@@ -404,6 +406,8 @@ type AdminGetFeatureDetailResp struct {
Id string `json:"id"` // 功能ID Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间 UpdateTime string `json:"update_time"` // 更新时间
} }
@@ -845,6 +849,8 @@ type AdminUpdateFeatureReq struct {
Id string `path:"id"` // 功能ID Id string `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识 ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述 Name *string `json:"name,optional"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
} }
type AdminUpdateFeatureResp struct { type AdminUpdateFeatureResp struct {
@@ -1320,6 +1326,8 @@ type FeatureListItem struct {
Id string `json:"id"` // 功能ID Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识 ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述 Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间 UpdateTime string `json:"update_time"` // 更新时间
} }