Files
nl-video-api/api/v1/vip_level.go
2025-08-03 00:11:15 +08:00

228 lines
8.8 KiB
Go
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.
package v1
// VIP等级管理相关请求和响应结构
// VipLevelCreateReq 创建VIP等级请求
type VipLevelCreateReq struct {
Name string `json:"name" v:"required|length:1,50#VIP等级名称不能为空|VIP等级名称长度为1-50个字符"`
Level int `json:"level" v:"required|min:1#VIP等级不能为空|VIP等级必须大于0"`
Duration int `json:"duration" v:"required|min:1#有效期不能为空|有效期必须大于0天"`
Price string `json:"price" v:"required|regex:^\\d+(\\.\\d{1,2})?$#价格不能为空|价格格式不正确"`
Description string `json:"description" v:"max:500#描述长度不能超过500个字符"`
Features string `json:"features" v:"max:1000#特权描述长度不能超过1000个字符"`
Sort int `json:"sort" v:"min:0#排序值不能小于0"`
Status int `json:"status" v:"in:0,1#状态值只能为0或1"`
}
// VipLevelCreateRes 创建VIP等级响应
type VipLevelCreateRes struct {
Id uint `json:"id"`
}
// VipLevelUpdateReq 更新VIP等级请求
type VipLevelUpdateReq struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
Name string `json:"name" v:"required|length:1,50#VIP等级名称不能为空|VIP等级名称长度为1-50个字符"`
Level int `json:"level" v:"required|min:1#VIP等级不能为空|VIP等级必须大于0"`
Duration int `json:"duration" v:"required|min:1#有效期不能为空|有效期必须大于0天"`
Price string `json:"price" v:"required|regex:^\\d+(\\.\\d{1,2})?$#价格不能为空|价格格式不正确"`
Description string `json:"description" v:"max:500#描述长度不能超过500个字符"`
Features string `json:"features" v:"max:1000#特权描述长度不能超过1000个字符"`
Sort int `json:"sort" v:"min:0#排序值不能小于0"`
Status int `json:"status" v:"in:0,1#状态值只能为0或1"`
}
// VipLevelListReq 获取VIP等级列表请求
type VipLevelListReq struct {
Page int `json:"page" v:"min:1#页码必须大于0"`
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100"`
Status int `json:"status" v:"in:-1,0,1#状态值只能为-1,0,1"`
Keyword string `json:"keyword" v:"max:50#关键词长度不能超过50个字符"`
MinPrice string `json:"min_price" v:"regex:^\\d*(\\.\\d{1,2})?$#最低价格格式不正确"`
MaxPrice string `json:"max_price" v:"regex:^\\d*(\\.\\d{1,2})?$#最高价格格式不正确"`
}
// VipLevelListRes 获取VIP等级列表响应
type VipLevelListRes struct {
List []VipLevelItem `json:"list"`
Total int `json:"total"`
Page int `json:"page"`
Size int `json:"size"`
}
// VipLevelItem VIP等级列表项
type VipLevelItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
Duration int `json:"duration"`
Price string `json:"price"`
Description string `json:"description"`
Features string `json:"features"`
Sort int `json:"sort"`
Status int `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// VipLevelDetailReq 获取VIP等级详情请求
type VipLevelDetailReq struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
}
// VipLevelDetailRes 获取VIP等级详情响应
type VipLevelDetailRes struct {
VipLevel VipLevelDetail `json:"vip_level"`
}
// VipLevelDetail VIP等级详情
type VipLevelDetail struct {
Id uint `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
Duration int `json:"duration"`
Price string `json:"price"`
Description string `json:"description"`
Features string `json:"features"`
Sort int `json:"sort"`
Status int `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// VipLevelDeleteReq 删除VIP等级请求
type VipLevelDeleteReq struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
}
// VipLevelStatusReq 更新VIP等级状态请求
type VipLevelStatusReq struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
Status int `json:"status" v:"in:0,1#状态值只能为0或1"`
}
// VipLevelBatchStatusReq 批量更新VIP等级状态请求
type VipLevelBatchStatusReq struct {
Ids []uint `json:"ids" v:"required|min:1#VIP等级ID列表不能为空"`
Status int `json:"status" v:"in:0,1#状态值只能为0或1"`
}
// VipLevelSortReq 更新VIP等级排序请求
type VipLevelSortReq struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
Sort int `json:"sort" v:"min:0#排序值不能小于0"`
}
// VipLevelBatchSortReq 批量更新VIP等级排序请求
type VipLevelBatchSortReq struct {
Items []VipLevelSortItem `json:"items" v:"required|min:1#排序项目不能为空"`
}
// VipLevelSortItem 排序项目
type VipLevelSortItem struct {
Id uint `json:"id" v:"required|min:1#VIP等级ID不能为空"`
Sort int `json:"sort" v:"min:0#排序值不能小于0"`
}
// VipLevelActiveListReq 获取有效VIP等级列表请求用户端
type VipLevelActiveListReq struct {
// 无需参数直接获取所有有效的VIP等级
}
// VipLevelActiveListRes 获取有效VIP等级列表响应用户端
type VipLevelActiveListRes struct {
List []VipLevelActiveItem `json:"list"`
}
// VipLevelActiveItem 有效VIP等级项用户端
type VipLevelActiveItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
Duration int `json:"duration"`
Price string `json:"price"`
Description string `json:"description"`
Features string `json:"features"`
IsRecommend bool `json:"is_recommend"` // 是否推荐
}
// VipLevelStatisticsReq 获取VIP等级统计请求
type VipLevelStatisticsReq struct {
StartDate string `json:"start_date" v:"date#开始日期格式不正确"`
EndDate string `json:"end_date" v:"date#结束日期格式不正确"`
}
// VipLevelStatisticsRes 获取VIP等级统计响应
type VipLevelStatisticsRes struct {
TotalLevels int `json:"total_levels"` // 总等级数
ActiveLevels int `json:"active_levels"` // 有效等级数
TotalSales string `json:"total_sales"` // 总销售额
TotalOrders int `json:"total_orders"` // 总订单数
LevelStats []VipLevelStatItem `json:"level_stats"` // 各等级统计
SalesChart []VipLevelSalesChartItem `json:"sales_chart"` // 销售图表数据
PopularLevels []VipLevelPopularItem `json:"popular_levels"` // 热门等级
}
// VipLevelStatItem VIP等级统计项
type VipLevelStatItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
OrderCount int `json:"order_count"` // 订单数量
SalesAmount string `json:"sales_amount"` // 销售金额
UserCount int `json:"user_count"` // 用户数量
}
// VipLevelSalesChartItem VIP等级销售图表项
type VipLevelSalesChartItem struct {
Date string `json:"date"` // 日期
Amount string `json:"amount"` // 销售金额
Count int `json:"count"` // 订单数量
}
// VipLevelPopularItem 热门VIP等级项
type VipLevelPopularItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
Price string `json:"price"`
OrderCount int `json:"order_count"`
Percentage string `json:"percentage"` // 占比
}
// VipLevelCopyReq 复制VIP等级请求
type VipLevelCopyReq struct {
SourceId uint `json:"source_id" v:"required|min:1#源VIP等级ID不能为空"`
Name string `json:"name" v:"required|length:1,50#VIP等级名称不能为空|VIP等级名称长度为1-50个字符"`
Level int `json:"level" v:"required|min:1#VIP等级不能为空|VIP等级必须大于0"`
}
// VipLevelCopyRes 复制VIP等级响应
type VipLevelCopyRes struct {
Id uint `json:"id"`
}
// VipLevelExportReq 导出VIP等级请求
type VipLevelExportReq struct {
Status int `json:"status" v:"in:-1,0,1#状态值只能为-1,0,1"`
StartDate string `json:"start_date" v:"date#开始日期格式不正确"`
EndDate string `json:"end_date" v:"date#结束日期格式不正确"`
}
// VipLevelExportRes 导出VIP等级响应
type VipLevelExportRes struct {
FileUrl string `json:"file_url"` // 导出文件URL
}
// VipLevelImportReq 导入VIP等级请求
type VipLevelImportReq struct {
FileUrl string `json:"file_url" v:"required|url#文件URL不能为空|文件URL格式不正确"`
}
// VipLevelImportRes 导入VIP等级响应
type VipLevelImportRes struct {
SuccessCount int `json:"success_count"` // 成功导入数量
FailCount int `json:"fail_count"` // 失败数量
FailReasons []string `json:"fail_reasons"` // 失败原因
}