This commit is contained in:
2026-03-02 14:32:18 +08:00
parent 764ad2f684
commit 2c99e6b6a4
40 changed files with 3895 additions and 60 deletions

View File

@@ -45,8 +45,10 @@ service main {
type (
// 创建功能请求
AdminCreateFeatureReq {
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
}
// 创建功能响应
AdminCreateFeatureResp {
@@ -54,9 +56,11 @@ type (
}
// 更新功能请求
AdminUpdateFeatureReq {
Id string `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述
Id string `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价单位
}
// 更新功能响应
AdminUpdateFeatureResp {
@@ -79,11 +83,13 @@ type (
}
// 功能列表项
FeatureListItem {
Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 获取功能列表响应
AdminGetFeatureListResp {
@@ -96,11 +102,13 @@ type (
}
// 获取功能详情响应
AdminGetFeatureDetailResp {
Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
CostPrice float64 `json:"cost_price"` // 天远API调用成本价单位
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 配置功能示例数据请求
AdminConfigFeatureExampleReq {

View File

@@ -0,0 +1,93 @@
syntax = "v1"
info (
title: "后台统计面板服务"
desc: "后台统计面板相关接口"
author: "team"
version: "v1"
)
// ============================================
// 统计面板接口
// ============================================
@server (
prefix: /api/v1/admin/dashboard
group: admin_dashboard
middleware: AdminAuthInterceptor
)
service main {
// 获取统计面板数据
@handler AdminGetDashboardStatistics
get /statistics returns (AdminGetDashboardStatisticsResp)
}
type (
// 统计面板响应
AdminGetDashboardStatisticsResp {
// 订单统计
OrderStats AdminOrderStatistics `json:"order_stats"`
// 营收统计
RevenueStats AdminRevenueStatistics `json:"revenue_stats"`
// 代理统计
AgentStats AdminAgentStatistics `json:"agent_stats"`
// 利润统计
ProfitStats AdminProfitStatistics `json:"profit_stats"`
// 订单趋势最近7天
OrderTrend []AdminTrendData `json:"order_trend"`
// 营收趋势最近7天
RevenueTrend []AdminTrendData `json:"revenue_trend"`
}
// 订单统计
AdminOrderStatistics {
TodayCount int64 `json:"today_count"` // 今日订单数
MonthCount int64 `json:"month_count"` // 当月订单数
TotalCount int64 `json:"total_count"` // 总订单数
YesterdayCount int64 `json:"yesterday_count"` // 昨日订单数
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
}
// 营收统计
AdminRevenueStatistics {
TodayAmount float64 `json:"today_amount"` // 今日营收
MonthAmount float64 `json:"month_amount"` // 当月营收
TotalAmount float64 `json:"total_amount"` // 总营收
YesterdayAmount float64 `json:"yesterday_amount"` // 昨日营收
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
}
// 代理统计
AdminAgentStatistics {
TotalCount int64 `json:"total_count"` // 代理总数
TodayNew int64 `json:"today_new"` // 今日新增
MonthNew int64 `json:"month_new"` // 当月新增
}
// 利润统计
AdminProfitStatistics {
TodayProfit float64 `json:"today_profit"` // 今日利润
MonthProfit float64 `json:"month_profit"` // 当月利润
TotalProfit float64 `json:"total_profit"` // 总利润
TodayProfitRate float64 `json:"today_profit_rate"` // 今日利润率
MonthProfitRate float64 `json:"month_profit_rate"` // 当月利润率
TotalProfitRate float64 `json:"total_profit_rate"` // 总利润率
// 今日明细
TodayDetail AdminProfitDetail `json:"today_detail"`
// 当月明细
MonthDetail AdminProfitDetail `json:"month_detail"`
// 总计明细
TotalDetail AdminProfitDetail `json:"total_detail"`
}
// 利润明细
AdminProfitDetail {
Revenue float64 `json:"revenue"` // 营收
Commission float64 `json:"commission"` // 佣金
Rebate float64 `json:"rebate"` // 返利
CompanyTax float64 `json:"company_tax"` // 税务成本
ApiCost float64 `json:"api_cost"` // API调用成本
TaxIncome float64 `json:"tax_income"` // 提现收税
Profit float64 `json:"profit"` // 利润
ProfitRate float64 `json:"profit_rate"` // 利润率
}
// 趋势数据
AdminTrendData {
Date string `json:"date"` // 日期格式MM-DD
Value float64 `json:"value"` // 数值
}
)

View File

@@ -251,6 +251,32 @@ service main {
// 获取推广查询报告列表
@handler GetPromotionQueryList
get /promotion/query/list (GetPromotionQueryListReq) returns (GetPromotionQueryListResp)
// ============================================
// 用户模块白名单相关接口
// ============================================
@handler GetWhitelistFeatures
get /whitelist/features (GetWhitelistFeaturesReq) returns (GetWhitelistFeaturesResp)
// 创建白名单订单
@handler CreateWhitelistOrder
post /whitelist/order/create (CreateWhitelistOrderReq) returns (CreateWhitelistOrderResp)
// 获取用户白名单列表
@handler GetWhitelistList
get /whitelist/list (GetWhitelistListReq) returns (GetWhitelistListResp)
// 检查模块是否已下架(用于显示下架按钮状态)
@handler CheckFeatureWhitelistStatus
get /whitelist/check (CheckFeatureWhitelistStatusReq) returns (CheckFeatureWhitelistStatusResp)
// 下架单个模块(创建订单并支付)
@handler OfflineFeature
post /whitelist/offline (OfflineFeatureReq) returns (OfflineFeatureResp)
// 检查订单是否属于当前代理推广
@handler CheckOrderAgent
get /order/agent (CheckOrderAgentReq) returns (CheckOrderAgentResp)
}
type (
@@ -587,6 +613,75 @@ type (
CreateTime string `json:"create_time"` // 创建时间
QueryState string `json:"query_state"` // 查询状态
}
// ============================================
// 用户模块白名单相关类型
// ============================================
GetWhitelistFeaturesReq {}
GetWhitelistFeaturesResp {
List []WhitelistFeatureItem `json:"list"` // 可屏蔽的feature列表
}
WhitelistFeatureItem {
FeatureId string `json:"feature_id"` // Feature的UUID
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
FeatureName string `json:"feature_name"` // Feature的名称
WhitelistPrice float64 `json:"whitelist_price"` // 屏蔽价格(单位:元)
}
CreateWhitelistOrderReq {
IdCard string `json:"id_card"` // 身份证号(查询对象标识)
FeatureIds []string `json:"feature_ids"` // 要屏蔽的feature ID列表
OrderId string `json:"order_id,optional"` // 关联的查询订单ID可选
}
CreateWhitelistOrderResp {
OrderId string `json:"order_id"` // 订单ID
OrderNo string `json:"order_no"` // 订单号
TotalAmount float64 `json:"total_amount"` // 总金额
}
GetWhitelistListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
IdCard string `form:"id_card,optional"` // 身份证号(可选,用于筛选)
}
GetWhitelistListResp {
Total int64 `json:"total"` // 总数
List []WhitelistItem `json:"list"` // 列表
}
WhitelistItem {
Id string `json:"id"` // 白名单记录ID
IdCard string `json:"id_card"` // 身份证号
FeatureId string `json:"feature_id"` // Feature的UUID
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
FeatureName string `json:"feature_name"` // Feature的名称
Amount float64 `json:"amount"` // 费用
Status int64 `json:"status"` // 状态1=生效2=已失效
StatusText string `json:"status_text"` // 状态文本
CreateTime string `json:"create_time"` // 创建时间
}
CheckFeatureWhitelistStatusReq {
IdCard string `form:"id_card"` // 身份证号
FeatureApiId string `form:"feature_api_id"` // Feature的API标识
QueryId string `form:"query_id,optional"` // 查询记录ID可选
}
CheckFeatureWhitelistStatusResp {
IsWhitelisted bool `json:"is_whitelisted"` // 是否在白名单中
WhitelistPrice float64 `json:"whitelist_price"` // 屏蔽价格单位0表示不支持下架
FeatureId string `json:"feature_id"` // Feature的UUID
DataDeleted bool `json:"data_deleted"` // 报告数据是否已删除
}
OfflineFeatureReq {
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
QueryId string `json:"query_id"` // 查询记录IDQuery表的ID必选
}
OfflineFeatureResp {
Success bool `json:"success"` // 是否已完成下架
NeedPay bool `json:"need_pay"` // 是否需要发起支付
Amount float64 `json:"amount"` // 需要支付的金额0表示无需支付
}
CheckOrderAgentReq {
OrderId string `form:"order_id"` // 订单ID
}
CheckOrderAgentResp {
IsAgentOrder bool `json:"is_agent_order"` // 是否是当前代理推广的订单
}
)
// ============================================

View File

@@ -46,7 +46,7 @@ type (
PaymentReq {
Id string `json:"id"`
PayMethod string `json:"pay_method"` // 支付方式: wechat, alipay, appleiap, test(仅开发环境), test_empty(仅开发环境-空报告模式)
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade"`
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade whitelist"`
}
PaymentResp {
PrepayData interface{} `json:"prepay_data"`

View File

@@ -24,6 +24,7 @@ import "./admin/platform_user.api"
import "./admin/notification.api"
import "./admin/admin_product.api"
import "./admin/admin_feature.api"
import "./admin/dashboard.api"
import "./admin/admin_query.api"
import "./admin/admin_agent.api"
import "./admin/admin_api.api"