|
|
@@ -15,6 +15,10 @@ class AddAccount extends API {
|
|
|
this.banEmailList = ['icloud.com']
|
|
|
}
|
|
|
|
|
|
+ isQQ(str) {
|
|
|
+ const reg = /^[1-9][0-9]{4,10}$/
|
|
|
+ return reg.test(str)
|
|
|
+ }
|
|
|
|
|
|
async onRequest(req, res) {
|
|
|
let { uuid, session, student_num, email, id, area, auto_time, auto_run, target_count, password, auto_day, notes } = req.body
|
|
|
@@ -109,7 +113,12 @@ class AddAccount extends API {
|
|
|
r = await db.query(sql, [uuid, email, area, auto_time, auto_run, target_count, time, notes ?? '', userInfo.frequency, JSON.stringify(auto_day), countRows[0].id])
|
|
|
}
|
|
|
else {
|
|
|
- const user_avatar = userInfo.sex === 0 ? 'https://lepao-cloud.xxoo365.top/view.php/aee85ff43fd30d0df03c6a7dd9797d22.png' : 'https://lepao-cloud.xxoo365.top/view.php/fcb54dcc5e6209381e972ef73bdb4a93.png'
|
|
|
+ let user_avatar = ''
|
|
|
+ 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'
|
|
|
+ }
|
|
|
sql = 'INSERT INTO lepao_account (student_num, name, user_avatar, grade_id, uid, sex, total_num, email, area, auto_time, auto_run, target_count, create_user, create_time, notes, password, auto_day) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
r = await db.query(sql, [student_num, userInfo.nickName, user_avatar, userInfo.department, userInfo.id, userInfo.sex, userInfo.frequency, email, area, auto_time, auto_run, target_count, uuid, time, notes ?? '', password, JSON.stringify(auto_day)])
|
|
|
}
|