feat(consignment): 寄卖配置价格/匹配/超时/收货字段全面改造

- 价格:固定价格改为模板价固定下调,移除绝对固定价;没有模板价时统一阻止发布
- 配置面板:按下拉选项动态显隐,超时与降价提示拆成两张卡片,超时单位改为小时(默认 0.5)
- 匹配:新增关闭匹配并设为默认,移除自动匹配开关;关闭后新单直接进大厅
- 超时:新增重新匹配退/扣押金,回内部匹配池并排除原卖家与原库存(迁移 147)
- 日志:新增 consignment_match_logs,自动/手动匹配成功、失败、跳过统一留痕,后台新增匹配日志抽屉
- 打手端:顶部分类下拉替换多 tab,默认苏尔南手枪;联系方式与游戏凭据改为动态字段(默认 7 项,手机号必填)
- 降价提示默认开启、默认 24 小时
This commit is contained in:
2026-11-06 13:32:24 +08:00
parent e0a85359b6
commit 3aa01136a5
31 changed files with 2311 additions and 568 deletions
@@ -0,0 +1,52 @@
-- 147_consignment_match_and_rematch.sql
-- 1) 超时「重新匹配」排除原卖家/原库存;
-- 2) 手动/自动匹配统一留痕,供后台排查问题。
-- 全部语句幂等,可安全重跑;不改动历史迁移。
ALTER TABLE work_orders
ADD COLUMN IF NOT EXISTS rematch_excluded_worker_id BIGINT,
ADD COLUMN IF NOT EXISTS rematch_excluded_inventory_id BIGINT;
COMMENT ON COLUMN work_orders.rematch_excluded_worker_id IS
'超时重新匹配时排除的原接单打手;匹配成功后清空';
COMMENT ON COLUMN work_orders.rematch_excluded_inventory_id IS
'超时重新匹配时排除的原寄卖库存;匹配成功后清空';
CREATE TABLE IF NOT EXISTS consignment_match_logs (
id BIGSERIAL PRIMARY KEY,
work_order_id BIGINT,
work_order_no TEXT NOT NULL DEFAULT '',
profile_id BIGINT,
category_id BIGINT,
trigger_type TEXT NOT NULL,
result TEXT NOT NULL,
reason_code TEXT NOT NULL DEFAULT '',
reason_text TEXT NOT NULL DEFAULT '',
candidate_count INTEGER NOT NULL DEFAULT 0,
matched_count INTEGER NOT NULL DEFAULT 0,
actor_type TEXT NOT NULL DEFAULT 'system',
actor_id TEXT NOT NULL DEFAULT '',
duration_ms INTEGER NOT NULL DEFAULT 0,
payload_json JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT consignment_match_logs_trigger_check
CHECK (trigger_type IN ('auto', 'manual', 'rematch')),
CONSTRAINT consignment_match_logs_result_check
CHECK (result IN ('matched', 'failed', 'skipped'))
);
CREATE INDEX IF NOT EXISTS idx_consignment_match_logs_created
ON consignment_match_logs (created_at DESC);
CREATE INDEX IF NOT EXISTS idx_consignment_match_logs_work_order
ON consignment_match_logs (work_order_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_consignment_match_logs_profile
ON consignment_match_logs (profile_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_consignment_match_logs_type_result
ON consignment_match_logs (trigger_type, result, created_at DESC);
COMMENT ON TABLE consignment_match_logs IS
'寄卖匹配日志:手动/自动/重新匹配的每次尝试(成功、失败、跳过)与原因,用于留痕和问题分析';
COMMENT ON COLUMN consignment_match_logs.trigger_type IS
'触发方式:auto 自动调度 / manual 后台手动 / rematch 超时重新匹配';
COMMENT ON COLUMN consignment_match_logs.reason_code IS
'机器可读原因码,例如 no_candidate / matching_disabled / spec_mismatch / exception';