Browse Source

🐞 fix: 修复部分bug'

Pchen. 1 month ago
parent
commit
f753c53aca
1 changed files with 12 additions and 4 deletions
  1. 12 4
      lib/Lepao/Mcp.js

+ 12 - 4
lib/Lepao/Mcp.js

@@ -20,7 +20,15 @@ class Mcp {
             { label: '周日', value: 0 }
         ]
 
-        this.area = ["兰花湖校区跑区", "主校区北跑区", "主校区南跑区", "重庆工商大学茶园校区","随机分配"]
+        this.area = ["兰花湖校区跑区", "主校区北跑区", "主校区南跑区", "重庆工商大学茶园校区", "随机分配"]
+
+        this.auto_time = [
+            { label: '随机分配', value: -1 },
+            ...Array.from({ length: 17 }, (_, i) => {
+                const hour = i + 7
+                return { label: `${hour} ~ ${hour + 1}时`, value: hour }
+            })
+        ]
 
         this.autoTimeLabel = (record) => {
             if (record.auto_time === -1) {
@@ -28,7 +36,7 @@ class Mcp {
                     return `随机-今日${record.today_auto_time}时`
                 return '随机-待分配'
             }
-            const match = auto_time.find(item => item.value === record.auto_time)
+            const match = this.auto_time.find(item => item.value === record.auto_time)
             return match ? match.label : '-'
         }
 
@@ -255,8 +263,8 @@ class Mcp {
                 return '缺少参数'
 
             this.logger.info(`MCP接收更换跑区请求:${sender},area:${area}`)
-            
-            if(!this.area.includes(area)) return '系统无该跑区,无法设置'
+
+            if (!this.area.includes(area)) return '系统无该跑区,无法设置'
 
             let insertSql = `
                 UPDATE