173 lines
8.4 KiB
Go
173 lines
8.4 KiB
Go
package v1
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// BannerListReq 轮播图列表请求
|
|
type BannerListReq struct {
|
|
g.Meta `path:"/banner/list" method:"get" summary:"轮播图列表" tags:"轮播图管理"`
|
|
Position int `json:"position" v:"min:0#位置必须大于等于0" dc:"位置(0:全部,1:首页,2:分类页,3:详情页)" default:"0"`
|
|
Status int `json:"status" v:"in:-1,0,1#状态值错误" dc:"状态(-1:全部,0:禁用,1:启用)" default:"-1"`
|
|
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
|
|
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
|
|
}
|
|
|
|
// BannerListRes 轮播图列表响应
|
|
type BannerListRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
List []BannerItem `json:"list" dc:"轮播图列表"`
|
|
Total int `json:"total" dc:"总数"`
|
|
Page int `json:"page" dc:"当前页"`
|
|
Size int `json:"size" dc:"每页数量"`
|
|
}
|
|
|
|
// BannerItem 轮播图项目
|
|
type BannerItem struct {
|
|
Id uint `json:"id" dc:"轮播图ID"`
|
|
Title string `json:"title" dc:"标题"`
|
|
Image string `json:"image" dc:"图片地址"`
|
|
Link string `json:"link" dc:"链接地址"`
|
|
Position int `json:"position" dc:"位置"`
|
|
Sort int `json:"sort" dc:"排序"`
|
|
Status int `json:"status" dc:"状态"`
|
|
StartTime string `json:"start_time" dc:"开始时间"`
|
|
EndTime string `json:"end_time" dc:"结束时间"`
|
|
ClickCount int `json:"click_count" dc:"点击次数"`
|
|
Description string `json:"description" dc:"描述"`
|
|
CreatedAt string `json:"created_at" dc:"创建时间"`
|
|
}
|
|
|
|
// AdminBannerCreateReq 管理员创建轮播图请求
|
|
type AdminBannerCreateReq struct {
|
|
g.Meta `path:"/admin/banner/create" method:"post" summary:"创建轮播图" tags:"轮播图管理"`
|
|
Title string `json:"title" v:"required|length:1,100#标题不能为空|标题长度为1-100字符" dc:"标题"`
|
|
Image string `json:"image" v:"required|url#图片地址不能为空|图片地址格式错误" dc:"图片地址"`
|
|
Link string `json:"link" v:"url#链接地址格式错误" dc:"链接地址"`
|
|
Position int `json:"position" v:"required|in:1,2,3#位置不能为空|位置值错误" dc:"位置(1:首页,2:分类页,3:详情页)"`
|
|
Sort int `json:"sort" v:"min:0#排序必须大于等于0" dc:"排序" default:"0"`
|
|
Status int `json:"status" v:"in:0,1#状态值错误" dc:"状态(0:禁用,1:启用)" default:"1"`
|
|
StartTime string `json:"start_time" v:"datetime#开始时间格式错误" dc:"开始时间"`
|
|
EndTime string `json:"end_time" v:"datetime#结束时间格式错误" dc:"结束时间"`
|
|
Description string `json:"description" v:"length:0,500#描述长度不能超过500字符" dc:"描述"`
|
|
}
|
|
|
|
// AdminBannerCreateRes 管理员创建轮播图响应
|
|
type AdminBannerCreateRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
Id uint `json:"id" dc:"轮播图ID"`
|
|
}
|
|
|
|
// AdminBannerUpdateReq 管理员更新轮播图请求
|
|
type AdminBannerUpdateReq struct {
|
|
g.Meta `path:"/admin/banner/update" method:"post" summary:"更新轮播图" tags:"轮播图管理"`
|
|
Id uint `json:"id" v:"required|min:1#轮播图ID不能为空|轮播图ID必须大于0" dc:"轮播图ID"`
|
|
Title string `json:"title" v:"required|length:1,100#标题不能为空|标题长度为1-100字符" dc:"标题"`
|
|
Image string `json:"image" v:"required|url#图片地址不能为空|图片地址格式错误" dc:"图片地址"`
|
|
Link string `json:"link" v:"url#链接地址格式错误" dc:"链接地址"`
|
|
Position int `json:"position" v:"required|in:1,2,3#位置不能为空|位置值错误" dc:"位置(1:首页,2:分类页,3:详情页)"`
|
|
Sort int `json:"sort" v:"min:0#排序必须大于等于0" dc:"排序"`
|
|
Status int `json:"status" v:"in:0,1#状态值错误" dc:"状态(0:禁用,1:启用)"`
|
|
StartTime string `json:"start_time" v:"datetime#开始时间格式错误" dc:"开始时间"`
|
|
EndTime string `json:"end_time" v:"datetime#结束时间格式错误" dc:"结束时间"`
|
|
Description string `json:"description" v:"length:0,500#描述长度不能超过500字符" dc:"描述"`
|
|
}
|
|
|
|
// AdminBannerUpdateRes 管理员更新轮播图响应
|
|
type AdminBannerUpdateRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
}
|
|
|
|
// AdminBannerDeleteReq 管理员删除轮播图请求
|
|
type AdminBannerDeleteReq struct {
|
|
g.Meta `path:"/admin/banner/delete" method:"post" summary:"删除轮播图" tags:"轮播图管理"`
|
|
Id uint `json:"id" v:"required|min:1#轮播图ID不能为空|轮播图ID必须大于0" dc:"轮播图ID"`
|
|
}
|
|
|
|
// AdminBannerDeleteRes 管理员删除轮播图响应
|
|
type AdminBannerDeleteRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
}
|
|
|
|
// AdminBannerDetailReq 管理员轮播图详情请求
|
|
type AdminBannerDetailReq struct {
|
|
g.Meta `path:"/admin/banner/detail" method:"get" summary:"轮播图详情" tags:"轮播图管理"`
|
|
Id uint `json:"id" v:"required|min:1#轮播图ID不能为空|轮播图ID必须大于0" dc:"轮播图ID"`
|
|
}
|
|
|
|
// AdminBannerDetailRes 管理员轮播图详情响应
|
|
type AdminBannerDetailRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
Banner BannerItem `json:"banner" dc:"轮播图详情"`
|
|
}
|
|
|
|
// AdminBannerListReq 管理员轮播图列表请求
|
|
type AdminBannerListReq struct {
|
|
g.Meta `path:"/admin/banner/list" method:"get" summary:"管理员轮播图列表" tags:"轮播图管理"`
|
|
Position int `json:"position" v:"min:0#位置必须大于等于0" dc:"位置(0:全部,1:首页,2:分类页,3:详情页)" default:"0"`
|
|
Status int `json:"status" v:"in:-1,0,1#状态值错误" dc:"状态(-1:全部,0:禁用,1:启用)" default:"-1"`
|
|
Keyword string `json:"keyword" dc:"关键词搜索"`
|
|
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
|
|
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
|
|
}
|
|
|
|
// AdminBannerListRes 管理员轮播图列表响应
|
|
type AdminBannerListRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
List []AdminBannerItem `json:"list" dc:"轮播图列表"`
|
|
Total int `json:"total" dc:"总数"`
|
|
Page int `json:"page" dc:"当前页"`
|
|
Size int `json:"size" dc:"每页数量"`
|
|
}
|
|
|
|
// AdminBannerItem 管理员轮播图项目
|
|
type AdminBannerItem struct {
|
|
Id uint `json:"id" dc:"轮播图ID"`
|
|
Title string `json:"title" dc:"标题"`
|
|
Image string `json:"image" dc:"图片地址"`
|
|
Link string `json:"link" dc:"链接地址"`
|
|
Position int `json:"position" dc:"位置"`
|
|
Sort int `json:"sort" dc:"排序"`
|
|
Status int `json:"status" dc:"状态"`
|
|
StartTime string `json:"start_time" dc:"开始时间"`
|
|
EndTime string `json:"end_time" dc:"结束时间"`
|
|
ClickCount int `json:"click_count" dc:"点击次数"`
|
|
Description string `json:"description" dc:"描述"`
|
|
CreatedAt string `json:"created_at" dc:"创建时间"`
|
|
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
|
}
|
|
|
|
// AdminBannerUpdateStatusReq 管理员更新轮播图状态请求
|
|
type AdminBannerUpdateStatusReq struct {
|
|
g.Meta `path:"/admin/banner/status" method:"post" summary:"更新轮播图状态" tags:"轮播图管理"`
|
|
Id uint `json:"id" v:"required|min:1#轮播图ID不能为空|轮播图ID必须大于0" dc:"轮播图ID"`
|
|
Status int `json:"status" v:"required|in:0,1#状态不能为空|状态值错误" dc:"状态(0:禁用,1:启用)"`
|
|
}
|
|
|
|
// AdminBannerUpdateStatusRes 管理员更新轮播图状态响应
|
|
type AdminBannerUpdateStatusRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
}
|
|
|
|
// AdminBannerBatchDeleteReq 管理员批量删除轮播图请求
|
|
type AdminBannerBatchDeleteReq struct {
|
|
g.Meta `path:"/admin/banner/batch-delete" method:"post" summary:"批量删除轮播图" tags:"轮播图管理"`
|
|
Ids []uint `json:"ids" v:"required|length:1,100#轮播图ID列表不能为空|最多选择100条记录" dc:"轮播图ID列表"`
|
|
}
|
|
|
|
// AdminBannerBatchDeleteRes 管理员批量删除轮播图响应
|
|
type AdminBannerBatchDeleteRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
}
|
|
|
|
// BannerClickReq 轮播图点击请求
|
|
type BannerClickReq struct {
|
|
g.Meta `path:"/banner/click" method:"post" summary:"轮播图点击" tags:"轮播图管理"`
|
|
Id uint `json:"id" v:"required|min:1#轮播图ID不能为空|轮播图ID必须大于0" dc:"轮播图ID"`
|
|
}
|
|
|
|
// BannerClickRes 轮播图点击响应
|
|
type BannerClickRes struct {
|
|
g.Meta `mime:"application/json"`
|
|
}
|