Update mengyastore
This commit is contained in:
@@ -18,6 +18,13 @@ func NewPublicHandler(store *storage.ProductStore) *PublicHandler {
|
||||
return &PublicHandler{store: store}
|
||||
}
|
||||
|
||||
// ListProducts 上架商品列表(公开字段,不含卡密与管理信息)。
|
||||
// @Summary 上架商品列表
|
||||
// @Tags 公开
|
||||
// @Produce json
|
||||
// @Success 200 {object} SwaggerProductListBody
|
||||
// @Failure 500 {object} SwaggerErrorBody
|
||||
// @Router /api/products [get]
|
||||
func (h *PublicHandler) ListProducts(c *gin.Context) {
|
||||
items, err := h.store.ListActive()
|
||||
if err != nil {
|
||||
@@ -27,6 +34,14 @@ func (h *PublicHandler) ListProducts(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"data": sanitizeForPublic(items)})
|
||||
}
|
||||
|
||||
// RecordProductView 记录商品浏览(去重策略由服务端指纹决定)。
|
||||
// @Summary 记录商品浏览
|
||||
// @Tags 公开
|
||||
// @Produce json
|
||||
// @Param id path string true "商品 ID"
|
||||
// @Success 200 {object} SwaggerProductViewWrap
|
||||
// @Failure 404 {object} SwaggerErrorBody
|
||||
// @Router /api/products/{id}/view [post]
|
||||
func (h *PublicHandler) RecordProductView(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
fingerprint := buildViewerFingerprint(c)
|
||||
|
||||
Reference in New Issue
Block a user