feat: 新增路线详情关联管家顾问及相关功能

详细变更如下:
- 更新 .gitignore 文件,添加 pnpm-store 忽略规则
- 新增数据库迁移脚本,为 DetailRecord 添加可空的 conciergeAdvisorId 字段用于关联管家顾问
- 完善 Admin 后台玩法详情编辑器,支持选择关联的管家顾问并校验合法性
- 公共 API 支持返回已启用的管家顾问完整数据,不在详情表中冗余存储管家资料
- 小程序端新增详情页联系管家入口、个人页最近浏览历史功能
- 更新所有相关文档与测试用例,修复下拉选择框的 z-index 样式问题
This commit is contained in:
duanshuwen committed 2026-08-22 08:26:23 +08:00
1 parent e7b8c5bf43
commit b7a81964c9
34 files changed
+739 -63

No files matched your search

+15
View File
@@ -841,6 +841,18 @@ def detail_key_conflict(db: Session, key: str, current_id: str | None = None) ->
detail_error(409, "详情 key 已存在", "DETAIL_KEY_EXISTS", {"key": key})
def validate_detail_concierge_advisor(db: Session, advisor_id: str | None) -> None:
if not advisor_id:
return
if not db.get(ConciergeAdvisor, advisor_id):
detail_error(
422,
"关联的管家顾问不存在",
"DETAIL_CONCIERGE_ADVISOR_INVALID",
{"conciergeAdvisorId": advisor_id},
)
def validate_detail_order(item_ids: list[str], current_ids: list[str]) -> None:
validate_wanfa_order(item_ids, current_ids, "DETAIL_REORDER_INVALID")
@@ -881,6 +893,7 @@ def create_detail(
db: Session = Depends(get_db),
):
detail_key_conflict(db, body.key)
validate_detail_concierge_advisor(db, body.conciergeAdvisorId)
detail = DetailRecord(
**body.model_dump(exclude={"sortOrder"}),
sortOrder=body.sortOrder if body.sortOrder is not None else next_site_sort_order(db, DetailRecord),
@@ -905,6 +918,8 @@ def update_detail(
before = detail_record_dict(detail)
if "key" in body.model_fields_set:
detail_key_conflict(db, body.key or "", detail.id)
if "conciergeAdvisorId" in body.model_fields_set:
validate_detail_concierge_advisor(db, body.conciergeAdvisorId)
for field in body.model_fields_set:
setattr(detail, field, getattr(body, field))
db.flush()