修正按讚、儀表板彙總 BUG
This commit is contained in:
@@ -8,10 +8,10 @@ import { dbSync } from './database-sync';
|
||||
|
||||
// 資料庫配置 - 強制快速釋放連線
|
||||
const dbConfig = {
|
||||
host: process.env.DB_HOST || '122.100.99.161',
|
||||
port: parseInt(process.env.DB_PORT || '43306'),
|
||||
user: process.env.DB_USER || 'A999',
|
||||
password: process.env.DB_PASSWORD || '1023',
|
||||
host: process.env.DB_HOST || 'mysql.theaken.com',
|
||||
port: parseInt(process.env.DB_PORT || '33306'),
|
||||
user: process.env.DB_USER || 'AI_Platform',
|
||||
password: process.env.DB_PASSWORD || 'Aa123456',
|
||||
database: process.env.DB_NAME || 'db_AI_Platform',
|
||||
charset: 'utf8mb4',
|
||||
timezone: '+08:00',
|
||||
|
@@ -582,6 +582,9 @@ export class UserService extends DatabaseServiceBase {
|
||||
totalUsers: number;
|
||||
activeUsers: number;
|
||||
totalApps: number;
|
||||
activeApps: number;
|
||||
inactiveApps: number;
|
||||
pendingApps: number;
|
||||
totalCompetitions: number;
|
||||
totalReviews: number;
|
||||
totalViews: number;
|
||||
@@ -598,11 +601,12 @@ export class UserService extends DatabaseServiceBase {
|
||||
const appStatsSql = `
|
||||
SELECT
|
||||
COUNT(*) as total_apps,
|
||||
COUNT(CASE WHEN is_active = 1 THEN 1 END) as active_apps,
|
||||
COUNT(CASE WHEN is_active = FALSE THEN 1 END) as inactive_apps,
|
||||
COUNT(CASE WHEN created_at >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) THEN 1 END) as new_apps_this_month,
|
||||
COALESCE(SUM(views_count), 0) as total_views,
|
||||
COALESCE(SUM(likes_count), 0) as total_likes
|
||||
FROM apps
|
||||
WHERE is_active = 1
|
||||
FROM apps
|
||||
`;
|
||||
const appStats = await this.queryOne(appStatsSql);
|
||||
|
||||
@@ -667,6 +671,9 @@ export class UserService extends DatabaseServiceBase {
|
||||
totalUsers: userStats.totalUsers,
|
||||
activeUsers: userStats.activeUsers,
|
||||
totalApps: appStats?.total_apps || 0,
|
||||
activeApps: appStats?.active_apps || 0,
|
||||
inactiveApps: appStats?.inactive_apps || 0,
|
||||
pendingApps: 0, // 目前沒有pending狀態的應用
|
||||
totalCompetitions: competitionStats?.total_competitions || 0,
|
||||
totalReviews: reviewStats?.total_reviews || 0,
|
||||
totalViews: appStats?.total_views || 0,
|
||||
@@ -681,6 +688,9 @@ export class UserService extends DatabaseServiceBase {
|
||||
totalUsers: 0,
|
||||
activeUsers: 0,
|
||||
totalApps: 0,
|
||||
activeApps: 0,
|
||||
inactiveApps: 0,
|
||||
pendingApps: 0,
|
||||
totalCompetitions: 0,
|
||||
totalReviews: 0,
|
||||
totalViews: 0,
|
||||
@@ -3022,6 +3032,9 @@ export class AppService extends DatabaseServiceBase {
|
||||
totalUsers: number;
|
||||
activeUsers: number;
|
||||
totalApps: number;
|
||||
activeApps: number;
|
||||
inactiveApps: number;
|
||||
pendingApps: number;
|
||||
totalCompetitions: number;
|
||||
totalReviews: number;
|
||||
totalViews: number;
|
||||
@@ -3109,6 +3122,9 @@ export class AppService extends DatabaseServiceBase {
|
||||
totalUsers: userStats.totalUsers,
|
||||
activeUsers: userStats.activeUsers,
|
||||
totalApps: appStats?.total_apps || 0,
|
||||
activeApps: appStats?.active_apps || 0,
|
||||
inactiveApps: appStats?.inactive_apps || 0,
|
||||
pendingApps: 0, // 目前沒有pending狀態的應用
|
||||
totalCompetitions: competitionStats?.total_competitions || 0,
|
||||
totalReviews: reviewStats?.total_reviews || 0,
|
||||
totalViews: appStats?.total_views || 0,
|
||||
@@ -3123,6 +3139,9 @@ export class AppService extends DatabaseServiceBase {
|
||||
totalUsers: 0,
|
||||
activeUsers: 0,
|
||||
totalApps: 0,
|
||||
activeApps: 0,
|
||||
inactiveApps: 0,
|
||||
pendingApps: 0,
|
||||
totalCompetitions: 0,
|
||||
totalReviews: 0,
|
||||
totalViews: 0,
|
||||
|
Reference in New Issue
Block a user