refactor(catalog): 废弃 LEWAN_ 镜像,统一英文 SKU 与积分价,商品图按 SKU 缓存
对外目录只保留英文主 sku;迁移硬删镜像并校准 1元=100积分;发货页/凭证优先使用 local {sku}.webp。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -56,8 +56,16 @@ func mapKeys(values map[string]struct{}) []string {
|
||||
|
||||
func (h *MerchantHandler) ListProducts(c *gin.Context) {
|
||||
page, size := pageParams(c)
|
||||
list, total, err := h.merchantSvc.ListMerchantProducts(middleware.GetMerchantID(c), page, size, false)
|
||||
list, total, err := h.merchantSvc.ListMerchantProductsWithOptions(middleware.GetMerchantID(c), page, size, service.ListMerchantProductsOptions{
|
||||
Status: strings.TrimSpace(c.Query("status")),
|
||||
Keyword: strings.TrimSpace(c.Query("keyword")),
|
||||
ExcludeLegacyLewanSKU: true, // LEWAN_* 镜像已废弃,列表永不返回
|
||||
})
|
||||
if err != nil {
|
||||
if err.Error() == "无效的商品状态" {
|
||||
response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
response.ServerError(c, err.Error())
|
||||
return
|
||||
}
|
||||
@@ -86,6 +94,16 @@ func (h *MerchantHandler) UpdateProductStatus(c *gin.Context) {
|
||||
response.OK(c, nil)
|
||||
}
|
||||
|
||||
// DeleteProduct DELETE /api/merchant/products/:id — 仅已下架可删(软删除)。
|
||||
func (h *MerchantHandler) DeleteProduct(c *gin.Context) {
|
||||
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
if err := h.merchantSvc.DeleteMerchantProduct(middleware.GetMerchantID(c), uint(id), middleware.GetUserID(c)); err != nil {
|
||||
response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
response.OK(c, nil)
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) ListOrders(c *gin.Context) {
|
||||
page, size := pageParams(c)
|
||||
orderSource := strings.TrimSpace(c.Query("order_source"))
|
||||
@@ -103,7 +121,7 @@ func (h *MerchantHandler) ListOrders(c *gin.Context) {
|
||||
|
||||
// ListManualOrderProducts returns active products for order creation without granting product-management access.
|
||||
func (h *MerchantHandler) ListManualOrderProducts(c *gin.Context) {
|
||||
list, _, err := h.merchantSvc.ListMerchantProducts(middleware.GetMerchantID(c), 1, 100, true)
|
||||
list, _, err := h.merchantSvc.ListMerchantProductsForClient(middleware.GetMerchantID(c), 1, 100)
|
||||
if err != nil {
|
||||
response.ServerError(c, err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user