| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- """公开反馈提交业务"""
- from typing import Any, Dict, List, Optional
- from sqlalchemy.orm import Session
- from app.core.response import AppHTTPError
- from app.crud import feedback as feedback_crud
- def submit_feedback(
- db: Session,
- *,
- fb_type: str,
- content: str,
- target_name: Optional[str] = None,
- target_dept: Optional[str] = None,
- target_post: Optional[str] = None,
- reporter_name: Optional[str] = None,
- reporter_unit: Optional[str] = None,
- reporter_post: Optional[str] = None,
- reporter_phone: Optional[str] = None,
- attachment_urls: Optional[List[str]] = None,
- ) -> Dict[str, Any]:
- if not (content or "").strip():
- raise AppHTTPError(400, "内容不能为空")
- if not (fb_type or "").strip():
- raise AppHTTPError(400, "反馈类型不能为空")
- biz_no = feedback_crud.next_biz_no(db, "FK")
- row = feedback_crud.create_feedback(
- db,
- biz_no=biz_no,
- fb_type=fb_type.strip(),
- content=content.strip(),
- target_name=target_name,
- target_dept=target_dept,
- target_post=target_post,
- reporter_name=reporter_name,
- reporter_unit=reporter_unit,
- reporter_post=reporter_post,
- reporter_phone=reporter_phone,
- attachments=attachment_urls,
- status="待处理",
- )
- return {"id": row.id, "bizNo": row.biz_no}
|