refactor: upgrade to Go 1.26 and modernize code idioms
- Replace `interface{}` with `any` type alias across all packages
- Use built-in `min()`/`max()` for parameter clamping
- Use `slices.SortFunc`, `slices.Min`, `slices.Max` for cleaner code
- Use `strings.Cut()` for simpler string parsing in auth middleware
- Use `errors.Is()` for proper error comparison in handlers
- Update dependencies: golang.org/x/image 0.37.0 -> 0.38.0
- Add Wire code generation guidelines to ARCHITECTURE.md
- Disable Go cache in CI build workflow
This commit is contained in:
@@ -54,7 +54,7 @@ type QRCodeSession struct {
|
||||
// QRCodeLoginService 二维码登录服务
|
||||
type QRCodeLoginService struct {
|
||||
redis *redis.Client
|
||||
wsHub *ws.Hub
|
||||
wsHub *ws.Hub
|
||||
jwtService *JWTService
|
||||
userService UserService
|
||||
activityService UserActivityService
|
||||
@@ -65,7 +65,7 @@ type QRCodeLoginService struct {
|
||||
func NewQRCodeLoginService(redis *redis.Client, wsHub *ws.Hub, jwtService *JWTService, userService UserService, activityService UserActivityService, logService *LogService) *QRCodeLoginService {
|
||||
return &QRCodeLoginService{
|
||||
redis: redis,
|
||||
wsHub: wsHub,
|
||||
wsHub: wsHub,
|
||||
jwtService: jwtService,
|
||||
userService: userService,
|
||||
activityService: activityService,
|
||||
@@ -87,7 +87,7 @@ func (s *QRCodeLoginService) CreateSession(ctx context.Context) (*QRCodeSession,
|
||||
}
|
||||
|
||||
key := qrcodeSessionPrefix + sessionID
|
||||
data := map[string]interface{}{
|
||||
data := map[string]any{
|
||||
"status": string(session.Status),
|
||||
"user_id": "",
|
||||
"created_at": session.CreatedAt,
|
||||
@@ -275,7 +275,7 @@ func (s *QRCodeLoginService) Cancel(ctx context.Context, sessionID, userID strin
|
||||
}
|
||||
|
||||
// 推送取消事件
|
||||
s.wsHub.PublishToUser(sessionID, "cancelled", map[string]interface{}{})
|
||||
s.wsHub.PublishToUser(sessionID, "cancelled", map[string]any{})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user