mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 02:25:41 +00:00
pow stats for solution and verification
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub async fn fetched(key: &str, db: &PgPool) {
|
||||
/// record PoWConfig fetches
|
||||
#[inline]
|
||||
pub async fn record_fetch(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_fetched_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
@@ -26,3 +28,27 @@ pub async fn fetched(key: &str, db: &PgPool) {
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// record PoWConfig solves
|
||||
#[inline]
|
||||
pub async fn record_solve(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_solved_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
&key,
|
||||
)
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// record PoWConfig confirms
|
||||
#[inline]
|
||||
pub async fn record_confirm(key: &str, db: &PgPool) {
|
||||
let _ = sqlx::query!(
|
||||
"INSERT INTO mcaptcha_pow_confirmed_stats
|
||||
(config_id) VALUES ((SELECT config_id FROM mcaptcha_config WHERE key = $1))",
|
||||
&key,
|
||||
)
|
||||
.execute(db)
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user