feat(training): 出国规则培训完成推送企微通知!
This commit is contained in:
1 parent
258098ea7b
commit
77851288f7
8 files changed
+60
-5
No files matched your search
@@ -21,6 +21,7 @@ from app.core.errors import ValidationError
|
||||
from app.extensions import db
|
||||
from app.models import Agent, TrainingRecord, User
|
||||
from app.services.training_config_service import get_published_config
|
||||
from app.services.wecom_notify import send_wecom_event_message
|
||||
|
||||
TRAINING_STAGES = {"video", "summary", "exam", "result"}
|
||||
TRAINING_TYPES = {"onboarding", "safety"}
|
||||
@@ -609,6 +610,18 @@ def upsert_user_training_record(user: User, payload: dict[str, Any]) -> Training
|
||||
record.started_at = datetime.utcnow()
|
||||
|
||||
db.session.commit()
|
||||
if stage == "result" and _is_overseas_regulations_training(training_type):
|
||||
try:
|
||||
send_wecom_event_message(
|
||||
event_type="training_overseas_thailand_guidelines",
|
||||
user=user,
|
||||
title="中国员工出差泰国的行为准则",
|
||||
content="中国员工出差泰国的行为准则",
|
||||
jump_path="/workspace",
|
||||
)
|
||||
db.session.commit()
|
||||
except Exception:
|
||||
db.session.rollback()
|
||||
return record
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user