|
@@ -33,12 +33,11 @@ class AddAccount extends API {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async onRequest(req, res) {
|
|
async onRequest(req, res) {
|
|
|
- let { uuid, session, student_num, email, id, area, auto_time, auto_run, notes } = req.body
|
|
|
|
|
|
|
+ let { uuid, session, student_num, email, id, area, auto_time, auto_run, target_count, notes } = req.body
|
|
|
|
|
|
|
|
- if ([uuid, session, student_num, email, auto_time].some(value => value === '' || value === null || value === undefined))
|
|
|
|
|
|
|
+ if ([uuid, session, student_num, email, auto_time, target_count].some(value => value === '' || value === null || value === undefined))
|
|
|
return res.json({
|
|
return res.json({
|
|
|
- ...BaseStdResponse.MISSING_PARAMETER,
|
|
|
|
|
- endpoint: 1513126
|
|
|
|
|
|
|
+ ...BaseStdResponse.MISSING_PARAMETER
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
if (!await AccessControl.checkSession(uuid, session))
|
|
if (!await AccessControl.checkSession(uuid, session))
|
|
@@ -67,14 +66,14 @@ class AddAccount extends API {
|
|
|
|
|
|
|
|
if (!id) {
|
|
if (!id) {
|
|
|
if (countRows.length !== 0) {
|
|
if (countRows.length !== 0) {
|
|
|
- sql = 'UPDATE lepao_account SET create_user = ?, email = ?, area = ?, auto_time = ?, auto_run = ?, create_time = ?, notes = ? WHERE id = ?'
|
|
|
|
|
- r = await db.query(sql, [uuid, email, area, auto_time, auto_run, time, notes ?? '', countRows[0].id])
|
|
|
|
|
|
|
+ sql = 'UPDATE lepao_account SET create_user = ?, email = ?, area = ?, auto_time = ?, auto_run = ?, target_count = ?, create_time = ?, notes = ? WHERE id = ?'
|
|
|
|
|
+ r = await db.query(sql, [uuid, email, area, auto_time, auto_run, target_count, time, notes ?? '', countRows[0].id])
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
const face_code = await this.generateCode()
|
|
const face_code = await this.generateCode()
|
|
|
|
|
|
|
|
- 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 ?? ''])
|
|
|
|
|
|
|
+ sql = 'INSERT INTO lepao_account (student_num, email, area, auto_time, auto_run, target_count, create_user, create_time, notes) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
|
|
+ r = await db.query(sql, [student_num, email, area, auto_time, auto_run, target_count, uuid, time, notes ?? ''])
|
|
|
|
|
|
|
|
let faceSql = 'INSERT INTO lepao_face (student_num, face_code) VALUES (?, ?)'
|
|
let faceSql = 'INSERT INTO lepao_face (student_num, face_code) VALUES (?, ?)'
|
|
|
let faceRows = await db.query(faceSql, [student_num, face_code])
|
|
let faceRows = await db.query(faceSql, [student_num, face_code])
|
|
@@ -82,8 +81,8 @@ class AddAccount extends API {
|
|
|
return res.json({ ...BaseStdResponse.ERR, msg: '添加乐跑账号失败!数据库错误' })
|
|
return res.json({ ...BaseStdResponse.ERR, msg: '添加乐跑账号失败!数据库错误' })
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- sql = 'UPDATE lepao_account SET student_num = ?, email = ?, area = ?, auto_time = ?, auto_run = ?, notes = ? WHERE id = ?'
|
|
|
|
|
- r = await db.query(sql, [student_num, email, area, auto_time, auto_run, notes ?? '', id])
|
|
|
|
|
|
|
+ sql = 'UPDATE lepao_account SET student_num = ?, email = ?, area = ?, auto_time = ?, target_count = ?, auto_run = ?, notes = ? WHERE id = ?'
|
|
|
|
|
+ r = await db.query(sql, [student_num, email, area, auto_time, target_count, auto_run, notes ?? '', id])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|