Browse Source

✨ feat: 增加账号时支持设置自动乐跑

Pchen. 8 months ago
parent
commit
4f4cb1a884
1 changed files with 5 additions and 5 deletions
  1. 5 5
      apis/Lepao/Account/AddAccount.js

+ 5 - 5
apis/Lepao/Account/AddAccount.js

@@ -12,7 +12,7 @@ class AddAccount extends API {
     }
 
     async onRequest(req, res) {
-        let { uuid, session, student_num, email, id, area, max_distance, min_distance, auto_time, notes } = req.body
+        let { uuid, session, student_num, email, id, area, max_distance, min_distance, auto_time, auto_run, notes } = req.body
 
         if ([uuid, session, student_num, email, auto_time].some(value => value === '' || value === null || value === undefined))
             return res.json({
@@ -76,11 +76,11 @@ class AddAccount extends API {
         let sql, r
 
         if (!id) {
-            sql = 'INSERT INTO lepao_account (student_num, email, area, auto_time, create_user, create_time, notes) VALUES (?, ?, ?, ?, ?, ?, ?)'
-            r = await db.query(sql, [student_num, email, area, auto_time, uuid, time, notes ?? ''])
+            sql = 'INSERT INTO lepao_account (student_num, email, area, auto_time, auto_run, create_user, create_time, notes) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'
+            r = await db.query(sql, [student_num, email, area, auto_time, auto_run, uuid, time, notes ?? ''])
         } else {
-            sql = 'UPDATE lepao_account SET student_num = ?, email = ?, area = ?, auto_time = ?, update_time = ?, notes = ? WHERE id = ?'
-            r = await db.query(sql, [student_num, email, area, auto_time, time, notes ?? '', id])
+            sql = 'UPDATE lepao_account SET student_num = ?, email = ?, area = ?, auto_time = ?, auto_run = ?, update_time = ?, notes = ? WHERE id = ?'
+            r = await db.query(sql, [student_num, email, area, auto_time, auto_run, time, notes ?? '', id])
         }
 
         try {