refactor: user login log list for admin is ready

This commit is contained in:
RockYang
2023-06-21 06:53:41 +08:00
parent feff1684c4
commit 0e6606e469
9 changed files with 170 additions and 26 deletions

View File

@@ -8,9 +8,10 @@ import (
"chatplus/store/vo"
"chatplus/utils"
"chatplus/utils/resp"
"time"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"time"
)
type ApiKeyHandler struct {
@@ -61,7 +62,7 @@ func (h *ApiKeyHandler) Save(c *gin.Context) {
func (h *ApiKeyHandler) List(c *gin.Context) {
userId := h.GetInt(c, "user_id", -1)
query := h.db.Debug().Session(&gorm.Session{})
query := h.db.Session(&gorm.Session{})
if userId >= 0 {
query = query.Where("user_id", userId)
}