导入和平精英商品目录并优化皮肤列表展示

- 皮肤增加 sku 字段,启动时按 sku 幂等导入 27 个和平精英商品
- 佣金默认 0,支持中英文名搜索
- 列表去掉品类列并固定列宽,避免中文名列空白过大
- 新增商品中英文名对照文档
This commit is contained in:
yml2213
2026-07-20 15:38:38 +08:00
parent 45db0aa4b9
commit 829bea309d
8 changed files with 177 additions and 43 deletions
+8 -6
View File
@@ -52,10 +52,11 @@ func (h *SkinHandler) Get(c *gin.Context) {
type skinCreateReq struct {
Name string `json:"name" binding:"required"`
SKU string `json:"sku" binding:"required"`
Game string `json:"game"`
Category string `json:"category"`
CoverURL string `json:"cover_url"`
Price float64 `json:"price" binding:"required"`
Price float64 `json:"price"`
CostPrice float64 `json:"cost_price"`
Commission float64 `json:"commission"`
Stock int `json:"stock"`
@@ -66,19 +67,20 @@ type skinCreateReq struct {
func (h *SkinHandler) Create(c *gin.Context) {
var req skinCreateReq
if err := c.ShouldBindJSON(&req); err != nil {
response.BadRequest(c, "参数错误")
response.BadRequest(c, "参数错误:名称与 sku 必填")
return
}
status := req.Status
if status != 0 && status != 1 {
if status != 1 {
// 未传或非 1 时:创建默认上架;若传 0 仍默认上架(下架请创建后更新)
status = 1
}
// 未传 status 时默认上架;若明确要下架请先创建再更新
if status == 0 {
status = 1
if req.Game == "" {
req.Game = "和平精英"
}
skin := &model.Skin{
Name: req.Name,
SKU: req.SKU,
Game: req.Game,
Category: req.Category,
CoverURL: req.CoverURL,