Selaa lähdekoodia

修复每日done-rate统计bug

guoziyun 9 kuukautta sitten
vanhempi
sitoutus
22fe751f6a

+ 0 - 2
oms/dist/services/cron-jobs/done-rate.js

@@ -42,7 +42,6 @@ async function run() {
         AND time < toDateTime('${(0, dayjs_1.default)(yesterdayEnd).toISOString()}')
       GROUP BY res
       HAVING res IS NOT NULL
-      FORMAT JSONEachRow
     `;
         const startResults = await app_1.clickhouseService.queryEvents(startCountsQuery);
         const artworkStartCounts = new Map();
@@ -66,7 +65,6 @@ async function run() {
         AND time < toDateTime('${(0, dayjs_1.default)(yesterdayEnd).toISOString()}')
       GROUP BY res
       HAVING res IS NOT NULL
-      FORMAT JSONEachRow
     `;
         const doneResults = await app_1.clickhouseService.queryEvents(doneCountsQuery);
         const artworkDoneCounts = new Map();

+ 1 - 1
oms/dist/services/cron-jobs/index.js

@@ -12,7 +12,7 @@ const database_1 = require("../../src/database");
 const settings = [
     // 假设这些文件将存在于 oms/services/cron-jobs/ 目录下
     ["sync", "*/10 * * * *", require("./sync/sync-service")], // 每10分钟跑一次同步
-    ["done-rate", "10 0 * * *", require("./done-rate")], // 每天凌晨0点10分, 统计作品完成率
+    ["done-rate", "30 0 * * *", require("./done-rate")], // 每天凌晨0点10分, 统计作品完成率
     ["daily-activity-detector", "50 0 * * *", require("./daily-activity-detector")], // 每天凌晨0点50分, 检查是否需要生成新的推送消息
     ["message-sender", "*/5 * * * *", require("./message-sender")], // 每5分钟运行一次
 ];

+ 1 - 0
oms/dist/src/services/userService.js

@@ -85,6 +85,7 @@ class UserService {
             const [users, total] = await Promise.all([
                 // 👈 关键修改:将 query 断言为 FilterQuery<IUser>
                 userModel_1.User.find(query)
+                    .sort({ createdAt: -1 })
                     .skip(skip)
                     .limit(limit)
                     .exec(),

+ 1 - 1
oms/public/app/index.html

@@ -9,5 +9,5 @@
   <style>body,html{width:100%;height:100%}*,:after,:before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}body{margin:0;color:#000000d9;font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-variant:tabular-nums;line-height:1.5715;background-color:#fff;font-feature-settings:"tnum"}html{--antd-wave-shadow-color:#1890ff;--scroll-bar:0}</style><link rel="stylesheet" href="styles-LXBSU6DF.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-LXBSU6DF.css"></noscript></head>
   <body>
     <app-root></app-root>
-  <script src="polyfills-B6TNHZQ6.js" type="module"></script><script src="main-67SRJ75K.js" type="module"></script></body>
+  <script src="polyfills-B6TNHZQ6.js" type="module"></script><script src="main-3CMDP6H5.js" type="module"></script></body>
 </html>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
oms/public/app/main-3CMDP6H5.js


+ 0 - 2
oms/services/cron-jobs/done-rate.ts

@@ -63,7 +63,6 @@ async function run(): Promise<string> {
         AND time < toDateTime('${dayjs(yesterdayEnd).toISOString()}')
       GROUP BY res
       HAVING res IS NOT NULL
-      FORMAT JSONEachRow
     `;
     const startResults = await clickhouseService.queryEvents<ClickHouseStartCountResult>(startCountsQuery);
     const artworkStartCounts = new Map<string, number>();
@@ -87,7 +86,6 @@ async function run(): Promise<string> {
         AND time < toDateTime('${dayjs(yesterdayEnd).toISOString()}')
       GROUP BY res
       HAVING res IS NOT NULL
-      FORMAT JSONEachRow
     `;
     const doneResults = await clickhouseService.queryEvents<ClickHouseDoneCountResult>(doneCountsQuery);
     const artworkDoneCounts = new Map<string, number>();

+ 1 - 1
oms/services/cron-jobs/index.ts

@@ -14,7 +14,7 @@ interface CronJobModule {
 const settings: [string, string, CronJobModule][] = [
   // 假设这些文件将存在于 oms/services/cron-jobs/ 目录下
   ["sync", "*/10 * * * *", require("./sync/sync-service") as CronJobModule], // 每10分钟跑一次同步
-  ["done-rate", "10 0 * * *", require("./done-rate") as CronJobModule], // 每天凌晨0点10分, 统计作品完成率
+  ["done-rate", "30 0 * * *", require("./done-rate") as CronJobModule], // 每天凌晨0点10分, 统计作品完成率
   ["daily-activity-detector", "50 0 * * *", require("./daily-activity-detector") as CronJobModule], // 每天凌晨0点50分, 检查是否需要生成新的推送消息
   ["message-sender", "*/5 * * * *", require("./message-sender") as CronJobModule], // 每5分钟运行一次
 ];

+ 1 - 0
oms/src/services/userService.ts

@@ -90,6 +90,7 @@ class UserService {
       const [users, total] = await Promise.all([
         // 👈 关键修改:将 query 断言为 FilterQuery<IUser>
         User.find(query as FilterQuery<IUser>)
+          .sort({ createdAt: -1 })
           .skip(skip)
           .limit(limit)
           .exec(),

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä