|
@@ -23,7 +23,7 @@ class AddAccount extends API {
|
|
|
code += chars.charAt(Math.floor(Math.random() * chars.length))
|
|
code += chars.charAt(Math.floor(Math.random() * chars.length))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let sql = 'SELECT id FROM lepao_face WHERE face_code = ?'
|
|
|
|
|
|
|
+ let sql = 'SELECT id FROM lepao_extra WHERE bind_code = ?'
|
|
|
let rows = await db.query(sql, [code])
|
|
let rows = await db.query(sql, [code])
|
|
|
if (!rows)
|
|
if (!rows)
|
|
|
throw new Error('数据库错误,请稍后再试')
|
|
throw new Error('数据库错误,请稍后再试')
|
|
@@ -105,13 +105,13 @@ class AddAccount extends API {
|
|
|
r = await db.query(sql, [uuid, email, area, auto_time, auto_run, target_count, time, time, notes ?? '', JSON.stringify(auto_day), countRows[0].id])
|
|
r = await db.query(sql, [uuid, email, area, auto_time, auto_run, target_count, time, time, notes ?? '', JSON.stringify(auto_day), countRows[0].id])
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- const face_code = await this.generateCode()
|
|
|
|
|
|
|
+ const bind_code = await this.generateCode()
|
|
|
|
|
|
|
|
sql = 'INSERT INTO lepao_account (student_num, email, area, auto_time, auto_run, target_count, create_user, create_time, notes, auto_day) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
sql = 'INSERT INTO lepao_account (student_num, email, area, auto_time, auto_run, target_count, create_user, create_time, notes, auto_day) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
r = await db.query(sql, [student_num, email, area, auto_time, auto_run, target_count, uuid, time, notes ?? '', JSON.stringify(auto_day)])
|
|
r = await db.query(sql, [student_num, email, area, auto_time, auto_run, target_count, uuid, time, notes ?? '', JSON.stringify(auto_day)])
|
|
|
|
|
|
|
|
- let faceSql = 'INSERT INTO lepao_face (student_num, face_code) VALUES (?, ?)'
|
|
|
|
|
- let faceRows = await db.query(faceSql, [student_num, face_code])
|
|
|
|
|
|
|
+ let faceSql = 'INSERT INTO lepao_extra (student_num, bind_code) VALUES (?, ?)'
|
|
|
|
|
+ let faceRows = await db.query(faceSql, [student_num, bind_code])
|
|
|
if (!faceRows || faceRows.affectedRows !== 1)
|
|
if (!faceRows || faceRows.affectedRows !== 1)
|
|
|
return res.json({ ...BaseStdResponse.ERR, msg: '添加乐跑账号失败!数据库错误' })
|
|
return res.json({ ...BaseStdResponse.ERR, msg: '添加乐跑账号失败!数据库错误' })
|
|
|
}
|
|
}
|