修正无CK用户绑定UID无效的问题
This commit is contained in:
parent
ae0e98b943
commit
072df17f08
|
@ -161,28 +161,28 @@ export default class NoteUser extends BaseModel {
|
||||||
uids[key].push(uid)
|
uids[key].push(uid)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 存在数据库记录则进行设置
|
|
||||||
if (gameDB) {
|
|
||||||
let regUids = gameDB.data
|
|
||||||
// 依次设置verify、reg uid数据
|
|
||||||
lodash.forEach(['verify', 'reg'], (uidType) => {
|
|
||||||
lodash.forEach(regUids, (ds, uid) => {
|
|
||||||
if (uid && ds.type === uidType && !uidMap[key][uid]) {
|
|
||||||
uidMap[key][uid] = { uid, type: ds.type }
|
|
||||||
uids[key].push(uid)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// 如果当前选中uid未在记录中,则补充为reg数据
|
|
||||||
let uid = gameDB.uid
|
|
||||||
if (uid && !uidMap[key][uid]) {
|
|
||||||
uidMap[key][uid] = { uid, type: 'reg' }
|
|
||||||
uids[key].push(uid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
// 存在数据库记录则进行设置
|
||||||
|
if (gameDB) {
|
||||||
|
let regUids = gameDB.data
|
||||||
|
// 依次设置verify、reg uid数据
|
||||||
|
lodash.forEach(['verify', 'reg'], (uidType) => {
|
||||||
|
lodash.forEach(regUids, (ds, uid) => {
|
||||||
|
if (uid && ds.type === uidType && !uidMap[key][uid]) {
|
||||||
|
uidMap[key][uid] = { uid, type: ds.type }
|
||||||
|
uids[key].push(uid)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 如果当前选中uid未在记录中,则补充为reg数据
|
||||||
|
let uid = gameDB.uid
|
||||||
|
if (uid && !uidMap[key][uid]) {
|
||||||
|
uidMap[key][uid] = { uid, type: 'reg' }
|
||||||
|
uids[key].push(uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 设置选中uid
|
// 设置选中uid
|
||||||
if (mys && mys.uids[key]?.[0]) {
|
if (mys && mys.uids[key]?.[0]) {
|
||||||
self.uid[key] = mys.uids[key]?.[0] || self.uid[key] || ''
|
self.uid[key] = mys.uids[key]?.[0] || self.uid[key] || ''
|
||||||
|
@ -297,6 +297,8 @@ export default class NoteUser extends BaseModel {
|
||||||
if (this.uidMap[gameKey][uid]) {
|
if (this.uidMap[gameKey][uid]) {
|
||||||
this.uid[gameKey] = uid
|
this.uid[gameKey] = uid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.initUids()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加MysUser
|
// 添加MysUser
|
||||||
|
@ -307,7 +309,6 @@ export default class NoteUser extends BaseModel {
|
||||||
|
|
||||||
// 删除当前用户绑定CK
|
// 删除当前用户绑定CK
|
||||||
async delCk (ltuid = '', needRefreshCache = true) {
|
async delCk (ltuid = '', needRefreshCache = true) {
|
||||||
console.log('delCk', ltuid, !!this.mysUsers[ltuid])
|
|
||||||
if (!ltuid || !this.mysUsers[ltuid]) {
|
if (!ltuid || !this.mysUsers[ltuid]) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ export default class User extends base {
|
||||||
/** #uid */
|
/** #uid */
|
||||||
async showUid () {
|
async showUid () {
|
||||||
let user = await this.user()
|
let user = await this.user()
|
||||||
let msg = ['通过【#uid+序号】来切换uid']
|
let msg = []
|
||||||
lodash.forEach({ gs: '原神', sr: '星穹铁道' }, (gameName, game) => {
|
lodash.forEach({ gs: '原神', sr: '星穹铁道' }, (gameName, game) => {
|
||||||
let uidList = user.getUidList(game)
|
let uidList = user.getUidList(game)
|
||||||
let currUid = user.getUid(game)
|
let currUid = user.getUid(game)
|
||||||
|
@ -178,7 +178,12 @@ export default class User extends base {
|
||||||
msg.push(tmp)
|
msg.push(tmp)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
await this.e.reply(msg.join('\n'))
|
if (msg.length > 0) {
|
||||||
|
msg.unshift('通过【#uid+序号】来切换uid')
|
||||||
|
await this.e.reply(msg.join('\n'))
|
||||||
|
} else {
|
||||||
|
await this.e.reply('尚未绑定UID,发送CK或通过【#绑定123456789】命令来绑定UID')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 切换uid */
|
/** 切换uid */
|
||||||
|
|
Loading…
Reference in New Issue