新版本,代理功能上线

This commit is contained in:
2025-03-07 03:48:59 +08:00
parent 8ead7a7a67
commit b2d9d828e3
130 changed files with 11004 additions and 2209 deletions

View File

@@ -0,0 +1,75 @@
syntax = "v1"
info (
title: "代理服务"
desc: "代理服务接口"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
import (
"agent/agent.api"
)
@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)
@handler GetAgentMembershipProductConfig
get /membership/user_config (AgentMembershipProductConfigReq) returns (AgentMembershipProductConfigResp)
@handler SaveAgentMembershipUserConfig
post /membership/save_user_config (SaveAgentMembershipUserConfigReq)
@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)
}
@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)
}

View File

@@ -0,0 +1,211 @@
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"`
}
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"`
}
// 代理申请请求参数
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"`
}
// 查询代理申请状态响应
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"`
}
GetLinkDataReq {
LinkIdentifier string `form:"link_identifier"`
}
GetLinkDataResp {
Product
}
AgentProductConfigResp {
AgentProductConfig []AgentProductConfig
}
// 开通代理会员请求参数
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"` // 到期时间
}
// 获取会员当前配置
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"`
}
)
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"`
}
)
type (
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"` // 查询列表
}
)
type (
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"`
}
)

View File

@@ -10,7 +10,7 @@ info (
type (
sendSmsReq {
Mobile string `json:"mobile" validate:"required,mobile"`
ActionType string `json:"actionType" validate:"required,oneof=login register query"`
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply"`
}
)

View File

@@ -12,3 +12,4 @@ import "user.api"
import "query.api"
import "pay.api"
import "product.api"
import "agent.api"

View File

@@ -13,6 +13,16 @@ import (
)
//============================> query v1 <============================
@server (
prefix: api/v1
group: query
)
service main {
@doc "query service agent"
@handler queryServiceAgent
post /query/service_agent/:product (QueryServiceReq) returns (QueryServiceResp)
}
@server (
prefix: api/v1
group: query
@@ -22,42 +32,10 @@ service main {
@doc "query service"
@handler queryService
post /query/service/:product (QueryServiceReq) returns (QueryServiceResp)
@doc "query marriage"
@handler marriage
post /query/marriage (QueryReq) returns (QueryResp)
// 家政服务查询
@doc "query home service"
@handler homeService
post /query/homeService (QueryReq) returns (QueryResp)
// 风险评估查询
@doc "query risk assessment"
@handler riskAssessment
post /query/riskAssessment (QueryReq) returns (QueryResp)
// 企业信息查询
@doc "query company info"
@handler companyInfo
post /query/companyInfo (QueryReq) returns (QueryResp)
// 租赁信息查询
@doc "query rental info"
@handler rentalInfo
post /query/rentalInfo (QueryReq) returns (QueryResp)
// 贷前背景调查
@doc "query pre-loan background check"
@handler preLoanBackgroundCheck
post /query/preLoanBackgroundCheck (QueryReq) returns (QueryResp)
// 一般背景调查
@doc "query general background check"
@handler backgroundCheck
post /query/backgroundCheck (QueryReq) returns (QueryResp)
}
@server (
prefix: api/v1
group: query

View File

@@ -18,11 +18,15 @@ type (
type (
QueryServiceReq {
Product string `path:"product"`
Data string `json:"data" validate:"required"`
Product string `path:"product"`
Data string `json:"data" validate:"required"`
AgentIdentifier string `json:"agent_identifier,optional"`
}
QueryServiceResp {
id string `json:"id"`
id string `json:"id"`
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
)

View File

@@ -32,11 +32,14 @@ service main {
@handler mobileCodeLogin
post /user/mobileCodeLogin (MobileCodeLoginReq) returns (MobileCodeLoginResp)
@doc "agent mobile code login"
@handler agentMobileCodeLogin
post /user/agent_mobile_code_login (MobileCodeLoginReq) returns (MobileCodeLoginResp)
@doc "wechat mini auth"
@handler wxMiniAuth
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
@doc "wechat h5 auth"
@handler wxH5Auth
post /user/wxh5Auth (WXH5AuthReq) returns (WXH5AuthResp)
@@ -51,11 +54,11 @@ service main {
service main {
@doc "get user info"
@handler detail
get /user/detail returns (UserInfoResp)
get /user/detail returns (UserInfoResp)
@doc "get new token"
@handler getToken
post /user/getToken returns (MobileCodeLoginResp)
@doc "get new token"
@handler getToken
post /user/getToken returns (MobileCodeLoginResp)
}
//============================> auth v1 <============================
@@ -69,8 +72,6 @@ service main {
post /auth/sendSms (sendSmsReq)
}
//============================> notification v1 <============================
@server (
prefix: api/v1
@@ -80,4 +81,5 @@ service main {
@doc "get notifications"
@handler getNotifications
get /notification/list returns (GetNotificationsResp)
}
}

View File

@@ -62,9 +62,10 @@ type (
RefreshAfter int64 `json:"refreshAfter"`
}
)
type (
WXH5AuthReq {
Code string `json:"code"`
Code string `json:"code"`
}
WXH5AuthResp {
AccessToken string `json:"accessToken"`
@@ -72,6 +73,7 @@ type (
RefreshAfter int64 `json:"refreshAfter"`
}
)
type (
UserInfoResp {
UserInfo User `json:"userInfo"`
@@ -80,18 +82,20 @@ type (
//============================> notification v1 <============================
type Notification {
Title string `json:"title"` // 通知标题
Content string `json:"content"` // 通知内容 (富文本)
NotificationPage string `json:"notificationPage"` // 通知页面
StartDate string `json:"startDate"` // 通知开始日期,格式 "YYYY-MM-DD"
EndDate string `json:"endDate"` // 通知结束日期,格式 "YYYY-MM-DD"
StartTime string `json:"startTime"` // 每天通知开始时间,格式 "HH:MM:SS"
EndTime string `json:"endTime"` // 每天通知结束时间,格式 "HH:MM:SS"
Title string `json:"title"` // 通知标题
Content string `json:"content"` // 通知内容 (富文本)
NotificationPage string `json:"notificationPage"` // 通知页面
StartDate string `json:"startDate"` // 通知开始日期,格式 "YYYY-MM-DD"
EndDate string `json:"endDate"` // 通知结束日期,格式 "YYYY-MM-DD"
StartTime string `json:"startTime"` // 每天通知开始时间,格式 "HH:MM:SS"
EndTime string `json:"endTime"` // 每天通知结束时间,格式 "HH:MM:SS"
}
type (
// 获取通知响应体(分页)
GetNotificationsResp {
Notifications []Notification `json:"notifications"` // 通知列表
Total int64 `json:"total"` // 总记录数
Total int64 `json:"total"` // 总记录数
}
)
)