Merge branch 'master' of http://82.157.175.59:3000/GenarrativeAI/Genarrative
This commit is contained in:
@@ -491,13 +491,36 @@ pub fn query_analytics_metric(
|
||||
}
|
||||
}
|
||||
|
||||
// 任务中心读取会顺手记录当日登录埋点,确保“每日登录”只依赖后端事实。
|
||||
// 登录成功埋点由认证链路主动调用;任务中心只负责读取和刷新任务进度。
|
||||
#[spacetimedb::procedure]
|
||||
pub fn record_daily_login_tracking_event_and_return(
|
||||
ctx: &mut ProcedureContext,
|
||||
input: RuntimeProfileTaskCenterGetInput,
|
||||
) -> RuntimeTrackingEventProcedureResult {
|
||||
match ctx.try_with_tx(|tx| {
|
||||
let validated_input = build_runtime_profile_task_center_get_input(input.user_id.clone())
|
||||
.map_err(|error| error.to_string())?;
|
||||
ensure_default_profile_task_config(tx);
|
||||
record_daily_login_tracking_event(tx, &validated_input.user_id)
|
||||
}) {
|
||||
Ok(()) => RuntimeTrackingEventProcedureResult {
|
||||
ok: true,
|
||||
error_message: None,
|
||||
},
|
||||
Err(message) => RuntimeTrackingEventProcedureResult {
|
||||
ok: false,
|
||||
error_message: Some(message),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 任务中心读取会刷新进度;每日登录埋点应由登录成功链路提前记录。
|
||||
#[spacetimedb::procedure]
|
||||
pub fn get_profile_task_center(
|
||||
ctx: &mut ProcedureContext,
|
||||
input: RuntimeProfileTaskCenterGetInput,
|
||||
) -> RuntimeProfileTaskCenterProcedureResult {
|
||||
match ctx.try_with_tx(|tx| get_profile_task_center_snapshot(tx, input.clone(), true)) {
|
||||
match ctx.try_with_tx(|tx| get_profile_task_center_snapshot(tx, input.clone(), false)) {
|
||||
Ok(record) => RuntimeProfileTaskCenterProcedureResult {
|
||||
ok: true,
|
||||
record: Some(record),
|
||||
|
||||
Reference in New Issue
Block a user