mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
fix: 初始令牌
This commit is contained in:
parent
131453dac8
commit
9032b5cfbf
@ -199,14 +199,6 @@ func Register(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
// 生成默认令牌
|
// 生成默认令牌
|
||||||
if constant.GenerateDefaultToken {
|
if constant.GenerateDefaultToken {
|
||||||
var insertedUser model.User
|
|
||||||
if err := model.DB.Where("username = ?", cleanUser.Username).First(&insertedUser).Error; err != nil {
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"success": false,
|
|
||||||
"message": "用户注册失败或用户ID获取失败",
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 生成默认令牌
|
// 生成默认令牌
|
||||||
token := model.Token{
|
token := model.Token{
|
||||||
UserId: insertedUser.Id, // 使用插入后的用户ID
|
UserId: insertedUser.Id, // 使用插入后的用户ID
|
||||||
@ -214,8 +206,8 @@ func Register(c *gin.Context) {
|
|||||||
Key: common.GenerateKey(),
|
Key: common.GenerateKey(),
|
||||||
CreatedTime: common.GetTimestamp(),
|
CreatedTime: common.GetTimestamp(),
|
||||||
AccessedTime: common.GetTimestamp(),
|
AccessedTime: common.GetTimestamp(),
|
||||||
ExpiredTime: -1, // 永不过期
|
ExpiredTime: -1, // 永不过期
|
||||||
RemainQuota: 500000, // 示例额度
|
RemainQuota: 500000, // 示例额度
|
||||||
UnlimitedQuota: true,
|
UnlimitedQuota: true,
|
||||||
ModelLimitsEnabled: false,
|
ModelLimitsEnabled: false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user