add qygl23t7

This commit is contained in:
2025-07-30 00:51:22 +08:00
parent 83530c0f9b
commit 723c418a1b
38 changed files with 999 additions and 785 deletions

View File

@@ -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, "产品不存在")