|
@@ -78,18 +78,6 @@ class AddAccount extends API {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
let countSql = 'SELECT id, create_user, total_num FROM lepao_account WHERE student_num = ?'
|
|
let countSql = 'SELECT id, create_user, total_num FROM lepao_account WHERE student_num = ?'
|
|
|
- countSql = `
|
|
|
|
|
- SELECT
|
|
|
|
|
- a.id, a.create_user, a.total_num, e.bind_code, e.bot_account
|
|
|
|
|
- FROM
|
|
|
|
|
- lepao_account a
|
|
|
|
|
- LEFT JOIN
|
|
|
|
|
- lepao_extra e
|
|
|
|
|
- ON
|
|
|
|
|
- a.student_num = e.student_num
|
|
|
|
|
- WHERE
|
|
|
|
|
- a.student_num = ?
|
|
|
|
|
- `
|
|
|
|
|
let countRows = await db.query(countSql, [student_num])
|
|
let countRows = await db.query(countSql, [student_num])
|
|
|
|
|
|
|
|
if (!countRows)
|
|
if (!countRows)
|
|
@@ -136,13 +124,29 @@ class AddAccount extends API {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
if (r && r.affectedRows > 0) {
|
|
if (r && r.affectedRows > 0) {
|
|
|
|
|
+ const selectSql = `
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id, a.create_user, a.total_num, e.bind_code, e.bot_account
|
|
|
|
|
+ FROM
|
|
|
|
|
+ lepao_account a
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ lepao_extra e
|
|
|
|
|
+ ON
|
|
|
|
|
+ a.student_num = e.student_num
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ a.student_num = ?
|
|
|
|
|
+ `
|
|
|
|
|
+ const selectRows = await db.query(selectSql, [student_num])
|
|
|
|
|
+ if (!selectRows)
|
|
|
|
|
+ return res.json({ ...BaseStdResponse.ERR, msg: '添加乐跑账号失败!数据库错误' })
|
|
|
|
|
+
|
|
|
res.json({
|
|
res.json({
|
|
|
...BaseStdResponse.OK,
|
|
...BaseStdResponse.OK,
|
|
|
id: r.insertId,
|
|
id: r.insertId,
|
|
|
data: {
|
|
data: {
|
|
|
student_num, email, id, area, auto_time, auto_run, target_count, auto_day, notice_type, notes,
|
|
student_num, email, id, area, auto_time, auto_run, target_count, auto_day, notice_type, notes,
|
|
|
- bind_code: countRows.length !== 0 ? countRows[0].bind_code : undefined,
|
|
|
|
|
- bot_account: countRows.length !== 0 ? countRows[0].bot_account : undefined
|
|
|
|
|
|
|
+ bind_code: selectRows.length !== 0 ? selectRows[0].bind_code : undefined,
|
|
|
|
|
+ bot_account: selectRows.length !== 0 ? selectRows[0].bot_account : undefined
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|