288 lines
8.6 KiB
Plaintext
288 lines
8.6 KiB
Plaintext
syntax = "v1"
|
||
|
||
info (
|
||
title: "代理服务"
|
||
desc: "代理服务接口"
|
||
author: "Liangzai"
|
||
email: "2440983361@qq.com"
|
||
version: "v1"
|
||
)
|
||
|
||
// 代理服务基本类型定义
|
||
type AgentProductConfig {
|
||
ProductID int64 `json:"product_id"`
|
||
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"`
|
||
APricingStandard float64 `json:"a_pricing_standard"`
|
||
APricingEnd float64 `json:"a_pricing_end"`
|
||
AOverpricingRatio float64 `json:"a_overpricing_ratio"`
|
||
}
|
||
|
||
type AgentMembershipUserConfig {
|
||
ProductID int64 `json:"product_id"`
|
||
PriceIncreaseAmount float64 `json:"price_increase_amount"`
|
||
PriceRangeFrom float64 `json:"price_range_from"`
|
||
PriceRangeTo float64 `json:"price_range_to"`
|
||
PriceRatio float64 `json:"price_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 GetAgentAuditStatus
|
||
get /audit/status returns (AgentAuditStatusResp)
|
||
|
||
// 生成推广标识
|
||
@handler GeneratingLink
|
||
post /generating_link (AgentGeneratingLinkReq) returns (AgentGeneratingLinkResp)
|
||
|
||
// 获取推广定价配置
|
||
@handler GetAgentProductConfig
|
||
get /product_config returns (AgentProductConfigResp)
|
||
}
|
||
|
||
type (
|
||
AgentInfoResp {
|
||
status int64 `json:"status"` // 0=待审核,1=审核通过,2=审核未通过,3=未申请
|
||
isAgent bool `json:"is_agent"`
|
||
agentID int64 `json:"agent_id"`
|
||
level string `json:"level"`
|
||
region string `json:"region"`
|
||
mobile string `json:"mobile"`
|
||
wechatID string `json:"wechat_id"`
|
||
}
|
||
// 查询代理申请状态响应
|
||
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
|
||
}
|
||
)
|
||
|
||
@server (
|
||
prefix: api/v1/agent
|
||
group: agent
|
||
jwt: JwtAuth
|
||
)
|
||
service main {
|
||
@handler GetAgentMembershipProductConfig
|
||
get /membership/user_config (AgentMembershipProductConfigReq) returns (AgentMembershipProductConfigResp)
|
||
|
||
@handler SaveAgentMembershipUserConfig
|
||
post /membership/save_user_config (SaveAgentMembershipUserConfigReq)
|
||
}
|
||
|
||
type (
|
||
// 获取会员当前配置
|
||
AgentMembershipProductConfigReq {
|
||
ProductID int64 `form:"product_id"`
|
||
}
|
||
// 获取会员当前配置
|
||
AgentMembershipProductConfigResp {
|
||
AgentMembershipUserConfig AgentMembershipUserConfig `json:"agent_membership_user_config"`
|
||
ProductConfig ProductConfig `json:"product_config"`
|
||
PriceIncreaseMax float64 `json:"price_increase_max"`
|
||
PriceIncreaseAmount float64 `json:"price_increase_amount"`
|
||
PriceRatio float64 `json:"price_ratio"`
|
||
}
|
||
SaveAgentMembershipUserConfigReq {
|
||
ProductID int64 `json:"product_id"`
|
||
PriceIncreaseAmount float64 `json:"price_increase_amount"`
|
||
PriceRangeFrom float64 `json:"price_range_from"`
|
||
PriceRangeTo float64 `json:"price_range_to"`
|
||
PriceRatio float64 `json:"price_ratio"`
|
||
}
|
||
)
|
||
|
||
@server (
|
||
prefix: api/v1/agent
|
||
group: agent
|
||
jwt: JwtAuth
|
||
)
|
||
service main {
|
||
@handler GetAgentRevenueInfo
|
||
get /revenue (GetAgentRevenueInfoReq) returns (GetAgentRevenueInfoResp)
|
||
|
||
@handler GetAgentCommission
|
||
get /commission (GetCommissionReq) returns (GetCommissionResp)
|
||
|
||
@handler GetAgentRewards
|
||
get /rewards (GetRewardsReq) returns (GetRewardsResp)
|
||
|
||
@handler GetAgentWithdrawal
|
||
get /withdrawal (GetWithdrawalReq) returns (GetWithdrawalResp)
|
||
|
||
@handler AgentWithdrawal
|
||
post /withdrawal (WithdrawalReq) returns (WithdrawalResp)
|
||
}
|
||
|
||
type (
|
||
// 收益信息
|
||
GetAgentRevenueInfoReq {}
|
||
GetAgentRevenueInfoResp {
|
||
Balance float64 `json:"balance"`
|
||
FrozenBalance float64 `json:"frozen_balance"`
|
||
TotalEarnings float64 `json:"total_earnings"`
|
||
DirectPush DirectPushReport `json:"direct_push"` // 直推报告数据
|
||
ActiveReward ActiveReward `json:"active_reward"` // 活跃下级奖励数据
|
||
}
|
||
// 直推报告数据结构
|
||
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天数据
|
||
}
|
||
// 活跃下级奖励数据结构
|
||
ActiveReward {
|
||
TotalReward float64 `json:"total_reward"`
|
||
Today ActiveRewardData `json:"today"` // 今日数据
|
||
Last7D ActiveRewardData `json:"last7d"` // 近7天数据
|
||
Last30D ActiveRewardData `json:"last30d"` // 近30天数据
|
||
}
|
||
// 通用时间范围报告结构
|
||
TimeRangeReport {
|
||
Commission float64 `json:"commission"` // 佣金
|
||
Report int `json:"report"` // 报告量
|
||
}
|
||
// 活跃奖励专用结构
|
||
ActiveRewardData {
|
||
NewActiveReward float64 `json:"active_reward"`
|
||
SubPromoteReward float64 `json:"sub_promote_reward"`
|
||
SubUpgradeReward float64 `json:"sub_upgrade_reward"`
|
||
SubWithdrawReward float64 `json:"sub_withdraw_reward"`
|
||
}
|
||
Commission {
|
||
ProductName string `json:"product_name"`
|
||
Amount float64 `json:"amount"`
|
||
CreateTime string `json:"create_time"`
|
||
}
|
||
GetCommissionReq {
|
||
Page int64 `form:"page"` // 页码
|
||
PageSize int64 `form:"page_size"` // 每页数据量
|
||
}
|
||
GetCommissionResp {
|
||
Total int64 `json:"total"` // 总记录数
|
||
List []Commission `json:"list"` // 查询列表
|
||
}
|
||
Rewards {
|
||
Type string `json:"type"`
|
||
Amount float64 `json:"amount"`
|
||
CreateTime string `json:"create_time"`
|
||
}
|
||
GetRewardsReq {
|
||
Page int64 `form:"page"` // 页码
|
||
PageSize int64 `form:"page_size"` // 每页数据量
|
||
}
|
||
GetRewardsResp {
|
||
Total int64 `json:"total"` // 总记录数
|
||
List []Rewards `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"`
|
||
}
|
||
)
|
||
|
||
@server (
|
||
prefix: api/v1/agent
|
||
group: agent
|
||
)
|
||
service main {
|
||
// 提交代理申请
|
||
@handler ApplyForAgent
|
||
post /apply (AgentApplyReq) returns (AgentApplyResp)
|
||
|
||
// 获取推广标识数据
|
||
@handler GetLinkData
|
||
get /link (GetLinkDataReq) returns (GetLinkDataResp)
|
||
|
||
@handler ActivateAgentMembership
|
||
post /membership/activate (AgentActivateMembershipReq) returns (AgentActivateMembershipResp)
|
||
}
|
||
|
||
type (
|
||
// 代理申请请求参数
|
||
AgentApplyReq {
|
||
Region string `json:"region"`
|
||
Mobile string `json:"mobile"`
|
||
WechatID string `json:"wechat_id"`
|
||
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
|
||
}
|
||
// 开通代理会员请求参数
|
||
AgentActivateMembershipReq {
|
||
Mobile string `json:"mobile"`
|
||
Type string `json:"type,oneof=VIP SVIP"` // 会员类型:vip/svip
|
||
Amount float64 `json:"amount"`
|
||
PaymentMethod string `json:"payment_method"`
|
||
TransactionId string `json:"transaction_id"`
|
||
}
|
||
// 开通代理会员响应
|
||
AgentActivateMembershipResp {
|
||
MembershipType string `json:"membership_type"` // 最终开通的会员类型
|
||
ExpireTime string `json:"expire_time"` // 到期时间
|
||
}
|
||
)
|
||
|