chore: import 分组规范 + 文档同步 + config 修复
All checks were successful
Build / build (push) Successful in 7m17s
Build / build-docker (push) Successful in 2m41s

This commit is contained in:
lafay
2026-06-15 16:52:20 +08:00
parent 7d1c78f965
commit b23a169925
32 changed files with 143 additions and 90 deletions

View File

@@ -1,6 +1,9 @@
package container
import (
"context"
"time"
"carrotskin/internal/repository"
"carrotskin/internal/service"
"carrotskin/pkg/auth"
@@ -9,8 +12,6 @@ import (
"carrotskin/pkg/email"
"carrotskin/pkg/redis"
"carrotskin/pkg/storage"
"context"
"time"
"go.uber.org/zap"
"gorm.io/gorm"

View File

@@ -128,7 +128,6 @@ func NewInternalError(message string, err error) *AppError {
// 注意:原此处的 Is/As/Wrap 函数(透传标准库)已删除。
// 请直接使用标准库 errors.Is / errors.As / fmt.Errorf。
// YggdrasilErrorResponse Yggdrasil协议标准错误响应格式
type YggdrasilErrorResponse struct {
Error string `json:"error"` // 错误的简要描述(机器可读)

View File

@@ -5,8 +5,8 @@ import (
"net/http"
"strconv"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/container"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"github.com/gin-gonic/gin"

View File

@@ -1,9 +1,10 @@
package handler
import (
"carrotskin/internal/container"
"net/http"
"carrotskin/internal/container"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)

View File

@@ -1,13 +1,14 @@
package handler
import (
"carrotskin/internal/container"
"context"
"fmt"
"net/http"
"strings"
"time"
"carrotskin/internal/container"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)

View File

@@ -1,13 +1,14 @@
package handler
import (
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/types"
"errors"
"net/http"
"strconv"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/types"
"github.com/gin-gonic/gin"
)

View File

@@ -1,10 +1,11 @@
package handler
import (
"strconv"
"carrotskin/internal/container"
"carrotskin/internal/model"
"carrotskin/internal/types"
"strconv"
"github.com/gin-gonic/gin"
"go.uber.org/zap"

View File

@@ -2,13 +2,14 @@ package handler
import (
"bytes"
"io"
"net/http"
"regexp"
"carrotskin/internal/container"
"carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/pkg/utils"
"io"
"net/http"
"regexp"
"github.com/gin-gonic/gin"
"go.uber.org/zap"

View File

@@ -1,10 +1,11 @@
package middleware
import (
"carrotskin/internal/model"
"net/http"
"strings"
"carrotskin/internal/model"
"carrotskin/pkg/auth"
"github.com/gin-gonic/gin"

View File

@@ -1,9 +1,10 @@
package repository
import (
"carrotskin/internal/model"
"context"
"carrotskin/internal/model"
"gorm.io/gorm"
)

View File

@@ -1,8 +1,9 @@
package repository
import (
"carrotskin/internal/model"
"context"
"carrotskin/internal/model"
)
// UserRepository 用户仓储接口
@@ -11,7 +12,7 @@ type UserRepository interface {
FindByID(ctx context.Context, id int64) (*model.User, error)
FindByUsername(ctx context.Context, username string) (*model.User, error)
FindByEmail(ctx context.Context, email string) (*model.User, error)
FindByIDs(ctx context.Context, ids []int64) ([]*model.User, error) // 批量查询
FindByIDs(ctx context.Context, ids []int64) ([]*model.User, error) // 批量查询
List(ctx context.Context, page, pageSize int) ([]*model.User, int64, error) // 分页列表(管理员)
Update(ctx context.Context, user *model.User) error
UpdateFields(ctx context.Context, id int64, fields map[string]interface{}) error
@@ -66,10 +67,9 @@ type TextureRepository interface {
GetUserFavorites(ctx context.Context, userID int64, page, pageSize int) ([]*model.Texture, int64, error)
CountByUploaderID(ctx context.Context, uploaderID int64) (int64, error)
ListForAdmin(ctx context.Context, page, pageSize int) ([]*model.Texture, int64, error) // 管理员列表(含 Uploader 预加载)
FindByIDForAdmin(ctx context.Context, id int64) (*model.Texture, error) // 管理员查询(无权限过滤)
FindByIDForAdmin(ctx context.Context, id int64) (*model.Texture, error) // 管理员查询(无权限过滤)
}
// YggdrasilRepository Yggdrasil仓储接口
type YggdrasilRepository interface {
GetPasswordByID(ctx context.Context, id int64) (string, error)

View File

@@ -1,11 +1,12 @@
package repository
import (
"carrotskin/internal/model"
"context"
"errors"
"fmt"
"carrotskin/internal/model"
"gorm.io/gorm"
)

View File

@@ -1,9 +1,10 @@
package repository
import (
"carrotskin/internal/model"
"context"
"carrotskin/internal/model"
"gorm.io/gorm"
)

View File

@@ -1,10 +1,11 @@
package repository
import (
"carrotskin/internal/model"
"context"
"errors"
"carrotskin/internal/model"
"gorm.io/gorm"
)

View File

@@ -1,9 +1,10 @@
package repository
import (
"carrotskin/internal/model"
"context"
"carrotskin/internal/model"
"gorm.io/gorm"
)
@@ -34,9 +35,3 @@ func (r *yggdrasilRepository) ResetPassword(ctx context.Context, id int64, passw
func (r *yggdrasilRepository) Create(ctx context.Context, yggdrasil *model.Yggdrasil) error {
return r.db.WithContext(ctx).Create(yggdrasil).Error
}

View File

@@ -1,15 +1,16 @@
package service
import (
"carrotskin/pkg/config"
"carrotskin/pkg/redis"
"carrotskin/pkg/utils"
"context"
"errors"
"fmt"
"log"
"time"
"carrotskin/pkg/config"
"carrotskin/pkg/redis"
"carrotskin/pkg/utils"
"github.com/wenlng/go-captcha-assets/resources/imagesv2"
"github.com/wenlng/go-captcha-assets/resources/tiles"
"github.com/wenlng/go-captcha/v2/slide"

View File

@@ -2,11 +2,12 @@
package service
import (
"carrotskin/internal/model"
"carrotskin/pkg/storage"
"context"
"time"
"carrotskin/internal/model"
"carrotskin/pkg/storage"
"go.uber.org/zap"
)

View File

@@ -1,11 +1,6 @@
package service
import (
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/database"
"carrotskin/pkg/utils"
"context"
"crypto/rand"
"crypto/rsa"
@@ -14,6 +9,12 @@ import (
"errors"
"fmt"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/database"
"carrotskin/pkg/utils"
"go.uber.org/zap"
"gorm.io/gorm"
)

View File

@@ -1,9 +1,6 @@
package service
import (
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/redis"
"context"
"crypto"
"crypto/rand"
@@ -18,6 +15,10 @@ import (
"strings"
"time"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/redis"
"go.uber.org/zap"
)

View File

@@ -2,11 +2,6 @@ package service
import (
"bytes"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/database"
"carrotskin/pkg/storage"
"context"
"crypto/sha256"
"encoding/hex"
@@ -16,6 +11,12 @@ import (
"strings"
"time"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/database"
"carrotskin/pkg/storage"
"go.uber.org/zap"
"gorm.io/gorm"
)

View File

@@ -1,15 +1,16 @@
package service
import (
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/auth"
"carrotskin/pkg/utils"
"context"
"errors"
"fmt"
"time"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/auth"
"carrotskin/pkg/utils"
"go.uber.org/zap"
)

View File

@@ -1,12 +1,13 @@
package service
import (
"context"
"fmt"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/auth"
"context"
"fmt"
"go.uber.org/zap"
)

View File

@@ -1,12 +1,13 @@
package service
import (
apperrors "carrotskin/internal/errors"
"carrotskin/internal/repository"
"context"
"fmt"
"time"
apperrors "carrotskin/internal/errors"
"carrotskin/internal/repository"
"go.uber.org/zap"
)
@@ -109,4 +110,3 @@ func (s *yggdrasilCertificateService) GeneratePlayerCertificate(ctx context.Cont
func (s *yggdrasilCertificateService) GetPublicKey(ctx context.Context) (string, error) {
return s.signatureService.GetPublicKeyFromRedis(ctx)
}

View File

@@ -1,12 +1,13 @@
package service
import (
"carrotskin/internal/model"
"carrotskin/internal/repository"
"context"
"encoding/base64"
"time"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"go.uber.org/zap"
)

View File

@@ -1,13 +1,14 @@
package service
import (
"context"
"errors"
"fmt"
"carrotskin/internal/model"
"carrotskin/internal/repository"
"carrotskin/pkg/redis"
"carrotskin/pkg/utils"
"context"
"errors"
"fmt"
"go.uber.org/zap"
)

View File

@@ -1,14 +1,15 @@
package service
import (
apperrors "carrotskin/internal/errors"
"carrotskin/pkg/redis"
"context"
"fmt"
"net"
"strings"
"time"
apperrors "carrotskin/internal/errors"
"carrotskin/pkg/redis"
"go.uber.org/zap"
)