feat(health,ai): 后端服务优化 + 媒体文件处理

- erp-health: article/banner/consultation/media 服务层优化
- erp-ai: analysis/insight/prompt 服务增强
- erp-auth: auth/role/token 服务改进
- erp-workflow: executor 执行引擎修复
- erp-plugin: 服务层改进
- 新增媒体上传文件样例
This commit is contained in:
iven
2026-05-13 23:28:57 +08:00
parent e4e5ef04d4
commit 212c08b7ae
30 changed files with 320 additions and 3 deletions

View File

@@ -137,6 +137,7 @@ impl AuthService {
let mut user_active: user::ActiveModel = user_model.clone().into();
user_active.last_login_at = Set(Some(Utc::now()));
user_active.updated_at = Set(Utc::now());
user_active.version = Set(user_active.version.unwrap() + 1);
user_active
.update(db)
.await

View File

@@ -299,6 +299,7 @@ impl RoleService {
active.deleted_at = Set(Some(now));
active.updated_at = Set(now);
active.updated_by = Set(operator_id);
active.version = Set(active.version.unwrap() + 1);
active
.update(db)
.await

View File

@@ -168,6 +168,7 @@ impl TokenService {
let mut active: user_token::ActiveModel = token_row.into();
active.revoked_at = Set(Some(Utc::now()));
active.updated_at = Set(Utc::now());
active.version = Set(active.version.unwrap() + 1);
active
.update(db)
.await
@@ -199,6 +200,10 @@ impl TokenService {
user_token::Column::UpdatedAt,
sea_orm::sea_query::Expr::value(now.naive_utc()),
)
.col_expr(
user_token::Column::Version,
sea_orm::sea_query::Expr::col(user_token::Column::Version).add(1),
)
.filter(user_token::Column::TokenHash.eq(&hash))
.filter(user_token::Column::UserId.eq(claims.sub))
.filter(user_token::Column::TenantId.eq(claims.tid))
@@ -233,6 +238,7 @@ impl TokenService {
let mut active: user_token::ActiveModel = token.into();
active.revoked_at = Set(Some(now));
active.updated_at = Set(now);
active.version = Set(active.version.unwrap() + 1);
active
.update(db)
.await