103 lines
4.7 KiB
Go
103 lines
4.7 KiB
Go
|
|
// Package dto - 产品DTO
|
|||
|
|
// 功能:产品的增删改查、导入/导出、绑定/解绑客服账号的请求响应结构体
|
|||
|
|
package dto
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"customer-server/model/entity"
|
|||
|
|
|
|||
|
|
"gitea.com/red-future/common/beans"
|
|||
|
|
"github.com/gogf/gf/v2/frame/g"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// AddProductReq 添加产品
|
|||
|
|
type AddProductReq struct {
|
|||
|
|
g.Meta `path:"/add" method:"post" tags:"产品管理" summary:"添加产品" dc:"创建新的产品信息"` // 路由: POST /product/add
|
|||
|
|
Name string `json:"name" v:"required"` // 产品名称
|
|||
|
|
Description string `json:"description"` // 产品详情
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type AddProductRes struct {
|
|||
|
|
Id string `json:"id"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateProductReq 更新产品
|
|||
|
|
type UpdateProductReq struct {
|
|||
|
|
g.Meta `path:"/update" method:"post" tags:"产品管理" summary:"更新产品" dc:"更新产品信息"` // 路由: POST /product/update
|
|||
|
|
Id string `json:"id" v:"required"` // ID
|
|||
|
|
Name string `json:"name"` // 产品名称
|
|||
|
|
Description string `json:"description"` // 产品详情
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DeleteProductReq 删除产品
|
|||
|
|
type DeleteProductReq struct {
|
|||
|
|
g.Meta `path:"/delete" method:"post" tags:"产品管理" summary:"删除产品" dc:"删除指定产品"` // 路由: POST /product/delete
|
|||
|
|
Id string `json:"id" v:"required"` // ID
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetProductReq 获取单个产品
|
|||
|
|
type GetProductReq struct {
|
|||
|
|
g.Meta `path:"/one" method:"get" tags:"产品管理" summary:"获取产品详情" dc:"根据ID获取单个产品信息"` // 路由: GET /product/one
|
|||
|
|
Id string `p:"id" v:"required"` // ID
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListProductReq 获取产品列表
|
|||
|
|
type ListProductReq struct {
|
|||
|
|
g.Meta `path:"/list" method:"get" tags:"产品管理" summary:"获取产品列表" dc:"分页查询产品列表,支持按名称筛选"` // 路由: GET /product/list
|
|||
|
|
beans.Page
|
|||
|
|
Name string `p:"name"` // 筛选:产品名称
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListProductRes struct {
|
|||
|
|
List []*entity.Product `json:"list"`
|
|||
|
|
Total int `json:"total"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ExportProductReq 导出产品
|
|||
|
|
type ExportProductReq struct {
|
|||
|
|
g.Meta `path:"/export" method:"get" tags:"产品管理" summary:"导出产品" dc:"导出产品为TXT格式的ZIP压缩包,支持按名称筛选" produces:"application/zip"` // 路由: GET /product/export
|
|||
|
|
Name string `p:"name" dc:"筛选:产品名称(支持模糊查询,为空则导出所有)"` // 筛选:产品名称
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ExportProductRes struct {
|
|||
|
|
// 实际返回的是文件流,这个结构体只是为了 Swagger 文档
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ImportProductReq 导入产品
|
|||
|
|
type ImportProductReq struct {
|
|||
|
|
g.Meta `path:"/import" method:"post" tags:"产品管理" summary:"导入产品" dc:"上传ZIP文件批量导入产品(TXT格式)" consumes:"multipart/form-data"` // 路由: POST /product/import
|
|||
|
|
File string `json:"file" type:"file" dc:"上传的ZIP文件" v:"required"` // ZIP文件
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ImportProductRes struct {
|
|||
|
|
SuccessCount int `json:"successCount"` // 成功导入数量
|
|||
|
|
FailCount int `json:"failCount"` // 失败数量
|
|||
|
|
FailReasons []string `json:"failReasons"` // 失败原因列表
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// BindProductReq 绑定产品到客服账号请求
|
|||
|
|
type BindProductReq struct {
|
|||
|
|
g.Meta `path:"/bind" method:"post" tags:"产品管理" summary:"绑定产品" dc:"将产品绑定到客服账号"`
|
|||
|
|
ProductId string `json:"productId" v:"required#产品ID不能为空"`
|
|||
|
|
AccountNames []string `json:"accountNames" v:"required" dc:"客服账号名称列表"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// BindProductRes 绑定产品响应
|
|||
|
|
type BindProductRes struct {
|
|||
|
|
SuccessCount int `json:"successCount"` // 成功绑定数量
|
|||
|
|
FailedIds []string `json:"failedIds"` // 失败的客服账号ID列表
|
|||
|
|
Message string `json:"message"` // 提示信息
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UnbindProductReq 解绑产品请求
|
|||
|
|
type UnbindProductReq struct {
|
|||
|
|
g.Meta `path:"/unbind" method:"post" tags:"产品管理" summary:"解绑产品" dc:"将产品从客服账号解绑"`
|
|||
|
|
ProductId string `json:"productId" v:"required#产品ID不能为空"`
|
|||
|
|
AccountName string `json:"accountName" v:"required" dc:"客服账号名称"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UnbindProductRes 解绑产品响应
|
|||
|
|
type UnbindProductRes struct {
|
|||
|
|
Success bool `json:"success"`
|
|||
|
|
Message string `json:"message"`
|
|||
|
|
}
|