From 69aa36a3d136ded56c1b54e28b84da8ec0226625 Mon Sep 17 00:00:00 2001 From: ypsdf1 Date: Thu, 29 Oct 2026 16:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC60=E6=89=B9=EF=BC=9Acredit.php?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DSQLITE3=5FREAL=E5=B8=B8=E9=87=8F=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8(7=E5=A4=84=E6=94=B9=E7=94=A8SQLITE3=5FFLOAT)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/credit.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/credit.php b/api/credit.php index 4e5c212..d0f58bf 100644 --- a/api/credit.php +++ b/api/credit.php @@ -240,14 +240,14 @@ switch ($action) { if (!$target) error('记录不存在'); // 更新记录 $stmt = $db->prepare("UPDATE credit_records SET status = 'approved', score_change = ?, approved_at = ?, approve_reason = ? WHERE id = ?"); - $stmt->bindValue(1, $amount, SQLITE3_REAL); + $stmt->bindValue(1, $amount, SQLITE3_FLOAT); $stmt->bindValue(2, time(), SQLITE3_INTEGER); $stmt->bindValue(3, $reason, SQLITE3_TEXT); $stmt->bindValue(4, $recordId, SQLITE3_INTEGER); $stmt->execute(); // 更新积分 $stmt = $db->prepare("UPDATE users SET credit_score = credit_score + ? WHERE player_name = ?"); - $stmt->bindValue(1, $amount, SQLITE3_REAL); + $stmt->bindValue(1, $amount, SQLITE3_FLOAT); $stmt->bindValue(2, $target, SQLITE3_TEXT); $stmt->execute(); @@ -346,7 +346,7 @@ switch ($action) { if ($newScore < 0) $newScore = 0; if ($newScore > 1000) $newScore = 1000; // 上限防溢出 $stmt = $db->prepare("UPDATE users SET credit_score = ? WHERE player_name = ?"); - $stmt->bindValue(1, $newScore, SQLITE3_REAL); + $stmt->bindValue(1, $newScore, SQLITE3_FLOAT); $stmt->bindValue(2, $target, SQLITE3_TEXT); $stmt->execute(); @@ -357,7 +357,7 @@ switch ($action) { $stmt->bindValue(2, $_SESSION['admin_user'] ?? 'admin', SQLITE3_TEXT); $stmt->bindValue(3, $type, SQLITE3_TEXT); $stmt->bindValue(4, $reason, SQLITE3_TEXT); - $stmt->bindValue(5, $amount, SQLITE3_REAL); + $stmt->bindValue(5, $amount, SQLITE3_FLOAT); $stmt->bindValue(6, time(), SQLITE3_INTEGER); $stmt->bindValue(7, time(), SQLITE3_INTEGER); $stmt->bindValue(8, $reason, SQLITE3_TEXT); @@ -394,14 +394,14 @@ switch ($action) { $res = $stmt->execute(); if ($row = $res->fetchArray()) { $stmt = $db->prepare("UPDATE users SET credit_score = ? WHERE player_name = ?"); - $stmt->bindValue(1, (float)$score, SQLITE3_REAL); + $stmt->bindValue(1, (float)$score, SQLITE3_FLOAT); $stmt->bindValue(2, $pname, SQLITE3_TEXT); $stmt->execute(); } else { // 玩家不存在则插入 $stmt = $db->prepare("INSERT INTO users (player_name, credit_score) VALUES (?, ?)"); $stmt->bindValue(1, $pname, SQLITE3_TEXT); - $stmt->bindValue(2, (float)$score, SQLITE3_REAL); + $stmt->bindValue(2, (float)$score, SQLITE3_FLOAT); $stmt->execute(); } } @@ -438,7 +438,7 @@ switch ($action) { $stmt->bindValue(3, $type, SQLITE3_TEXT); $stmt->bindValue(4, $content, SQLITE3_TEXT); $stmt->bindValue(5, $status, SQLITE3_TEXT); - $stmt->bindValue(6, $scoreChange, SQLITE3_REAL); + $stmt->bindValue(6, $scoreChange, SQLITE3_FLOAT); $stmt->bindValue(7, $createdAt, SQLITE3_INTEGER); $stmt->bindValue(8, $approvedAt, SQLITE3_INTEGER); $stmt->bindValue(9, $reason, SQLITE3_TEXT);