274 lines
9.4 KiB
Plaintext
274 lines
9.4 KiB
Plaintext
|
|
syntax = "v1"
|
|||
|
|
|
|||
|
|
info (
|
|||
|
|
title: "代理服务(简化版)"
|
|||
|
|
desc: "新代理系统接口 - 系统简化后移除团队、返佣、升级、提现、实名、邀请码功能"
|
|||
|
|
version: "v1"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// ============================================
|
|||
|
|
// 公开接口(无需认证)
|
|||
|
|
// ============================================
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 获取推广链接数据
|
|||
|
|
@handler GetLinkData
|
|||
|
|
get /link (GetLinkDataReq) returns (GetLinkDataResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
middleware: AuthInterceptor
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 申请成为代理(系统简化:无需邀请码)
|
|||
|
|
@handler ApplyForAgent
|
|||
|
|
post /apply (AgentApplyReq) returns (AgentApplyResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ============================================
|
|||
|
|
// 需要登录的接口
|
|||
|
|
// ============================================
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
jwt: JwtAuth
|
|||
|
|
middleware: UserAuthInterceptor
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 查看代理信息(简化版)
|
|||
|
|
@handler GetAgentInfo
|
|||
|
|
get /info returns (AgentInfoResp)
|
|||
|
|
|
|||
|
|
// 获取代理仪表板数据(简化版)
|
|||
|
|
@handler GetAgentDashboard
|
|||
|
|
get /dashboard returns (AgentDashboardResp)
|
|||
|
|
|
|||
|
|
// 生成推广链接
|
|||
|
|
@handler GeneratingLink
|
|||
|
|
post /generating_link (AgentGeneratingLinkReq) returns (AgentGeneratingLinkResp)
|
|||
|
|
|
|||
|
|
// 获取产品配置
|
|||
|
|
@handler GetAgentProductConfig
|
|||
|
|
get /product_config returns (AgentProductConfigResp)
|
|||
|
|
|
|||
|
|
// 获取收益信息(简化版)
|
|||
|
|
@handler GetRevenueInfo
|
|||
|
|
get /revenue returns (GetRevenueInfoResp)
|
|||
|
|
|
|||
|
|
// 获取佣金记录
|
|||
|
|
@handler GetCommissionList
|
|||
|
|
get /commission/list (GetCommissionListReq) returns (GetCommissionListResp)
|
|||
|
|
|
|||
|
|
// 获取推广查询报告列表
|
|||
|
|
@handler GetPromotionQueryList
|
|||
|
|
get /promotion/query/list (GetPromotionQueryListReq) returns (GetPromotionQueryListResp)
|
|||
|
|
|
|||
|
|
// 创建提现申请
|
|||
|
|
@handler CreateWithdraw
|
|||
|
|
post /withdraw/create (CreateWithdrawReq) returns (CreateWithdrawResp)
|
|||
|
|
|
|||
|
|
// 获取提现记录列表
|
|||
|
|
@handler GetWithdrawList
|
|||
|
|
get /withdraw/list (GetWithdrawListReq) returns (GetWithdrawListResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ============================================
|
|||
|
|
// 短链重定向接口(公开访问,不需要认证和api前缀)
|
|||
|
|
// ============================================
|
|||
|
|
@server (
|
|||
|
|
group: agent
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 短链重定向
|
|||
|
|
@handler ShortLinkRedirect
|
|||
|
|
get /s/:shortCode returns (ShortLinkRedirectResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ============================================
|
|||
|
|
// 类型定义
|
|||
|
|
// ============================================
|
|||
|
|
type (
|
|||
|
|
// 获取推广链接数据
|
|||
|
|
GetLinkDataReq {
|
|||
|
|
LinkIdentifier string `form:"link_identifier"` // 推广链接标识
|
|||
|
|
}
|
|||
|
|
GetLinkDataResp {
|
|||
|
|
AgentId string `json:"agent_id"` // 代理ID
|
|||
|
|
ProductId string `json:"product_id"` // 产品ID
|
|||
|
|
SetPrice float64 `json:"set_price"` // 代理设定价格
|
|||
|
|
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
|
|||
|
|
ProductName string `json:"product_name"` // 产品名称
|
|||
|
|
ProductEn string `json:"product_en"` // 产品英文标识
|
|||
|
|
SellPrice float64 `json:"sell_price"` // 销售价格(使用代理设定价格)
|
|||
|
|
Description string `json:"description"` // 产品描述
|
|||
|
|
Features []Feature `json:"features"` // 产品功能列表
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 申请成为代理
|
|||
|
|
AgentApplyReq {
|
|||
|
|
Region string `json:"region,optional"`
|
|||
|
|
Mobile string `json:"mobile"`
|
|||
|
|
Code string `json:"code"`
|
|||
|
|
Referrer string `json:"referrer"`
|
|||
|
|
AgentCode int64 `json:"agent_code,optional"`
|
|||
|
|
}
|
|||
|
|
AgentApplyResp {
|
|||
|
|
AccessToken string `json:"accessToken"`
|
|||
|
|
AccessExpire int64 `json:"accessExpire"`
|
|||
|
|
RefreshAfter int64 `json:"refreshAfter"`
|
|||
|
|
AgentCode int64 `json:"agent_code"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 代理信息(简化版)
|
|||
|
|
AgentInfoResp {
|
|||
|
|
AgentId string `json:"agent_id"`
|
|||
|
|
Region string `json:"region"`
|
|||
|
|
Mobile string `json:"mobile"`
|
|||
|
|
WechatId string `json:"wechat_id"`
|
|||
|
|
AgentCode int64 `json:"agent_code"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 代理仪表板数据(简化版)
|
|||
|
|
AgentDashboardResp {
|
|||
|
|
Statistics DashboardStatistics `json:"statistics"` // 统计数据
|
|||
|
|
PromotionLink string `json:"promotion_link"` // 推广链接
|
|||
|
|
Product DashboardProduct `json:"product"` // 产品信息
|
|||
|
|
}
|
|||
|
|
DashboardStatistics {
|
|||
|
|
TodayOrders int64 `json:"today_orders"` // 今日订单数
|
|||
|
|
TodayEarnings string `json:"today_earnings"` // 今日佣金
|
|||
|
|
MonthEarnings string `json:"month_earnings"` // 本月佣金
|
|||
|
|
TotalOrders int64 `json:"total_orders"` // 总订单数
|
|||
|
|
TotalEarnings string `json:"total_earnings"` // 总佣金
|
|||
|
|
CommissionRate string `json:"commission_rate"` // 佣金率
|
|||
|
|
CurrentBalance string `json:"current_balance"` // 当前余额
|
|||
|
|
FrozenBalance string `json:"frozen_balance"` // 冻结余额
|
|||
|
|
}
|
|||
|
|
DashboardProduct {
|
|||
|
|
Name string `json:"name"` // 产品名称
|
|||
|
|
Price string `json:"price"` // 价格
|
|||
|
|
Description string `json:"description"` // 描述
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 生成推广链接
|
|||
|
|
AgentGeneratingLinkReq {
|
|||
|
|
ProductId string `json:"product_id"` // 产品ID
|
|||
|
|
SetPrice float64 `json:"set_price"` // 设定价格
|
|||
|
|
TargetPath string `json:"target_path,optional"` // 目标地址(可选,默认为推广报告页面)
|
|||
|
|
}
|
|||
|
|
AgentGeneratingLinkResp {
|
|||
|
|
LinkIdentifier string `json:"link_identifier"` // 推广链接标识
|
|||
|
|
FullLink string `json:"full_link"` // 完整短链URL
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 产品配置
|
|||
|
|
AgentProductConfigResp {
|
|||
|
|
List []ProductConfigItem `json:"list"`
|
|||
|
|
}
|
|||
|
|
ProductConfigItem {
|
|||
|
|
ProductId string `json:"product_id"` // 产品ID
|
|||
|
|
ProductName string `json:"product_name"` // 产品名称
|
|||
|
|
ProductEn string `json:"product_en"` // 产品英文标识
|
|||
|
|
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
|
|||
|
|
PriceRangeMin float64 `json:"price_range_min"` // 最低价格
|
|||
|
|
PriceRangeMax float64 `json:"price_range_max"` // 最高价格
|
|||
|
|
PriceThreshold float64 `json:"price_threshold"` // 提价标准阈值
|
|||
|
|
PriceFeeRate float64 `json:"price_fee_rate"` // 提价手续费比例
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 收益信息(简化版)
|
|||
|
|
GetRevenueInfoResp {
|
|||
|
|
Balance float64 `json:"balance"` // 可用余额
|
|||
|
|
TotalEarnings float64 `json:"total_earnings"` // 累计收益
|
|||
|
|
CommissionTotal float64 `json:"commission_total"` // 佣金累计总收益
|
|||
|
|
CommissionToday float64 `json:"commission_today"` // 佣金今日收益
|
|||
|
|
CommissionMonth float64 `json:"commission_month"` // 佣金本月收益
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 佣金记录
|
|||
|
|
GetCommissionListReq {
|
|||
|
|
Page int64 `form:"page"` // 页码
|
|||
|
|
PageSize int64 `form:"page_size"` // 每页数量
|
|||
|
|
}
|
|||
|
|
GetCommissionListResp {
|
|||
|
|
Total int64 `json:"total"` // 总数
|
|||
|
|
List []CommissionItem `json:"list"` // 列表
|
|||
|
|
}
|
|||
|
|
CommissionItem {
|
|||
|
|
Id string `json:"id"` // 记录ID
|
|||
|
|
OrderId string `json:"order_id"` // 订单ID
|
|||
|
|
OrderNo string `json:"order_no"` // 订单号
|
|||
|
|
ProductName string `json:"product_name"` // 产品名称
|
|||
|
|
Amount float64 `json:"amount"` // 佣金金额
|
|||
|
|
Status int64 `json:"status"` // 状态:1=已发放,2=已冻结,3=已取消
|
|||
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 推广查询列表
|
|||
|
|
GetPromotionQueryListReq {
|
|||
|
|
Page int64 `form:"page"` // 页码
|
|||
|
|
PageSize int64 `form:"page_size"` // 每页数量
|
|||
|
|
}
|
|||
|
|
GetPromotionQueryListResp {
|
|||
|
|
Total int64 `json:"total"` // 总数
|
|||
|
|
List []PromotionQueryItem `json:"list"` // 列表
|
|||
|
|
}
|
|||
|
|
PromotionQueryItem {
|
|||
|
|
Id string `json:"id"` // 查询ID
|
|||
|
|
OrderId string `json:"order_id"` // 订单ID
|
|||
|
|
OrderNo string `json:"order_no"` // 订单号
|
|||
|
|
ProductName string `json:"product_name"` // 产品名称
|
|||
|
|
OrderAmount float64 `json:"order_amount"` // 订单金额
|
|||
|
|
Amount float64 `json:"amount"` // 推广收益
|
|||
|
|
QueryName string `json:"query_name"` // 查询人姓名
|
|||
|
|
QueryMobile string `json:"query_mobile"` // 查询人手机号
|
|||
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|||
|
|
QueryState string `json:"query_state"` // 查询状态
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 短链重定向
|
|||
|
|
ShortLinkRedirectResp {}
|
|||
|
|
|
|||
|
|
// ============================================
|
|||
|
|
// 提现相关
|
|||
|
|
// ============================================
|
|||
|
|
|
|||
|
|
// 创建提现申请
|
|||
|
|
CreateWithdrawReq {
|
|||
|
|
WithdrawAmount float64 `json:"withdraw_amount"` // 提现金额
|
|||
|
|
AccountName string `json:"account_name"` // 收款人姓名
|
|||
|
|
BankCardNumber string `json:"bank_card_number"` // 银行卡号
|
|||
|
|
BankBranch string `json:"bank_branch,optional"` // 开户支行(可选)
|
|||
|
|
}
|
|||
|
|
CreateWithdrawResp {
|
|||
|
|
WithdrawId string `json:"withdraw_id"` // 提现记录ID
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 获取提现记录列表
|
|||
|
|
GetWithdrawListReq {
|
|||
|
|
Page int64 `form:"page"` // 页码
|
|||
|
|
PageSize int64 `form:"page_size"` // 每页数量
|
|||
|
|
}
|
|||
|
|
GetWithdrawListResp {
|
|||
|
|
Total int64 `json:"total"` // 总数
|
|||
|
|
List []WithdrawItem `json:"list"` // 列表
|
|||
|
|
}
|
|||
|
|
WithdrawItem {
|
|||
|
|
Id string `json:"id"` // 记录ID
|
|||
|
|
WithdrawAmount string `json:"withdraw_amount"` // 提现金额
|
|||
|
|
TaxAmount string `json:"tax_amount"` // 税费金额
|
|||
|
|
ActualAmount string `json:"actual_amount"` // 实际到账金额
|
|||
|
|
AccountName string `json:"account_name"` // 收款人姓名
|
|||
|
|
BankCardNumber string `json:"bank_card_number"` // 银行卡号(脱敏)
|
|||
|
|
Status int64 `json:"status"` // 状态:0=待审核,1=已通过,2=已拒绝
|
|||
|
|
AuditRemark string `json:"audit_remark"` // 审核备注
|
|||
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|||
|
|
AuditTime string `json:"audit_time"` // 审核时间
|
|||
|
|
}
|
|||
|
|
)
|