|
|
@@ -20,6 +20,8 @@ class Mcp {
|
|
|
{ label: '周日', value: 0 }
|
|
|
]
|
|
|
|
|
|
+ this.area = ["兰花湖校区跑区", "主校区北跑区", "主校区南跑区", "重庆工商大学茶园校区","随机分配"]
|
|
|
+
|
|
|
this.autoTimeLabel = (record) => {
|
|
|
if (record.auto_time === -1) {
|
|
|
if (record.today_auto_time)
|
|
|
@@ -247,6 +249,38 @@ class Mcp {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async change_area({ sender, area }) {
|
|
|
+ try {
|
|
|
+ if ([sender, area].some(value => value === '' || value === null || value === undefined))
|
|
|
+ return '缺少参数'
|
|
|
+
|
|
|
+ this.logger.info(`MCP接收更换跑区请求:${sender},area:${area}`)
|
|
|
+
|
|
|
+ if(!this.area.includes(area)) return '系统无该跑区,无法设置'
|
|
|
+
|
|
|
+ let insertSql = `
|
|
|
+ UPDATE
|
|
|
+ lepao_account la
|
|
|
+ JOIN
|
|
|
+ lepao_extra le
|
|
|
+ ON
|
|
|
+ la.student_num = le.student_num
|
|
|
+ SET
|
|
|
+ la.area = ?
|
|
|
+ WHERE
|
|
|
+ le.bot_account = ?
|
|
|
+ `
|
|
|
+ let insertRows = await db.query(insertSql, [area === "随机分配" ? '' : area, sender])
|
|
|
+ if (!insertRows || insertRows.affectedRows === 0)
|
|
|
+ return '系统出错,请稍后再试'
|
|
|
+
|
|
|
+ return `操作成功`
|
|
|
+ } catch (error) {
|
|
|
+ this.logger.error(`MCP更换跑区出错:${error.stack}`)
|
|
|
+ return '系统出错,请稍后再试'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async change_auto_time({ sender, auto_time }) {
|
|
|
try {
|
|
|
if ([sender, auto_time].some(value => value === '' || value === null || value === undefined))
|