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 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 GetAgentSubordinateList get /subordinate/list (GetAgentSubordinateListReq) returns (GetAgentSubordinateListResp) // 下级贡献详情 @handler GetAgentSubordinateContributionDetail get /subordinate/contribution/detail (GetAgentSubordinateContributionDetailReq) returns (GetAgentSubordinateContributionDetailResp) @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"` level string `json:"level"` region string `json:"region"` mobile string `json:"mobile"` expiryTime string `json:"expiry_time"` 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"` ShowPrice int64 `json:"show_price"` } AgentGeneratingLinkResp { LinkIdentifier string `json:"link_identifier"` } AgentProductConfigResp { AgentProductConfig []AgentProductConfig } GetAgentSubordinateListReq { Page int64 `form:"page"` // 页码 PageSize int64 `form:"page_size"` // 每页数据量 } GetAgentSubordinateListResp { Total int64 `json:"total"` // 总记录数 List []AgentSubordinateList `json:"list"` // 查询列表 } AgentSubordinateList { ID int64 `json:"id"` Mobile string `json:"mobile"` CreateTime string `json:"create_time"` LevelName string `json:"level_name"` TotalOrders int64 `json:"total_orders"` // 总单量 TotalEarnings float64 `json:"total_earnings"` // 总金额 TotalContribution float64 `json:"total_contribution"` // 总贡献 } GetAgentSubordinateContributionDetailReq { Page int64 `form:"page"` // 页码 PageSize int64 `form:"page_size"` // 每页数据量 SubordinateID int64 `form:"subordinate_id"` // 下级ID } GetAgentSubordinateContributionDetailResp { Mobile string `json:"mobile"` Total int64 `json:"total"` // 总记录数 CreateTime string `json:"create_time"` TotalEarnings float64 `json:"total_earnings"` // 总金额 TotalContribution float64 `json:"total_contribution"` // 总贡献 TotalOrders int64 `json:"total_orders"` // 总单量 LevelName string `json:"level_name"` // 等级名称 List []AgentSubordinateContributionDetail `json:"list"` // 查询列表 Stats AgentSubordinateContributionStats `json:"stats"` // 统计数据 } AgentSubordinateContributionDetail { ID int64 `json:"id"` CreateTime string `json:"create_time"` Amount float64 `json:"amount"` Type string `json:"type"` } AgentSubordinateContributionStats { CostCount int64 `json:"cost_count"` // 成本扣除次数 CostAmount float64 `json:"cost_amount"` // 成本扣除总额 PricingCount int64 `json:"pricing_count"` // 定价扣除次数 PricingAmount float64 `json:"pricing_amount"` // 定价扣除总额 DescendantPromotionCount int64 `json:"descendant_promotion_count"` // 下级推广次数 DescendantPromotionAmount float64 `json:"descendant_promotion_amount"` // 下级推广总额 DescendantUpgradeVipCount int64 `json:"descendant_upgrade_vip_count"` // 下级升级VIP次数 DescendantUpgradeVipAmount float64 `json:"descendant_upgrade_vip_amount"` // 下级升级VIP总额 DescendantUpgradeSvipCount int64 `json:"descendant_upgrade_svip_count"` // 下级升级SVIP次数 DescendantUpgradeSvipAmount float64 `json:"descendant_upgrade_svip_amount"` // 下级升级SVIP总额 DescendantStayActiveCount int64 `json:"descendant_stay_active_count"` // 下级保持活跃次数 DescendantStayActiveAmount float64 `json:"descendant_stay_active_amount"` // 下级保持活跃总额 DescendantNewActiveCount int64 `json:"descendant_new_active_count"` // 下级新增活跃次数 DescendantNewActiveAmount float64 `json:"descendant_new_active_amount"` // 下级新增活跃总额 DescendantWithdrawCount int64 `json:"descendant_withdraw_count"` // 下级提现次数 DescendantWithdrawAmount float64 `json:"descendant_withdraw_amount"` // 下级提现总额 } 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 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 middleware: UserAuthInterceptor ) service main { @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) @handler ActivateAgentMembership post /membership/activate (AgentActivateMembershipReq) returns (AgentActivateMembershipResp) } 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"` } // 开通代理会员请求参数 AgentActivateMembershipReq { Type string `json:"type,oneof=VIP SVIP"` // 会员类型:vip/svip } // 开通代理会员响应 AgentActivateMembershipResp { Id string `json:"id"` } ) @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 { ShowPrice int64 `json:"show_price"` Product } )