fix: guard api key database access
This commit is contained in:
@@ -20,6 +20,9 @@ type APIKey struct{ api.Api }
|
||||
func (e APIKey) List(c *gin.Context) {
|
||||
e.MakeContext(c)
|
||||
db := primaryDB()
|
||||
if db == nil {
|
||||
return false
|
||||
}
|
||||
rows := make([]models.APIKey, 0)
|
||||
if err := db.Order("id desc").Find(&rows).Error; err != nil {
|
||||
e.Error(500, err, "读取密钥失败,请重试")
|
||||
|
||||
Reference in New Issue
Block a user