Browse Source

✨ feat: 增加bot_account等查询

Pchen. 1 month ago
parent
commit
09955deaeb
2 changed files with 20 additions and 2 deletions
  1. 19 1
      apis/Lepao/Account/Admin/GetAccountList.js
  2. 1 1
      lib/Lepao/Mcp.js

+ 19 - 1
apis/Lepao/Account/Admin/GetAccountList.js

@@ -12,7 +12,7 @@ class GetAccountList extends API {
     }
 
     async onRequest(req, res) {
-        let { uuid, session, email, area, user_uuid, username, student_num, state, auto_time, queryTime, pagesize, current } = req.query
+        let { uuid, session, email, area, user_uuid, username, student_num, state, auto_time, queryTime, bind_code, bot_account, pagesize, current } = req.query
 
         if ([uuid, session, pagesize, current].some(value => value === '' || value === null || value === undefined))
             return res.json({
@@ -105,6 +105,10 @@ class GetAccountList extends API {
                 users u
             ON 
                 l.create_user = u.uuid
+            LEFT JOIN 
+                lepao_extra f 
+            ON
+                l.student_num = f.student_num
             WHERE 1 = 1
         `
 
@@ -146,6 +150,20 @@ class GetAccountList extends API {
             countParams.push(`%${username}%`)
         }
 
+        if (bind_code) {
+            sql += ` AND f.bind_code = ?`
+            countSql += ` AND f.bind_code = ?`
+            params.push(bind_code)
+            countParams.push(bind_code)
+        }
+
+        if (bot_account) {
+            sql += ` AND f.bot_account = ?`
+            countSql += ` AND f.bot_account = ?`
+            params.push(bot_account)
+            countParams.push(bot_account)
+        }
+
         if (auto_time !== 0) {
             sql += ` AND l.auto_time = ?`
             countSql += ` AND l.auto_time = ?`

+ 1 - 1
lib/Lepao/Mcp.js

@@ -124,7 +124,7 @@ class Mcp {
                 returnMsg += `自动乐跑时间:${this.autoTimeLabel(data)};`
                 returnMsg += `自动乐跑星期:${data.auto_day.slice().sort((a, b) => {
                     if (a === 0) return 1; if (b === 0) return -1; return a - b;
-                }).map(day => this.auto_day.find(item => item.value === day)?.label).join(',').replace(/周/g, '')};`
+                }).map(day => this.auto_day.find(item => item.value === day)?.label).join(',')};`
             }
             if (data.sex) returnMsg += `性别:${data.sex === 1 ? '男' : '女'};`
             if (data.email) returnMsg += `邮箱:${data.email};`