Files
admin/db/migrations/x8_section_sort_fix.sql
2026-08-10 14:56:44 +08:00

12 lines
598 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Luxsin X8product_id=1)区块排序修复
-- 背景:所有区块 sort_order 均为 0,前台按 sort_order 排序导致顺序混乱。
-- 已确认 www_section_blocks.id 为自增主键,按 id 升序(即创建顺序)重新分配 sort_order(0 起)。
-- 同时后端 POST /api/www/sections 已改为:未指定 sort_order 时取同 page_type+product_id
-- 下现有区块的 max(sort_order)+1 自动追加,不再默认 0。
SET @row := -1;
UPDATE www_section_blocks
SET sort_order = (@row := @row + 1)
WHERE page_type = 'product_detail' AND product_id = 1
ORDER BY id;