254 lines
7.5 KiB
Plaintext
254 lines
7.5 KiB
Plaintext
|
|
syntax = "v1"
|
|||
|
|
|
|||
|
|
info (
|
|||
|
|
title: "代理服务"
|
|||
|
|
desc: "代理服务接口"
|
|||
|
|
version: "v1"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// 代理服务基本类型定义
|
|||
|
|
type AgentProductConfig {
|
|||
|
|
ProductID int64 `json:"product_id"`
|
|||
|
|
ProductName string `json:"product_name"`
|
|||
|
|
ProductEn string `json:"product_en"`
|
|||
|
|
CostPrice float64 `json:"cost_price"`
|
|||
|
|
PriceRangeMin float64 `json:"price_range_min"`
|
|||
|
|
PriceRangeMax float64 `json:"price_range_max"`
|
|||
|
|
PPricingStandard float64 `json:"p_pricing_standard"`
|
|||
|
|
POverpricingRatio float64 `json:"p_overpricing_ratio"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ProductConfig {
|
|||
|
|
ProductID int64 `json:"product_id"`
|
|||
|
|
CostPrice float64 `json:"cost_price"`
|
|||
|
|
PriceRangeMin float64 `json:"price_range_min"`
|
|||
|
|
PriceRangeMax float64 `json:"price_range_max"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
jwt: JwtAuth
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 查看代理信息
|
|||
|
|
@handler GetAgentInfo
|
|||
|
|
get /info returns (AgentInfoResp)
|
|||
|
|
|
|||
|
|
@handler GetAgentRevenueInfo
|
|||
|
|
get /revenue (GetAgentRevenueInfoReq) returns (GetAgentRevenueInfoResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
jwt: JwtAuth
|
|||
|
|
middleware: UserAuthInterceptor
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 查询代理申请状态
|
|||
|
|
@handler GetAgentAuditStatus
|
|||
|
|
get /audit/status returns (AgentAuditStatusResp)
|
|||
|
|
|
|||
|
|
// 生成推广标识
|
|||
|
|
@handler GeneratingLink
|
|||
|
|
post /generating_link (AgentGeneratingLinkReq) returns (AgentGeneratingLinkResp)
|
|||
|
|
|
|||
|
|
// 获取推广定价配置
|
|||
|
|
@handler GetAgentProductConfig
|
|||
|
|
get /product_config returns (AgentProductConfigResp)
|
|||
|
|
|
|||
|
|
@handler AgentRealName
|
|||
|
|
post /real_name (AgentRealNameReq) returns (AgentRealNameResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type (
|
|||
|
|
AgentInfoResp {
|
|||
|
|
status int64 `json:"status"` // 0=待审核,1=审核通过,2=审核未通过,3=未申请
|
|||
|
|
isAgent bool `json:"is_agent"`
|
|||
|
|
agentID int64 `json:"agent_id"`
|
|||
|
|
region string `json:"region"`
|
|||
|
|
mobile string `json:"mobile"`
|
|||
|
|
isRealName bool `json:"is_real_name"`
|
|||
|
|
}
|
|||
|
|
// 查询代理申请状态响应
|
|||
|
|
AgentAuditStatusResp {
|
|||
|
|
Status int64 `json:"status"` // 0=待审核,1=审核通过,2=审核未通过
|
|||
|
|
AuditReason string `json:"audit_reason"`
|
|||
|
|
}
|
|||
|
|
AgentGeneratingLinkReq {
|
|||
|
|
Product string `json:"product"`
|
|||
|
|
Price string `json:"price"`
|
|||
|
|
}
|
|||
|
|
AgentGeneratingLinkResp {
|
|||
|
|
LinkIdentifier string `json:"link_identifier"`
|
|||
|
|
}
|
|||
|
|
AgentProductConfigResp {
|
|||
|
|
AgentProductConfig []AgentProductConfig
|
|||
|
|
}
|
|||
|
|
AgentRealNameReq {
|
|||
|
|
Name string `json:"name"`
|
|||
|
|
IDCard string `json:"id_card"`
|
|||
|
|
Mobile string `json:"mobile"`
|
|||
|
|
Code string `json:"code"`
|
|||
|
|
}
|
|||
|
|
AgentRealNameResp {
|
|||
|
|
Status string `json:"status"`
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
jwt: JwtAuth
|
|||
|
|
middleware: UserAuthInterceptor
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
@handler GetAgentCommission
|
|||
|
|
get /commission (GetCommissionReq) returns (GetCommissionResp)
|
|||
|
|
|
|||
|
|
@handler GetAgentWithdrawal
|
|||
|
|
get /withdrawal (GetWithdrawalReq) returns (GetWithdrawalResp)
|
|||
|
|
|
|||
|
|
@handler AgentWithdrawal
|
|||
|
|
post /withdrawal (WithdrawalReq) returns (WithdrawalResp)
|
|||
|
|
|
|||
|
|
// 银行卡提现申请
|
|||
|
|
@handler BankCardWithdrawal
|
|||
|
|
post /withdrawal/bank-card (BankCardWithdrawalReq) returns (WithdrawalResp)
|
|||
|
|
|
|||
|
|
// 获取历史银行卡信息
|
|||
|
|
@handler GetBankCardInfo
|
|||
|
|
get /withdrawal/bank-card/info (GetBankCardInfoReq) returns (GetBankCardInfoResp)
|
|||
|
|
|
|||
|
|
// 获取免税额度
|
|||
|
|
@handler GetAgentWithdrawalTaxExemption
|
|||
|
|
get /withdrawal/tax/exemption (GetWithdrawalTaxExemptionReq) returns (GetWithdrawalTaxExemptionResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type (
|
|||
|
|
// 收益信息
|
|||
|
|
GetAgentRevenueInfoReq {}
|
|||
|
|
GetAgentRevenueInfoResp {
|
|||
|
|
Balance float64 `json:"balance"`
|
|||
|
|
FrozenBalance float64 `json:"frozen_balance"`
|
|||
|
|
TotalEarnings float64 `json:"total_earnings"`
|
|||
|
|
DirectPush DirectPushReport `json:"direct_push"` // 直推报告数据
|
|||
|
|
}
|
|||
|
|
// 直推报告数据结构
|
|||
|
|
DirectPushReport {
|
|||
|
|
TotalCommission float64 `json:"total_commission"`
|
|||
|
|
TotalReport int `json:"total_report"`
|
|||
|
|
Today TimeRangeReport `json:"today"` // 近24小时数据
|
|||
|
|
Last7D TimeRangeReport `json:"last7d"` // 近7天数据
|
|||
|
|
Last30D TimeRangeReport `json:"last30d"` // 近30天数据
|
|||
|
|
}
|
|||
|
|
// 通用时间范围报告结构
|
|||
|
|
TimeRangeReport {
|
|||
|
|
Commission float64 `json:"commission"` // 佣金
|
|||
|
|
Report int `json:"report"` // 报告量
|
|||
|
|
}
|
|||
|
|
Commission {
|
|||
|
|
OrderId string `json:"order_id"` // 订单号
|
|||
|
|
ProductName string `json:"product_name"`
|
|||
|
|
Amount float64 `json:"amount"` // 原始佣金金额
|
|||
|
|
RefundedAmount float64 `json:"refunded_amount"` // 已退款佣金金额
|
|||
|
|
NetAmount float64 `json:"net_amount"` // 剩余净佣金金额 = amount - refunded_amount
|
|||
|
|
Status int64 `json:"status"` // 状态:0-已结算,1-冻结中,2-已退款
|
|||
|
|
CreateTime string `json:"create_time"`
|
|||
|
|
QueryParams map[string]interface{} `json:"query_params,omitempty"`
|
|||
|
|
}
|
|||
|
|
GetCommissionReq {
|
|||
|
|
Page int64 `form:"page"` // 页码
|
|||
|
|
PageSize int64 `form:"page_size"` // 每页数据量
|
|||
|
|
}
|
|||
|
|
GetCommissionResp {
|
|||
|
|
Total int64 `json:"total"` // 总记录数
|
|||
|
|
List []Commission `json:"list"` // 查询列表
|
|||
|
|
}
|
|||
|
|
Withdrawal {
|
|||
|
|
Status int64 `json:"status"`
|
|||
|
|
Amount float64 `json:"amount"`
|
|||
|
|
WithdrawalNo string `json:"withdrawal_no"`
|
|||
|
|
Remark string `json:"remark"`
|
|||
|
|
payeeAccount string `json:"payee_account"`
|
|||
|
|
CreateTime string `json:"create_time"`
|
|||
|
|
}
|
|||
|
|
GetWithdrawalReq {
|
|||
|
|
Page int64 `form:"page"` // 页码
|
|||
|
|
PageSize int64 `form:"page_size"` // 每页数据量
|
|||
|
|
}
|
|||
|
|
GetWithdrawalResp {
|
|||
|
|
Total int64 `json:"total"` // 总记录数
|
|||
|
|
List []Withdrawal `json:"list"` // 查询列表
|
|||
|
|
}
|
|||
|
|
WithdrawalReq {
|
|||
|
|
Amount float64 `json:"amount"` // 提现金额
|
|||
|
|
payeeAccount string `json:"payee_account"`
|
|||
|
|
payeeName string `json:"payee_name"`
|
|||
|
|
}
|
|||
|
|
WithdrawalResp {
|
|||
|
|
Status int64 `json:"status"` // 1申请中 2成功 3失败
|
|||
|
|
failMsg string `json:"fail_msg"`
|
|||
|
|
}
|
|||
|
|
// 银行卡提现申请请求
|
|||
|
|
BankCardWithdrawalReq {
|
|||
|
|
BankCardNo string `json:"bank_card_no"` // 银行卡号
|
|||
|
|
BankName string `json:"bank_name"` // 开户支行
|
|||
|
|
Amount float64 `json:"amount"` // 提现金额
|
|||
|
|
}
|
|||
|
|
// 获取历史银行卡信息请求
|
|||
|
|
GetBankCardInfoReq {}
|
|||
|
|
// 获取历史银行卡信息响应
|
|||
|
|
GetBankCardInfoResp {
|
|||
|
|
BankCardNo string `json:"bank_card_no"` // 银行卡号
|
|||
|
|
BankName string `json:"bank_name"` // 开户支行
|
|||
|
|
PayeeName string `json:"payee_name"` // 收款人姓名
|
|||
|
|
IdCard string `json:"id_card"` // 身份证号
|
|||
|
|
}
|
|||
|
|
GetWithdrawalTaxExemptionReq {}
|
|||
|
|
GetWithdrawalTaxExemptionResp {
|
|||
|
|
TotalExemptionAmount float64 `json:"total_exemption_amount"`
|
|||
|
|
UsedExemptionAmount float64 `json:"used_exemption_amount"`
|
|||
|
|
RemainingExemptionAmount float64 `json:"remaining_exemption_amount"`
|
|||
|
|
TaxRate float64 `json:"tax_rate"`
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
prefix: api/v1/agent
|
|||
|
|
group: agent
|
|||
|
|
middleware: AuthInterceptor
|
|||
|
|
)
|
|||
|
|
service main {
|
|||
|
|
// 提交代理申请
|
|||
|
|
@handler ApplyForAgent
|
|||
|
|
post /apply (AgentApplyReq) returns (AgentApplyResp)
|
|||
|
|
|
|||
|
|
// 获取推广标识数据
|
|||
|
|
@handler GetLinkData
|
|||
|
|
get /link (GetLinkDataReq) returns (GetLinkDataResp)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type (
|
|||
|
|
// 代理申请请求参数
|
|||
|
|
AgentApplyReq {
|
|||
|
|
Region string `json:"region"`
|
|||
|
|
Mobile string `json:"mobile"`
|
|||
|
|
Code string `json:"code"`
|
|||
|
|
Ancestor string `json:"ancestor,optional"`
|
|||
|
|
}
|
|||
|
|
AgentApplyResp {
|
|||
|
|
AccessToken string `json:"accessToken"`
|
|||
|
|
AccessExpire int64 `json:"accessExpire"`
|
|||
|
|
RefreshAfter int64 `json:"refreshAfter"`
|
|||
|
|
}
|
|||
|
|
GetLinkDataReq {
|
|||
|
|
LinkIdentifier string `form:"link_identifier"`
|
|||
|
|
}
|
|||
|
|
GetLinkDataResp {
|
|||
|
|
Product
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
|