chore: release server-v1.0.70
Deploy Server / release-deploy-server (push) Successful in 56s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
This commit is contained in:
wangjia
2026-06-21 17:32:55 +08:00
parent 182adca282
commit 7b67466a3e
4 changed files with 141 additions and 3 deletions
+19 -3
View File
@@ -2,6 +2,7 @@ package handler
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
@@ -24,7 +25,12 @@ func NewProductOptionHandler(db *gorm.DB) *ProductOptionHandler {
func (h *ProductOptionHandler) ListNames(c *gin.Context) {
shopID := middleware.GetShopID(c)
items := make([]model.ProductNameOption, 0)
h.db.Where("shop_id = ?", shopID).Order("id ASC").Find(&items)
q := h.db.Where("shop_id = ?", shopID)
if kw := strings.TrimSpace(c.Query("keyword")); kw != "" {
like := "%" + kw + "%"
q = q.Where("name LIKE ? OR code LIKE ?", like, like)
}
q.Order("id ASC").Find(&items)
util.RespondSuccess(c, items)
}
@@ -85,7 +91,12 @@ func (h *ProductOptionHandler) DeleteName(c *gin.Context) {
func (h *ProductOptionHandler) ListSeries(c *gin.Context) {
shopID := middleware.GetShopID(c)
items := make([]model.ProductSeriesOption, 0)
h.db.Where("shop_id = ?", shopID).Order("id ASC").Find(&items)
q := h.db.Where("shop_id = ?", shopID)
if kw := strings.TrimSpace(c.Query("keyword")); kw != "" {
like := "%" + kw + "%"
q = q.Where("name LIKE ? OR code LIKE ?", like, like)
}
q.Order("id ASC").Find(&items)
util.RespondSuccess(c, items)
}
@@ -146,7 +157,12 @@ func (h *ProductOptionHandler) DeleteSeries(c *gin.Context) {
func (h *ProductOptionHandler) ListSpecs(c *gin.Context) {
shopID := middleware.GetShopID(c)
items := make([]model.ProductSpecOption, 0)
h.db.Where("shop_id = ?", shopID).Order("id ASC").Find(&items)
q := h.db.Where("shop_id = ?", shopID)
if kw := strings.TrimSpace(c.Query("keyword")); kw != "" {
like := "%" + kw + "%"
q = q.Where("name LIKE ? OR code LIKE ?", like, like)
}
q.Order("id ASC").Find(&items)
util.RespondSuccess(c, items)
}