1
0
forked from erp-dev/erp

feat: prod clean

This commit is contained in:
2026-05-01 22:43:22 +08:00
parent 1afcfde151
commit d7b388e935
19 changed files with 1198 additions and 134 deletions

View File

@@ -141,6 +141,7 @@ def create_mission(
notify_if_unreplied: bool = False,
unreplied_notify_interval_minutes: int | None = None,
unreplied_notify_max_count: int = 5,
extra=None,
) -> Mission:
if creator is None:
raise ValueError("任务创建者不能为空")
@@ -160,6 +161,7 @@ def create_mission(
category=category or _get_default_mission_category(merchant=merchant),
content_type=content_type,
content_id=content_id,
extra=extra,
notify_if_unreplied=notify_if_unreplied,
unreplied_notify_interval_minutes=unreplied_notify_interval_minutes,
unreplied_notify_max_count=unreplied_notify_max_count,
@@ -189,6 +191,7 @@ def update_mission(
notify_if_unreplied=UNSET,
unreplied_notify_interval_minutes=UNSET,
unreplied_notify_max_count=UNSET,
extra=UNSET,
) -> Mission:
mission = Mission.objects.select_for_update().get(pk=mission.pk)
_assert_employee_belongs_to_mission(updated_by, mission, "更新任务的员工")
@@ -210,6 +213,9 @@ def update_mission(
mission.content_type = content_type
mission.content_id = content_id
update_fields.extend(["content_type", "content_id"])
if extra is not UNSET:
mission.extra = extra
update_fields.append("extra")
notify_changed = notify_if_unreplied is not UNSET
interval_changed = unreplied_notify_interval_minutes is not UNSET
@@ -272,6 +278,7 @@ def create_mission_reply(
responder,
content: str,
ends_task: bool = False,
extra=None,
) -> MissionReply:
mission = Mission.objects.select_for_update().get(pk=mission.pk)
_assert_employee_belongs_to_mission(responder, mission, "回应者")
@@ -284,6 +291,7 @@ def create_mission_reply(
responder=responder,
content=content,
ends_task=ends_task,
extra=extra,
)
if ends_task and not mission.is_completed:
mission.is_completed = True