add qygl23t7
This commit is contained in:
@@ -258,7 +258,7 @@ func (h *ProductAdminHandler) UpdateSubscriptionPrice(c *gin.Context) {
|
||||
|
||||
// ListProducts 获取产品列表(管理员)
|
||||
// @Summary 获取产品列表
|
||||
// @Description 管理员获取产品列表,支持筛选和分页
|
||||
// @Description 管理员获取产品列表,支持筛选和分页,包含所有产品(包括隐藏的)
|
||||
// @Tags 产品管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
@@ -272,7 +272,7 @@ func (h *ProductAdminHandler) UpdateSubscriptionPrice(c *gin.Context) {
|
||||
// @Param is_package query bool false "是否组合包"
|
||||
// @Param sort_by query string false "排序字段"
|
||||
// @Param sort_order query string false "排序方向" Enums(asc, desc)
|
||||
// @Success 200 {object} responses.ProductListResponse "获取产品列表成功"
|
||||
// @Success 200 {object} responses.ProductAdminListResponse "获取产品列表成功"
|
||||
// @Failure 400 {object} map[string]interface{} "请求参数错误"
|
||||
// @Failure 401 {object} map[string]interface{} "未认证"
|
||||
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
|
||||
@@ -336,7 +336,8 @@ func (h *ProductAdminHandler) ListProducts(c *gin.Context) {
|
||||
Order: sortOrder,
|
||||
}
|
||||
|
||||
result, err := h.productAppService.ListProducts(c.Request.Context(), filters, options)
|
||||
// 使用管理员专用的产品列表方法
|
||||
result, err := h.productAppService.ListProductsForAdmin(c.Request.Context(), filters, options)
|
||||
if err != nil {
|
||||
h.logger.Error("获取产品列表失败", zap.Error(err))
|
||||
h.responseBuilder.InternalError(c, "获取产品列表失败")
|
||||
@@ -358,13 +359,13 @@ func (h *ProductAdminHandler) getIntQuery(c *gin.Context, key string, defaultVal
|
||||
|
||||
// GetProductDetail 获取产品详情(管理员)
|
||||
// @Summary 获取产品详情
|
||||
// @Description 管理员获取产品详细信息
|
||||
// @Description 管理员获取产品详细信息,包含可见状态
|
||||
// @Tags 产品管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security Bearer
|
||||
// @Param id path string true "产品ID"
|
||||
// @Success 200 {object} responses.ProductInfoResponse "获取产品详情成功"
|
||||
// @Success 200 {object} responses.ProductAdminInfoResponse "获取产品详情成功"
|
||||
// @Failure 400 {object} map[string]interface{} "请求参数错误"
|
||||
// @Failure 401 {object} map[string]interface{} "未认证"
|
||||
// @Failure 404 {object} map[string]interface{} "产品不存在"
|
||||
@@ -379,7 +380,8 @@ func (h *ProductAdminHandler) GetProductDetail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.productAppService.GetProductByID(c.Request.Context(), &query)
|
||||
// 使用管理员专用的产品详情获取方法
|
||||
result, err := h.productAppService.GetProductByIDForAdmin(c.Request.Context(), &query)
|
||||
if err != nil {
|
||||
h.logger.Error("获取产品详情失败", zap.Error(err), zap.String("product_id", query.ID))
|
||||
h.responseBuilder.NotFound(c, "产品不存在")
|
||||
|
||||
@@ -45,7 +45,7 @@ func NewProductHandler(
|
||||
|
||||
// ListProducts 获取产品列表(数据大厅)
|
||||
// @Summary 获取产品列表
|
||||
// @Description 分页获取可用的产品列表,支持筛选
|
||||
// @Description 分页获取可用的产品列表,支持筛选,默认只返回可见的产品
|
||||
// @Tags 数据大厅
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
@@ -91,11 +91,14 @@ func (h *ProductHandler) ListProducts(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 可见状态筛选
|
||||
// 可见状态筛选 - 用户端默认只显示可见的产品
|
||||
if isVisible := c.Query("is_visible"); isVisible != "" {
|
||||
if visible, err := strconv.ParseBool(isVisible); err == nil {
|
||||
filters["is_visible"] = visible
|
||||
}
|
||||
} else {
|
||||
// 如果没有指定可见状态,默认只显示可见的产品
|
||||
filters["is_visible"] = true
|
||||
}
|
||||
|
||||
// 产品类型筛选
|
||||
@@ -168,7 +171,7 @@ func (h *ProductHandler) getCurrentUserID(c *gin.Context) string {
|
||||
|
||||
// GetProductDetail 获取产品详情
|
||||
// @Summary 获取产品详情
|
||||
// @Description 根据产品ID获取产品详细信息
|
||||
// @Description 根据产品ID获取产品详细信息,只能获取可见的产品
|
||||
// @Tags 数据大厅
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
@@ -187,7 +190,8 @@ func (h *ProductHandler) GetProductDetail(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.appService.GetProductByID(c.Request.Context(), &query)
|
||||
// 使用用户端专用的产品详情获取方法
|
||||
result, err := h.appService.GetProductByIDForUser(c.Request.Context(), &query)
|
||||
if err != nil {
|
||||
h.logger.Error("获取产品详情失败", zap.Error(err), zap.String("product_id", query.ID))
|
||||
h.responseBuilder.NotFound(c, "产品不存在")
|
||||
|
||||
Reference in New Issue
Block a user