mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
增加后台对缺少的锅巴配置自动读取,将后台登陆信息添加到redis
This commit is contained in:
parent
5acf874e0b
commit
369dbd31c3
5 changed files with 79 additions and 9 deletions
|
|
@ -25,7 +25,7 @@ export function GetUser(user) {
|
|||
return users.user.find(user => user === user)
|
||||
}
|
||||
// 添加用户token
|
||||
export function AddUser(data) {
|
||||
export async function AddUser(data) {
|
||||
const userIndex = users.user.findIndex(user => user === data.user)
|
||||
if (userIndex >= 0) {
|
||||
users.user[userIndex].token.push(data.token)
|
||||
|
|
@ -38,4 +38,8 @@ export function AddUser(data) {
|
|||
tiem: new Date()
|
||||
})
|
||||
}
|
||||
await redis.set('CHATGPT:SERVER_USER', JSON.stringify(users))
|
||||
}
|
||||
export async function ReplaceUsers() {
|
||||
users = JSON.parse(await redis.get('CHATGPT:SERVER_USER') || '{"user": []}')
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue