|
|
@@ -102,19 +102,25 @@ class AddAccount extends API {
|
|
|
}
|
|
|
|
|
|
const time = new Date().getTime()
|
|
|
+ let sql, r, user_avatar
|
|
|
|
|
|
- let sql, r
|
|
|
+ // 生成用户头像
|
|
|
+ if (email.split('@')[1].toLowerCase() === 'qq.com' && this.isQQ(email.split('@')[0])) {
|
|
|
+ user_avatar = `https://q2.qlogo.cn/headimg_dl?dst_uin=${email}&spec=640`
|
|
|
+ } else {
|
|
|
+ user_avatar = userInfo.sex === 0 ? 'https://lepao-cloud.xxoo365.top/view.php/aee85ff43fd30d0df03c6a7dd9797d22.png' : 'https://lepao-cloud.xxoo365.top/view.php/fcb54dcc5e6209381e972ef73bdb4a93.png'
|
|
|
+ }
|
|
|
|
|
|
if (!id) {
|
|
|
if (countRows.length !== 0) {
|
|
|
- sql = 'UPDATE lepao_account SET create_user = ?, email = ?, area = ?, auto_time = ?, auto_run = ?, target_count = ?, create_time = ?, update_time = ?, notes = ?, auto_day = ?, notice_type = ? WHERE id = ?'
|
|
|
- r = await db.query(sql, [uuid, email ?? '', area, auto_time, auto_run, targetKm, time, time, notes ?? '', JSON.stringify(auto_day), notice_type, countRows[0].id])
|
|
|
+ sql = 'UPDATE lepao_account SET create_user = ?, email = ?, user_avatar = ?, area = ?, auto_time = ?, auto_run = ?, target_count = ?, create_time = ?, update_time = ?, notes = ?, auto_day = ?, notice_type = ? WHERE id = ?'
|
|
|
+ r = await db.query(sql, [uuid, email ?? '', user_avatar ?? '', area, auto_time, auto_run, targetKm, time, time, notes ?? '', JSON.stringify(auto_day), notice_type, countRows[0].id])
|
|
|
}
|
|
|
else {
|
|
|
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, notice_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
- r = await db.query(sql, [student_num, email ?? '', area, auto_time, auto_run, targetKm, uuid, time, notes ?? '', JSON.stringify(auto_day), notice_type])
|
|
|
+ sql = 'INSERT INTO lepao_account (student_num, email, user_avatar, area, auto_time, auto_run, target_count, create_user, create_time, notes, auto_day, notice_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
+ r = await db.query(sql, [student_num, email ?? '', user_avatar ?? '', area, auto_time, auto_run, targetKm, uuid, time, notes ?? '', JSON.stringify(auto_day), notice_type])
|
|
|
|
|
|
let faceSql = 'INSERT INTO lepao_extra (student_num, bind_code) VALUES (?, ?)'
|
|
|
let faceRows = await db.query(faceSql, [student_num, bind_code])
|