update
This commit is contained in:
@@ -2,7 +2,6 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"management/internal/erpserver/model/dto"
|
||||
"management/internal/erpserver/model/system"
|
||||
@@ -29,12 +28,20 @@ func (s *loginLogService) List(ctx context.Context, q dto.SearchDto) ([]*system.
|
||||
return s.repo.List(ctx, q)
|
||||
}
|
||||
|
||||
func (s *loginLogService) LoginLatestTime(ctx context.Context, email string) time.Time {
|
||||
log, err := s.repo.GetLatest(ctx, email)
|
||||
func (s *loginLogService) LoginTime(ctx context.Context, email string) (dto.LoginTimeDto, error) {
|
||||
var res dto.LoginTimeDto
|
||||
logs, err := s.repo.GetLatest(ctx, email)
|
||||
if err != nil {
|
||||
return time.Time{}
|
||||
return res, err
|
||||
}
|
||||
return log.CreatedAt
|
||||
if len(logs) == 2 {
|
||||
res.ThisLoginTime = logs[0].CreatedAt
|
||||
res.LastLoginTime = logs[1].CreatedAt
|
||||
} else if len(logs) == 1 {
|
||||
res.ThisLoginTime = logs[0].CreatedAt
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *loginLogService) LoginCount(ctx context.Context, email string) int64 {
|
||||
|
||||
Reference in New Issue
Block a user