修正无CK用户绑定UID无效的问题

This commit is contained in:
Kokomi 2023-05-10 11:39:03 +08:00
parent ae0e98b943
commit 072df17f08
2 changed files with 30 additions and 24 deletions

View File

@ -161,7 +161,7 @@ export default class NoteUser extends BaseModel {
uids[key].push(uid) uids[key].push(uid)
} }
}) })
})
// 存在数据库记录则进行设置 // 存在数据库记录则进行设置
if (gameDB) { if (gameDB) {
let regUids = gameDB.data let regUids = gameDB.data
@ -182,7 +182,7 @@ export default class NoteUser extends BaseModel {
uids[key].push(uid) 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
} }

View File

@ -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)
}) })
}) })
if (msg.length > 0) {
msg.unshift('通过【#uid+序号】来切换uid')
await this.e.reply(msg.join('\n')) await this.e.reply(msg.join('\n'))
} else {
await this.e.reply('尚未绑定UID发送CK或通过【#绑定123456789】命令来绑定UID')
}
} }
/** 切换uid */ /** 切换uid */