更新用户管理相关

This commit is contained in:
2026-06-03 23:58:17 +08:00
parent 9221a53617
commit 63676f7f34
12 changed files with 464 additions and 176 deletions
+18
View File
@@ -0,0 +1,18 @@
package main
func (s *store) InsertLoginLog(log loginLogRecord) error {
return s.db.Create(&log).Error
}
func (s *store) ListLoginLogs(opts listOptions) ([]loginLogRecord, error) {
opts = normalizeListOptions(opts)
var rows []loginLogRecord
q := s.db.Order("created_at DESC").Order("id DESC").Limit(opts.Limit).Offset(opts.Offset)
if opts.Since != nil {
q = q.Where("created_at >= ?", *opts.Since)
}
if opts.Until != nil {
q = q.Where("created_at <= ?", *opts.Until)
}
return rows, q.Find(&rows).Error
}