chore: sync local updates
This commit is contained in:
@@ -47,12 +47,12 @@ type AdminVerifyTokenRequest struct {
|
||||
}
|
||||
|
||||
// VerifyAdminToken 校验请求中的令牌是否正确。
|
||||
// @Summary 校验管理员令牌
|
||||
// @Description 响应为 {"valid": true/false},不泄露真实口令。
|
||||
// @Summary 校验管理端令牌是否有效
|
||||
// @Description 请求体 JSON 含 `token` 字段;响应仅返回 `{"valid": true|false}`,不会返回真实口令或敏感信息。
|
||||
// @Tags 管理端-认证
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body AdminVerifyTokenRequest true "待校验 token"
|
||||
// @Param body body AdminVerifyTokenRequest true "待校验的管理员 token(JSON)"
|
||||
// @Success 200 {object} SwaggerValidBody
|
||||
// @Router /api/admin/verify [post]
|
||||
func (h *AdminHandler) VerifyAdminToken(c *gin.Context) {
|
||||
@@ -65,7 +65,8 @@ func (h *AdminHandler) VerifyAdminToken(c *gin.Context) {
|
||||
}
|
||||
|
||||
// ListAllProducts 管理端商品全量列表(含下架与卡密等敏感字段)。
|
||||
// @Summary 全部商品(管理)
|
||||
// @Summary 管理端获取全部商品列表
|
||||
// @Description 含下架商品、卡密字段等完整数据,仅限管理令牌访问。需在请求头携带 `X-Admin-Token`。
|
||||
// @Tags 管理端-商品
|
||||
// @Produce json
|
||||
// @Security AdminToken
|
||||
@@ -86,12 +87,13 @@ func (h *AdminHandler) ListAllProducts(c *gin.Context) {
|
||||
}
|
||||
|
||||
// CreateProduct 创建商品。
|
||||
// @Summary 创建商品
|
||||
// @Summary 管理端创建商品
|
||||
// @Description 提交完整商品载荷:价格、卡密/固定内容、收款码链接、是否上架等。校验失败返回 400。
|
||||
// @Tags 管理端-商品
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security AdminToken
|
||||
// @Param body body ProductPayload true "商品字段"
|
||||
// @Param body body ProductPayload true "商品各字段(含可选卡密、截图、收款码等)"
|
||||
// @Success 200 {object} SwaggerProductOneBody
|
||||
// @Failure 400 {object} SwaggerErrorBody
|
||||
// @Failure 401 {object} SwaggerErrorBody
|
||||
@@ -157,13 +159,14 @@ func (h *AdminHandler) CreateProduct(c *gin.Context) {
|
||||
}
|
||||
|
||||
// UpdateProduct 更新商品。
|
||||
// @Summary 更新商品
|
||||
// @Summary 管理端更新商品
|
||||
// @Description 路径参数为商品 ID,请求体为整包覆盖式更新(以服务端绑定逻辑为准)。未找到则 404。
|
||||
// @Tags 管理端-商品
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security AdminToken
|
||||
// @Param id path string true "商品 ID"
|
||||
// @Param body body ProductPayload true "商品字段"
|
||||
// @Param id path string true "商品ID"
|
||||
// @Param body body ProductPayload true "待写入的商品字段"
|
||||
// @Success 200 {object} SwaggerProductOneBody
|
||||
// @Failure 400 {object} SwaggerErrorBody
|
||||
// @Failure 401 {object} SwaggerErrorBody
|
||||
@@ -231,13 +234,14 @@ func (h *AdminHandler) UpdateProduct(c *gin.Context) {
|
||||
}
|
||||
|
||||
// ToggleProduct 上架/下架切换。
|
||||
// @Summary 切换上架状态
|
||||
// @Summary 管理端切换商品上架状态
|
||||
// @Description PATCH 请求体为 `{ "active": true|false }`,用于快速上下架而不改其它字段。
|
||||
// @Tags 管理端-商品
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security AdminToken
|
||||
// @Param id path string true "商品 ID"
|
||||
// @Param body body TogglePayload true "{active}"
|
||||
// @Param id path string true "商品ID"
|
||||
// @Param body body TogglePayload true "上架开关 { \"active\": bool }"
|
||||
// @Success 200 {object} SwaggerProductOneBody
|
||||
// @Failure 400 {object} SwaggerErrorBody
|
||||
// @Failure 401 {object} SwaggerErrorBody
|
||||
@@ -262,11 +266,12 @@ func (h *AdminHandler) ToggleProduct(c *gin.Context) {
|
||||
}
|
||||
|
||||
// DeleteProduct 删除商品。
|
||||
// @Summary 删除商品
|
||||
// @Summary 管理端删除商品
|
||||
// @Description 按 ID 永久删除商品记录(影响以数据库外键/业务逻辑为准),需管理令牌。
|
||||
// @Tags 管理端-商品
|
||||
// @Produce json
|
||||
// @Security AdminToken
|
||||
// @Param id path string true "商品 ID"
|
||||
// @Param id path string true "商品ID"
|
||||
// @Success 200 {object} SwaggerBoolOKWrap
|
||||
// @Failure 401 {object} SwaggerErrorBody
|
||||
// @Failure 500 {object} SwaggerErrorBody
|
||||
|
||||
Reference in New Issue
Block a user