qnc-server-tob/app/main/api/desc/admin/promotion.api
2025-06-09 12:34:52 +08:00

183 lines
5.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "v1"
info (
title: "推广服务"
desc: "推广服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/promotion/link
group: admin_promotion
jwt: JwtAuth
)
service main {
@doc "获取推广链接列表"
@handler GetPromotionLinkList
get /list (GetPromotionLinkListReq) returns (GetPromotionLinkListResp)
@doc "获取推广链接详情"
@handler GetPromotionLinkDetail
get /detail/:id (GetPromotionLinkDetailReq) returns (GetPromotionLinkDetailResp)
@doc "创建推广链接"
@handler CreatePromotionLink
post /create (CreatePromotionLinkReq) returns (CreatePromotionLinkResp)
@doc "更新推广链接"
@handler UpdatePromotionLink
put /update/:id (UpdatePromotionLinkReq) returns (UpdatePromotionLinkResp)
@doc "删除推广链接"
@handler DeletePromotionLink
delete /delete/:id (DeletePromotionLinkReq) returns (DeletePromotionLinkResp)
}
type (
// 列表请求
GetPromotionLinkListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Name string `form:"name,optional"` // 链接名称
Url string `form:"url,optional"` // 推广链接URL
}
// 列表响应
GetPromotionLinkListResp {
Total int64 `json:"total"` // 总数
Items []PromotionLinkItem `json:"items"` // 列表
}
// 列表项
PromotionLinkItem {
Id int64 `json:"id"` // 链接ID
Name string `json:"name"` // 链接名称
Url string `json:"url"` // 推广链接URL
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
PayAmount string `json:"pay_amount"` // 付费金额
CreateTime string `json:"create_time"` // 创建时间
LastClickTime string `json:"last_click_time,optional"` // 最后点击时间
LastPayTime string `json:"last_pay_time,optional"` // 最后付费时间
}
// 详情请求
GetPromotionLinkDetailReq {
Id int64 `path:"id"` // 链接ID
}
// 详情响应
GetPromotionLinkDetailResp {
Name string `json:"name"` // 链接名称
Url string `json:"url"` // 推广链接URL
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
PayAmount string `json:"pay_amount"` // 付费金额
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
LastClickTime string `json:"last_click_time,optional"` // 最后点击时间
LastPayTime string `json:"last_pay_time,optional"` // 最后付费时间
}
// 创建请求
CreatePromotionLinkReq {
Name string `json:"name"` // 链接名称
}
// 创建响应
CreatePromotionLinkResp {
Id int64 `json:"id"` // 链接ID
Url string `json:"url"` // 生成的推广链接URL
}
// 更新请求
UpdatePromotionLinkReq {
Id int64 `path:"id"` // 链接ID
Name *string `json:"name,optional"` // 链接名称
}
// 更新响应
UpdatePromotionLinkResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
DeletePromotionLinkReq {
Id int64 `path:"id"` // 链接ID
}
// 删除响应
DeletePromotionLinkResp {
Success bool `json:"success"` // 是否成功
}
)
@server (
prefix: api/v1/admin/promotion/link
group: admin_promotion
)
service main {
@doc "记录链接点击"
@handler RecordLinkClick
get /record/:path (RecordLinkClickReq) returns (RecordLinkClickResp)
}
type (
// 记录链接点击请求
RecordLinkClickReq {
Path string `path:"path"` // 链接路径
}
// 记录链接点击响应
RecordLinkClickResp {
Success bool `json:"success"` // 是否成功
}
)
@server (
prefix: api/v1/admin/promotion/stats
group: admin_promotion
jwt: JwtAuth
)
service main {
@doc "获取推广历史记录"
@handler GetPromotionStatsHistory
get /history (GetPromotionStatsHistoryReq) returns ([]PromotionStatsHistoryItem)
@doc "获取推广总统计"
@handler GetPromotionStatsTotal
get /total (GetPromotionStatsTotalReq) returns (GetPromotionStatsTotalResp)
}
type (
// 获取推广历史记录请求
GetPromotionStatsHistoryReq {
StartDate string `form:"start_date"` // 开始日期格式YYYY-MM-DD
EndDate string `form:"end_date"` // 结束日期格式YYYY-MM-DD
}
// 推广历史记录项
PromotionStatsHistoryItem {
Id int64 `json:"id"` // 记录ID
LinkId int64 `json:"link_id"` // 链接ID
PayAmount float64 `json:"pay_amount"` // 金额
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
StatsDate string `json:"stats_date"` // 统计日期
}
// 获取推广总统计请求
GetPromotionStatsTotalReq {
}
// 获取推广总统计响应
GetPromotionStatsTotalResp {
TodayPayAmount float64 `json:"today_pay_amount"` // 今日金额
TodayClickCount int64 `json:"today_click_count"` // 今日点击数
TodayPayCount int64 `json:"today_pay_count"` // 今日付费次数
TotalPayAmount float64 `json:"total_pay_amount"` // 总金额
TotalClickCount int64 `json:"total_click_count"` // 总点击数
TotalPayCount int64 `json:"total_pay_count"` // 总付费次数
}
)