- 网站名称:影响浏览器标签页标题。
diff --git a/admin/binary.php b/admin/binary.php
index 4e0fac0..90720af 100644
--- a/admin/binary.php
+++ b/admin/binary.php
@@ -9,6 +9,28 @@ if (!hasPermission('view_orders')) {
exit;
}
+// Auto-settle expired orders
+$db->beginTransaction();
+try {
+ $stmt = $db->prepare("SELECT o.*, u.win_loss_control as user_control FROM binary_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 'pending' AND DATE_ADD(o.created_at, INTERVAL o.duration SECOND) <= NOW()");
+ $stmt->execute();
+ $expired = $stmt->fetchAll();
+ foreach ($expired as $o) {
+ $result = ($o['control_status'] == 1 || $o['user_control'] == 1) ? 'won' : (($o['control_status'] == 2 || $o['user_control'] == 2) ? 'lost' : ((rand(0, 100) > 50) ? 'won' : 'lost'));
+ $db->prepare("UPDATE binary_orders SET status = ?, settled_at = NOW() WHERE id = ?")->execute([$result, $o['id']]);
+ if ($result === 'won') {
+ $win_amount = $o['amount'] + ($o['amount'] * $o['profit_rate'] / 100);
+ $db->prepare("UPDATE user_balances SET available = available + ? WHERE user_id = ? AND symbol = 'USDT'")->execute([$win_amount, $o['user_id']]);
+ $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_win', ?, 'USDT', 'completed')")->execute([$o['user_id'], $win_amount]);
+ } else {
+ $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_loss', ?, 'USDT', 'completed')")->execute([$o['user_id'], $o['amount']]);
+ }
+ }
+ $db->commit();
+} catch (Exception $e) {
+ $db->rollBack();
+}
+
// Handle Control Update
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
if ($_POST['action'] === 'set_control') {
@@ -78,8 +100,11 @@ $orders = $stmt->fetchAll();
= $o['symbol'] ?>
-
- = $o['direction'] === 'buy' ? '买涨 ↑' : '买跌 ↓' ?>
+
+
+ = $is_up ? '买涨 ↑' : '买跌 ↓' ?>
|
diff --git a/admin/finance.php b/admin/finance.php
index 15d1a6f..209549f 100644
--- a/admin/finance.php
+++ b/admin/finance.php
@@ -151,6 +151,11 @@ $requests = $stmt->fetchAll();
= $r['type'] === 'recharge' ? '+' : '-' ?> = number_format($r['amount'], 2) ?> = $r['symbol'] ?>
+
+
+ ≈ = number_format($r['fiat_amount'], 2) ?> = $r['fiat_currency'] ?>
+
+
|
diff --git a/admin/layout.php b/admin/layout.php
index f685832..3dbd485 100644
--- a/admin/layout.php
+++ b/admin/layout.php
@@ -160,17 +160,29 @@ function renderAdminPage($content, $title = '后台管理') {
- 充提管理
+
+ 充提管理
+ 0
+
- 秒合约管理
+
+ 财务明细
+
+
+ 秒合约管理
+ 0
+
永续合约
币币交易
- 实名认证
+
+ 实名认证
+ 0
+
@@ -191,6 +203,12 @@ function renderAdminPage($content, $title = '后台管理') {
欢迎您, = htmlspecialchars($admin['username']) ?>
+
+
+
+ 0
+
+
返回首页
登出
@@ -200,6 +218,99 @@ function renderAdminPage($content, $title = '后台管理') {
= $content ?>
+
|