refactor: 抽离 AI pipeline 与调度共享能力逻辑

This commit is contained in:
fawney19
2026-04-10 01:46:14 +08:00
parent b901a6ffc7
commit 5014e2f5fd
255 changed files with 15057 additions and 3115 deletions
@@ -85,7 +85,7 @@ impl AppState {
.unwrap_or("管理员调账")
.to_string(),
),
created_at_unix_secs: chrono::Utc::now().timestamp().max(0) as u64,
created_at_unix_ms: chrono::Utc::now().timestamp().max(0) as u64,
};
return Ok(Some((wallet.clone(), transaction)));
}
@@ -148,7 +148,7 @@ impl AppState {
"operator_id": operator_id,
"description": description,
})),
created_at_unix_secs: created_at,
created_at_unix_ms: created_at,
paid_at_unix_secs: Some(created_at),
credited_at_unix_secs: Some(created_at),
expires_at_unix_secs: None,
@@ -193,7 +193,7 @@ fn stored_wallet_transaction_to_gateway(
link_id: transaction.link_id,
operator_id: transaction.operator_id,
description: transaction.description,
created_at_unix_secs: transaction.created_at_unix_secs.unwrap_or_default(),
created_at_unix_ms: transaction.created_at_unix_ms.unwrap_or_default(),
}
}
@@ -215,7 +215,7 @@ fn stored_admin_payment_order_to_gateway(
gateway_order_id: order.gateway_order_id,
status: order.status,
gateway_response: order.gateway_response,
created_at_unix_secs: order.created_at_unix_secs,
created_at_unix_ms: order.created_at_unix_ms,
paid_at_unix_secs: order.paid_at_unix_secs,
credited_at_unix_secs: order.credited_at_unix_secs,
expires_at_unix_secs: order.expires_at_unix_secs,
@@ -102,8 +102,8 @@ pub(super) fn admin_wallet_payment_order_from_row(
gateway_response: row
.try_get("gateway_response")
.map_err(|err| GatewayError::Internal(err.to_string()))?,
created_at_unix_secs: row
.try_get::<i64, _>("created_at_unix_secs")
created_at_unix_ms: row
.try_get::<i64, _>("created_at_unix_ms")
.map_err(|err| GatewayError::Internal(err.to_string()))?
.max(0) as u64,
paid_at_unix_secs: row
@@ -182,8 +182,8 @@ pub(super) fn admin_wallet_refund_from_row(
processed_by: row
.try_get("processed_by")
.map_err(|err| GatewayError::Internal(err.to_string()))?,
created_at_unix_secs: row
.try_get::<i64, _>("created_at_unix_secs")
created_at_unix_ms: row
.try_get::<i64, _>("created_at_unix_ms")
.map_err(|err| GatewayError::Internal(err.to_string()))?
.max(0) as u64,
updated_at_unix_secs: row
@@ -234,8 +234,8 @@ pub(super) fn admin_billing_rule_from_row(
is_enabled: row
.try_get("is_enabled")
.map_err(|err| GatewayError::Internal(err.to_string()))?,
created_at_unix_secs: row
.try_get::<i64, _>("created_at_unix_secs")
created_at_unix_ms: row
.try_get::<i64, _>("created_at_unix_ms")
.map_err(|err| GatewayError::Internal(err.to_string()))?
.max(0) as u64,
updated_at_unix_secs: row
@@ -282,8 +282,8 @@ pub(super) fn admin_billing_collector_from_row(
is_enabled: row
.try_get("is_enabled")
.map_err(|err| GatewayError::Internal(err.to_string()))?,
created_at_unix_secs: row
.try_get::<i64, _>("created_at_unix_secs")
created_at_unix_ms: row
.try_get::<i64, _>("created_at_unix_ms")
.map_err(|err| GatewayError::Internal(err.to_string()))?
.max(0) as u64,
updated_at_unix_secs: row
@@ -104,7 +104,7 @@ impl AppState {
link_id: Some(refund.id.clone()),
operator_id: operator_id.map(ToOwned::to_owned),
description: Some("退款占款".to_string()),
created_at_unix_secs: now_unix_secs,
created_at_unix_ms: now_unix_secs,
};
let mut updated_refund = refund.clone();
@@ -318,7 +318,7 @@ impl AppState {
link_id: Some(refund.id.clone()),
operator_id: operator_id.map(ToOwned::to_owned),
description: Some("退款失败回补".to_string()),
created_at_unix_secs: now_unix_secs,
created_at_unix_ms: now_unix_secs,
};
if let Some(payment_order_id) = refund.payment_order_id.clone() {
@@ -415,7 +415,7 @@ fn stored_admin_wallet_refund_to_gateway(
requested_by: refund.requested_by,
approved_by: refund.approved_by,
processed_by: refund.processed_by,
created_at_unix_secs: refund.created_at_unix_secs,
created_at_unix_ms: refund.created_at_unix_ms,
updated_at_unix_secs: refund.updated_at_unix_secs,
processed_at_unix_secs: refund.processed_at_unix_secs,
completed_at_unix_secs: refund.completed_at_unix_secs,
@@ -441,6 +441,6 @@ fn stored_admin_wallet_transaction_to_gateway(
link_id: transaction.link_id,
operator_id: transaction.operator_id,
description: transaction.description,
created_at_unix_secs: transaction.created_at_unix_secs.unwrap_or_default(),
created_at_unix_ms: transaction.created_at_unix_ms.unwrap_or_default(),
}
}