Taio_O 4 周之前
父節點
當前提交
a7a1a172bd
共有 3 個文件被更改,包括 16 次插入8 次删除
  1. 2 2
      admin/config/initDb.js
  2. 5 5
      admin/models/Transaction.js
  3. 9 1
      admin/views/groups.html

+ 2 - 2
admin/config/initDb.js

@@ -41,7 +41,7 @@ async function initDatabase() {
                 id INT AUTO_INCREMENT PRIMARY KEY,
                 group_id VARCHAR(255) NOT NULL UNIQUE,
                 group_name VARCHAR(255) NOT NULL,
-                group_type ENUM('personal', 'public') NOT NULL,
+                group_type ENUM('personal', 'private', 'public') NOT NULL DEFAULT 'public' COMMENT '群组类型:个人用户/私聊群组/公开群组',
                 creator_id VARCHAR(255) NOT NULL,
                 is_active BOOLEAN DEFAULT true,
                 last_join_time DATETIME DEFAULT CURRENT_TIMESTAMP,
@@ -54,7 +54,7 @@ async function initDatabase() {
         try {
             await pool.query(`
                 ALTER TABLE groups
-                ADD COLUMN group_type ENUM('personal', 'public', 'private') NOT NULL DEFAULT 'public' COMMENT '群组类型:个人用户/公开群聊/隐私群聊' AFTER group_name,
+                ADD COLUMN group_type ENUM('personal', 'private', 'public') NOT NULL DEFAULT 'public' COMMENT '群组类型:个人用户/私聊群组/公开群组' AFTER group_name,
                 ADD COLUMN fee_rate DECIMAL(5,2) DEFAULT 0.00 COMMENT '费率' AFTER group_type,
                 ADD COLUMN exchange_rate DECIMAL(10,4) DEFAULT 1.0000 COMMENT '汇率' AFTER fee_rate,
                 ADD COLUMN admin_id INT NOT NULL COMMENT '管理员ID' AFTER exchange_rate,

+ 5 - 5
admin/models/Transaction.js

@@ -102,8 +102,8 @@ const Transaction = {
                 params.push(query.groupId);
             }
 
-            console.log('SQL查询:', sql);
-            console.log('参数:', params);
+            // console.log('SQL查询:', sql);
+            // console.log('参数:', params);
 
             // 获取总数
             const countSql = `
@@ -118,15 +118,15 @@ const Transaction = {
             
             const [countResult] = await pool.query(countSql, params);
             const total = countResult[0]?.total || 0;
-            console.log('查询总数:', total);
+            // console.log('查询总数:', total);
 
             // 获取分页数据
             sql += ' ORDER BY t.time DESC LIMIT ? OFFSET ?';
             params.push(limit, (page - 1) * limit);
 
             const [rows] = await pool.query(sql, params);
-            console.log('查询结果数量:', rows.length);
-            console.log('查询结果:', rows);
+            // console.log('查询结果数量:', rows.length);
+            // console.log('查询结果:', rows);
 
             return {
                 transactions: rows,

+ 9 - 1
admin/views/groups.html

@@ -262,7 +262,15 @@
             groupsList.innerHTML = groups.map(group => `
                 <tr>
                     <td>${group.group_id}</td>
-                    <td>${group.group_name}</td>
+                    <td>
+                        ${group.group_type === 'public' ? 
+                            `<a href="https://t.me/${group.group_name}" target="_blank" class="text-decoration-none">
+                                ${group.group_name}
+                                <i class="bi bi-box-arrow-up-right"></i>
+                            </a>` : 
+                            group.group_name
+                        }
+                    </td>
                     <td>
                         <span class="badge ${group.is_active ? 'bg-success' : 'bg-danger'}">
                             ${group.is_active ? '启用' : '禁用'}