55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""
|
||
维客线索相关 Pydantic 模型。
|
||
|
||
大类枚举:客户基础信息、消费习惯、玩法偏好、促销偏好、社交关系、重要反馈
|
||
"""
|
||
|
||
from datetime import datetime
|
||
from enum import Enum
|
||
from typing import Optional
|
||
|
||
from pydantic import BaseModel, Field
|
||
|
||
|
||
class ClueCategory(str, Enum):
|
||
"""维客线索大类枚举"""
|
||
BASIC_INFO = "客户基础信息"
|
||
CONSUMPTION = "消费习惯"
|
||
PLAY_PREF = "玩法偏好"
|
||
PROMO_PREF = "促销偏好"
|
||
SOCIAL = "社交关系"
|
||
FEEDBACK = "重要反馈"
|
||
|
||
|
||
class ClueSource(str, Enum):
|
||
"""维客线索来源枚举"""
|
||
MANUAL = "manual" # 助教手动录入
|
||
AI_CONSUMPTION = "ai_consumption" # 应用 3:消费分析自动生成
|
||
AI_NOTE = "ai_note" # 应用 6:备注分析自动提取
|
||
|
||
|
||
class RetentionClueSubmit(BaseModel):
|
||
"""提交维客线索请求。"""
|
||
member_id: int = Field(..., gt=0, description="会员 ID")
|
||
category: ClueCategory = Field(..., description="线索大类")
|
||
summary: str = Field(..., min_length=1, max_length=200, description="摘要:重点信息")
|
||
detail: Optional[str] = Field(None, max_length=2000, description="详情:分析及扩展说明,可为空")
|
||
recorded_by_assistant_id: int = Field(..., gt=0, description="记录助教 ID")
|
||
recorded_by_name: str = Field(..., min_length=1, max_length=50, description="记录助教姓名")
|
||
site_id: int = Field(..., gt=0, description="门店 ID")
|
||
source: ClueSource = Field(default=ClueSource.MANUAL, description="线索来源")
|
||
|
||
|
||
class RetentionClueOut(BaseModel):
|
||
"""维客线索返回模型。"""
|
||
id: int
|
||
member_id: int
|
||
category: ClueCategory
|
||
summary: str
|
||
detail: Optional[str]
|
||
recorded_by_assistant_id: Optional[int]
|
||
recorded_by_name: Optional[str]
|
||
recorded_at: datetime
|
||
site_id: int
|
||
source: ClueSource = ClueSource.MANUAL
|