优化结构

This commit is contained in:
Yvan 2026-08-21 00:01:48 +08:00
parent e65cf0b1d0
commit 746e33e027
344 changed files with 1021 additions and 578 deletions

34
app/admin/catalog.go Normal file
View File

@ -0,0 +1,34 @@
// Package app is the composition root for the running administration service.
// It knows which business modules are enabled and wires their contributions
// into the shared platform. Individual modules do not import this package.
package app
import (
systemmodule "kra/app/system"
systemserver "kra/app/system/transport/server"
systemworker "kra/app/system/worker"
"kra/pkg/module"
platformtask "kra/pkg/task"
)
// Catalog lists the business modules enabled in this binary. Adding an order
// module means adding one Definition here; system initialization and runtime
// code consume the catalog without knowing that module's implementation.
func Catalog() module.Catalog {
return module.Catalog{Definitions: []module.Definition{systemmodule.Definition()}}
}
// TaskRegistry builds the process-wide registry from dependency-free module
// contributions. Dependency-bearing methods are added by their module runtime
// constructors after the usecases have been created.
func TaskRegistry(catalog module.Catalog) *platformtask.Registry {
registry := platformtask.NewRegistry()
registry.RegisterAll(catalog.TaskMethods())
return registry
}
// Runtime composes HTTP route contributors from the enabled modules.
func Runtime(systemRoutes *systemserver.Routes, systemTasks *systemworker.TaskMethods, registry *platformtask.Registry) *module.Runtime {
platformtask.Apply(registry, systemTasks)
return module.NewRuntime(systemRoutes)
}

View File

@ -10,18 +10,22 @@ import (
"strings" "strings"
"time" "time"
"kra/app/system/service"
"kra/app/system/transport/handler"
"kra/app/system/transport/httpx"
servermiddleware "kra/app/system/transport/middleware"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/service" platformmodule "kra/pkg/module"
"kra/internal/modules/system/transport/handler"
"kra/internal/modules/system/transport/httpx"
servermiddleware "kra/internal/modules/system/transport/middleware"
serverrouter "kra/internal/modules/system/transport/router"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
kratoshttp "github.com/go-kratos/kratos/v3/transport/http" kratoshttp "github.com/go-kratos/kratos/v3/transport/http"
) )
func NewGinEngine(runtime *conf.Runtime, access *service.AccessControlService, handlers *handler.Set, auth *service.AuthService, security *service.SecurityService, audit *service.AuditRecorder, logger *slog.Logger, version string) *gin.Engine { func NewGinEngine(runtime *conf.Runtime, access *service.AccessControlService, handlers *handler.Set, auth *service.AuthService, security *service.SecurityService, audit *service.AuditRecorder, logger *slog.Logger, version string) *gin.Engine {
return NewGinEngineWithRuntime(runtime, access, auth, security, audit, logger, version, platformmodule.NewRuntime(NewRoutes(handlers)))
}
func NewGinEngineWithRuntime(runtime *conf.Runtime, access *service.AccessControlService, auth *service.AuthService, security *service.SecurityService, audit *service.AuditRecorder, logger *slog.Logger, version string, routes *platformmodule.Runtime) *gin.Engine {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
engine := gin.New() engine := gin.New()
if err := engine.SetTrustedProxies(nil); err != nil && logger != nil { if err := engine.SetTrustedProxies(nil); err != nil && logger != nil {
@ -36,7 +40,6 @@ func NewGinEngine(runtime *conf.Runtime, access *service.AccessControlService, h
} }
public := engine.Group(prefix) public := engine.Group(prefix)
public.GET("/health", func(c *gin.Context) { c.JSON(http.StatusOK, "ok") }) public.GET("/health", func(c *gin.Context) { c.JSON(http.StatusOK, "ok") })
serverrouter.RegisterPublic(public, engine, handlers.Public)
private := engine.Group(prefix) private := engine.Group(prefix)
// The reference administration behavior installs operation recording after JWT, // The reference administration behavior installs operation recording after JWT,
@ -44,26 +47,9 @@ func NewGinEngine(runtime *conf.Runtime, access *service.AccessControlService, h
// equivalent Kra guards avoids persisting rejected unauthenticated or // equivalent Kra guards avoids persisting rejected unauthenticated or
// unauthorized requests as successful business operations. // unauthorized requests as successful business operations.
private.Use(servermiddleware.Auth(auth), servermiddleware.MustChangePassword(), servermiddleware.AccessControl(runtime, access), servermiddleware.OperationAudit(runtime, audit)) private.Use(servermiddleware.Auth(auth), servermiddleware.MustChangePassword(), servermiddleware.AccessControl(runtime, access), servermiddleware.OperationAudit(runtime, audit))
serverrouter.RegisterUser(private, handlers.User) if routes != nil {
serverrouter.RegisterNavigation(private, handlers.Navigation) routes.RegisterRoutes(public, private, engine)
serverrouter.RegisterSession(private, handlers.Session) }
serverrouter.RegisterAuthority(private, handlers.Authority)
serverrouter.RegisterMenu(private, handlers.Menu)
serverrouter.RegisterAPI(private, public, engine, handlers.API)
serverrouter.RegisterPermission(private, handlers.Permission)
serverrouter.RegisterOrganization(private, handlers.Organization)
serverrouter.RegisterDictionary(private, handlers.Dictionary)
serverrouter.RegisterParameter(private, handlers.Parameter)
serverrouter.RegisterAPIToken(private, handlers.APIToken)
serverrouter.RegisterSystemConfig(private, handlers.SystemConfig)
serverrouter.RegisterVersion(private, handlers.Version)
serverrouter.RegisterExport(private, public, handlers.Export)
serverrouter.RegisterAudit(private, public, handlers.Audit)
serverrouter.RegisterTask(private, handlers.Task)
serverrouter.RegisterMedia(private, handlers.Media)
serverrouter.RegisterAnnouncement(private, public, handlers.Announcement)
serverrouter.RegisterEmail(private, handlers.Email)
serverrouter.RegisterPayment(private, public, handlers.Payment)
registerSwagger(engine, prefix, version, logger) registerSwagger(engine, prefix, version, logger)
registerLocalStorage(engine, runtime) registerLocalStorage(engine, runtime)

View File

@ -11,8 +11,8 @@ import (
"strings" "strings"
"testing" "testing"
"kra/app/system/transport/handler"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/transport/handler"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"sync" "sync"
"kra/internal/modules/system/routeinfo" "kra/app/system/routeinfo"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files" swaggerFiles "github.com/swaggo/files"

View File

@ -14,3 +14,8 @@
系统表统一使用 `sys_` 前缀;业务表应由新业务模块自行命名和迁移,不要混入 系统表统一使用 `sys_` 前缀;业务表应由新业务模块自行命名和迁移,不要混入
本目录。 本目录。
system 通过 `Definition()` 提供自己的迁移、支付菜单/API 和默认任务,通过
`worker.TaskMethods` 提供依赖系统用例的任务实现,通过 `transport/server.Routes`
提供路由。应用组合根消费这些公共协议;新增业务不需要修改 system 的初始化、
worker、路由或数据层。

View File

@ -3,4 +3,4 @@ package biz
import "github.com/google/wire" import "github.com/google/wire"
// ProviderSet is biz providers. // ProviderSet is biz providers.
var ProviderSet = wire.NewSet(NewUserUsecase, NewAuthenticationUsecase, NewSystemConfigUsecase, NewAuthorityUsecase, NewAPIUsecase, NewPermissionUsecase, NewAccessControlUsecase, NewMenuUsecase, NewDepartmentUsecase, NewPositionUsecase, NewDictionaryUsecase, NewParameterUsecase, NewTokenUsecase, NewSecurityUsecase, NewVersionUsecase, NewExportUsecase, NewAuditUsecase, NewAuditRecorderUsecase, NewLogViewerUsecase, NewTaskUsecase, NewTaskApplicationUsecase, NewMediaUsecase, NewAnnouncementUsecase, NewEmailUsecase, NewPaymentUsecase) var ProviderSet = wire.NewSet(NewUserUsecase, NewAuthenticationUsecase, NewSystemConfigUsecase, NewAuthorityUsecase, NewAPIUsecase, NewPermissionUsecase, NewAccessControlUsecase, NewMenuUsecase, NewDepartmentUsecase, NewPositionUsecase, NewDictionaryUsecase, NewParameterUsecase, NewTokenUsecase, NewSecurityUsecase, NewVersionUsecase, NewExportUsecase, NewAuditUsecase, NewAuditRecorderUsecase, NewLogViewerUsecase, NewTaskUsecaseWithRegistry, NewTaskApplicationUsecase, NewMediaUsecase, NewAnnouncementUsecase, NewEmailUsecase, NewPaymentUsecase)

View File

@ -72,9 +72,23 @@ type TaskRuntime interface {
Unsubscribe(uint, chan []byte) Unsubscribe(uint, chan []byte)
} }
type TaskUsecase struct{ TaskRepo } type TaskUsecase struct {
TaskRepo
methods TaskMethodRegistry
}
func NewTaskUsecase(repo TaskRepo) *TaskUsecase { return &TaskUsecase{TaskRepo: repo} } func NewTaskUsecase(repo TaskRepo) *TaskUsecase {
return NewTaskUsecaseWithRegistry(repo, DefaultTaskMethodRegistry())
}
func NewTaskUsecaseWithRegistry(repo TaskRepo, methods TaskMethodRegistry) *TaskUsecase {
if methods == nil {
methods = DefaultTaskMethodRegistry()
}
return &TaskUsecase{TaskRepo: repo, methods: methods}
}
func (uc *TaskUsecase) RegisteredMethods() []TaskMethod { return uc.methods.List() }
func (uc *TaskUsecase) Validate(value *TimedTask) error { func (uc *TaskUsecase) Validate(value *TimedTask) error {
if value.Name == "" { if value.Name == "" {
@ -91,7 +105,7 @@ func (uc *TaskUsecase) Validate(value *TimedTask) error {
} }
switch value.ExecutorType { switch value.ExecutorType {
case TaskExecutorMethod: case TaskExecutorMethod:
if !registeredTaskMethod(value.MethodName) { if _, ok := uc.methods.Lookup(value.MethodName); !ok {
return fmt.Errorf("方法 %s 未注册", value.MethodName) return fmt.Errorf("方法 %s 未注册", value.MethodName)
} }
if len(value.Params) > 0 && !json.Valid(value.Params) { if len(value.Params) > 0 && !json.Valid(value.Params) {
@ -154,6 +168,10 @@ func NewTaskApplicationUsecase(tasks *TaskUsecase, runtime TaskRuntime) *TaskApp
return &TaskApplicationUsecase{tasks: tasks, runtime: runtime} return &TaskApplicationUsecase{tasks: tasks, runtime: runtime}
} }
func (uc *TaskApplicationUsecase) RegisteredMethods() []TaskMethod {
return uc.tasks.RegisteredMethods()
}
func (uc *TaskApplicationUsecase) syncRuntime(ctx context.Context, id uint) error { func (uc *TaskApplicationUsecase) syncRuntime(ctx context.Context, id uint) error {
if ctx == nil { if ctx == nil {
ctx = context.Background() ctx = context.Background()

View File

@ -0,0 +1,28 @@
package biz
import platformtask "kra/pkg/task"
type TaskMethodFunc = platformtask.MethodFunc
type TaskMethod = platformtask.Method
type TaskMethodRegistry interface {
Register(platformtask.Method)
Lookup(string) (TaskMethodFunc, bool)
List() []TaskMethod
}
var defaultTaskMethods = platformtask.NewRegistry()
// RegisterTaskMethod remains as a compatibility helper for tests and callers
// that have not moved to constructor injection yet.
func RegisterTaskMethod(name, description string, fn TaskMethodFunc) {
defaultTaskMethods.Register(platformtask.Method{Name: name, Description: description, Run: fn})
}
func TaskMethodByName(name string) (TaskMethodFunc, bool) {
return defaultTaskMethods.Lookup(name)
}
func RegisteredTaskMethods() []TaskMethod { return defaultTaskMethods.List() }
func DefaultTaskMethodRegistry() TaskMethodRegistry { return defaultTaskMethods }

View File

@ -9,8 +9,8 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"kra/app/system/integration/storage"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/integration/storage"
"google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
@ -351,7 +351,7 @@ func (d *Data) reloadConfig(ctx context.Context) error {
} }
} }
if databaseReady && (next.Admin.System == nil || !next.Admin.System.DisableAutoMigrate) { if databaseReady && (next.Admin.System == nil || !next.Admin.System.DisableAutoMigrate) {
if err = migrateAll(candidateDB.WithContext(ctx)); err != nil { if err = migrateAll(candidateDB.WithContext(ctx), d.catalog); err != nil {
return fmt.Errorf("reload database migrations: %w", err) return fmt.Errorf("reload database migrations: %w", err)
} }
} }

View File

@ -11,10 +11,11 @@ import (
"github.com/google/wire" "github.com/google/wire"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"gorm.io/gorm" "gorm.io/gorm"
datapayment "kra/app/system/data/payment"
datasystem "kra/app/system/data/repository"
"kra/app/system/integration/storage"
"kra/internal/conf" "kra/internal/conf"
datapayment "kra/internal/modules/system/data/payment" "kra/pkg/module"
datasystem "kra/internal/modules/system/data/repository"
"kra/internal/modules/system/integration/storage"
) )
var ProviderSet = wire.NewSet( var ProviderSet = wire.NewSet(
@ -44,6 +45,7 @@ type Data struct {
dbList map[string]*gorm.DB dbList map[string]*gorm.DB
appLogger *slog.Logger appLogger *slog.Logger
auditLog *dataScopeAuditWriter auditLog *dataScopeAuditWriter
catalog module.Catalog
} }
// DB exposes the active primary database to narrowly scoped data submodules. // DB exposes the active primary database to narrowly scoped data submodules.
@ -139,7 +141,7 @@ func (d *Data) database(name string) (*gorm.DB, error) {
return db, nil return db, nil
} }
func NewData(runtime *conf.Runtime, appLogger *slog.Logger, storageManager *storage.Reloadable) (*Data, func(), error) { func NewData(runtime *conf.Runtime, appLogger *slog.Logger, storageManager *storage.Reloadable, catalog module.Catalog) (*Data, func(), error) {
if appLogger == nil { if appLogger == nil {
appLogger = slog.Default() appLogger = slog.Default()
} }
@ -153,7 +155,7 @@ func NewData(runtime *conf.Runtime, appLogger *slog.Logger, storageManager *stor
// and /init/initdb remain available. // and /init/initdb remain available.
c.Database = &conf.Data_Database{} c.Database = &conf.Data_Database{}
} }
d := &Data{runtime: runtime, appLogger: appLogger, storage: storageManager} d := &Data{runtime: runtime, appLogger: appLogger, storage: storageManager, catalog: catalog}
usingFallback := !databaseConnectionConfigured(c.Database) usingFallback := !databaseConnectionConfigured(c.Database)
var db *gorm.DB var db *gorm.DB
var err error var err error
@ -190,7 +192,7 @@ func NewData(runtime *conf.Runtime, appLogger *slog.Logger, storageManager *stor
} }
disableAutoMigrate := admin.System != nil && admin.System.DisableAutoMigrate disableAutoMigrate := admin.System != nil && admin.System.DisableAutoMigrate
if !usingFallback && !disableAutoMigrate { if !usingFallback && !disableAutoMigrate {
if err = migrateAll(db); err != nil { if err = migrateAll(db, catalog); err != nil {
return nil, nil, fmt.Errorf("migrate tables: %w", err) return nil, nil, fmt.Errorf("migrate tables: %w", err)
} }
} }

View File

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strings" "strings"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -20,7 +20,7 @@ import (
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"gorm.io/gorm/schema" "gorm.io/gorm/schema"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/platform/database/gormkit" "kra/pkg/database/gormkit"
) )
var databaseNamePattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_$-]*$`) var databaseNamePattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_$-]*$`)

View File

@ -9,7 +9,7 @@ import (
"time" "time"
"kra/internal/logging" "kra/internal/logging"
"kra/internal/platform/database/gormkit" "kra/pkg/database/gormkit"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
) )

View File

@ -5,9 +5,9 @@ import (
"errors" "errors"
"fmt" "fmt"
"kra/app/system/biz"
"kra/app/system/integration/storage"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/biz"
"kra/internal/modules/system/integration/storage"
"github.com/google/uuid" "github.com/google/uuid"
"google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/protojson"
@ -180,7 +180,7 @@ func (d *Data) InitializeDatabase(ctx context.Context, input *biz.DatabaseConfig
} }
}() }()
db := candidate.WithContext(ctx) db := candidate.WithContext(ctx)
if err := migrateAll(db); err != nil { if err := migrateAll(db, d.catalog); err != nil {
return err return err
} }
if seed != nil { if seed != nil {

View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
"testing" "testing"
"kra/app/system/integration/storage"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/integration/storage"
"google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/protojson"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"

View File

@ -0,0 +1,32 @@
package data
import (
datapayment "kra/app/system/data/payment"
datasystem "kra/app/system/data/repository"
"kra/pkg/database/migration"
"kra/pkg/module"
"gorm.io/gorm"
)
func InfrastructureMigrations() []migration.Step {
return []migration.Step{{
ID: "202608200001_data_infrastructure",
Migrate: func(db *gorm.DB) error {
return migration.CreateMissingTables(db, &integrationConfigPO{})
},
}}
}
// migrateAll is the single data-layer migration entry point. Module-specific
// schema work stays with the module that owns its persistent objects.
func migrateAll(db *gorm.DB, catalogs ...module.Catalog) error {
steps := InfrastructureMigrations()
if len(catalogs) > 0 && len(catalogs[0].MigrationSteps()) > 0 {
steps = append(steps, catalogs[0].MigrationSteps()...)
} else {
steps = append(steps, datasystem.Migrations()...)
steps = append(steps, datapayment.Migrations()...)
}
return migration.Run(db, steps)
}

View File

@ -3,7 +3,7 @@ package data
import ( import (
"testing" "testing"
"kra/internal/platform/database/migration" "kra/pkg/database/migration"
) )
func TestMigrateAllRunsModuleSchemasWithoutBootstrapSeed(t *testing.T) { func TestMigrateAllRunsModuleSchemasWithoutBootstrapSeed(t *testing.T) {

View File

@ -1,8 +1,8 @@
package payment package payment
import ( import (
"kra/internal/modules/system/adminsurface" "kra/pkg/database/migration"
"kra/internal/platform/database/migration" platformmodule "kra/pkg/module"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -19,17 +19,17 @@ func Migrations() []migration.Step {
// AdminSurface describes the payment-owned entries shown in the system // AdminSurface describes the payment-owned entries shown in the system
// administration UI. The system module persists these records because it owns // administration UI. The system module persists these records because it owns
// the menu/API/policy tables. // the menu/API/policy tables.
func AdminSurface() adminsurface.Surface { func AdminSurface() platformmodule.Surface {
return adminsurface.Surface{ return platformmodule.Surface{
Menus: []adminsurface.Menu{ Menus: []platformmodule.Menu{
{Name: "paymentOrders", Path: "paymentOrders", ParentName: "extensions", Component: "view/systemTools/payment/orders.vue", Title: "支付订单", Icon: "wallet", Sort: 6}, {Name: "paymentOrders", Path: "paymentOrders", ParentName: "extensions", Component: "view/systemTools/payment/orders.vue", Title: "支付订单", Icon: "wallet", Sort: 6},
{Name: "paymentConfig", Path: "paymentConfig", ParentName: "extensions", Component: "view/systemTools/payment/config.vue", Title: "支付配置", Icon: "credit-card", Sort: 7}, {Name: "paymentConfig", Path: "paymentConfig", ParentName: "extensions", Component: "view/systemTools/payment/config.vue", Title: "支付配置", Icon: "credit-card", Sort: 7},
}, },
APIs: []adminsurface.API{ APIs: []platformmodule.API{
{Path: "/payment/configs", Method: "GET", APIGroup: "支付", Description: "获取支付渠道配置"}, {Path: "/payment/configs", Method: "GET", Group: "支付", Description: "获取支付渠道配置"},
{Path: "/payment/config", Method: "POST", APIGroup: "支付", Description: "保存支付渠道配置"}, {Path: "/payment/config", Method: "POST", Group: "支付", Description: "保存支付渠道配置"},
{Path: "/payment/orders", Method: "GET", APIGroup: "支付", Description: "分页查询支付订单"}, {Path: "/payment/orders", Method: "GET", Group: "支付", Description: "分页查询支付订单"},
{Path: "/payment/order", Method: "POST", APIGroup: "支付", Description: "查询支付订单"}, {Path: "/payment/order", Method: "POST", Group: "支付", Description: "查询支付订单"},
}, },
} }
} }

View File

@ -11,8 +11,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"kra/internal/modules/system/biz" "kra/app/system/biz"
datapayment "kra/internal/modules/system/integration/payment" datapayment "kra/app/system/integration/payment"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func TestSavePaymentConfigRequiresDouyinAppIDWhenEnabled(t *testing.T) { func TestSavePaymentConfigRequiresDouyinAppIDWhenEnabled(t *testing.T) {

View File

@ -1,6 +1,6 @@
package payment package payment
import "kra/internal/modules/system/utils/paymentutil" import "kra/app/system/utils/paymentutil"
func text(values map[string]any, key string) string { func text(values map[string]any, key string) string {
value, _ := values[key].(string) value, _ := values[key].(string)

View File

@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func TestMigrateSeedsPaymentProviders(t *testing.T) { func TestMigrateSeedsPaymentProviders(t *testing.T) {

View File

@ -10,8 +10,8 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
) )
type paymentOrderPO struct { type paymentOrderPO struct {

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func newPaymentOrderRepoForTest(t *testing.T) *paymentOrderRepo { func newPaymentOrderRepoForTest(t *testing.T) *paymentOrderRepo {

View File

@ -5,9 +5,9 @@ import (
"encoding/json" "encoding/json"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/gormkit" "kra/pkg/database/gormkit"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func TestAnnouncementRepositoryKeepsRawIDQuerySemantics(t *testing.T) { func TestAnnouncementRepositoryKeepsRawIDQuerySemantics(t *testing.T) {

View File

@ -6,8 +6,8 @@ import (
"strconv" "strconv"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"strconv" "strconv"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"github.com/casbin/casbin/v3" "github.com/casbin/casbin/v3"
casbinmodel "github.com/casbin/casbin/v3/model" casbinmodel "github.com/casbin/casbin/v3/model"

View File

@ -5,8 +5,8 @@ import (
"strings" "strings"
"testing" "testing"
"kra/app/system/biz"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/biz"
) )
func newPolicyTestData(t *testing.T) *Data { func newPolicyTestData(t *testing.T) *Data {

View File

@ -3,7 +3,7 @@ package system
import ( import (
"context" "context"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -5,8 +5,8 @@ import (
"errors" "errors"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -1,6 +1,6 @@
package system package system
import "kra/internal/modules/system/biz" import "kra/app/system/biz"
type auditQueryRepo struct{ data Provider } type auditQueryRepo struct{ data Provider }
type auditRecorderRepo struct{ data Provider } type auditRecorderRepo struct{ data Provider }

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"errors" "errors"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -5,8 +5,8 @@ import (
"errors" "errors"
"testing" "testing"
"kra/app/system/biz"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func TestDictionaryListPreservesPreloadCollectionShapes(t *testing.T) { func TestDictionaryListPreservesPreloadCollectionShapes(t *testing.T) {

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func errorString(value string) *string { return &value } func errorString(value string) *string { return &value }

View File

@ -7,7 +7,7 @@ import (
"fmt" "fmt"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"strconv" "strconv"
"strings" "strings"
"time" "time"

View File

@ -14,7 +14,7 @@ import (
"strings" "strings"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
const ( const (

View File

@ -7,8 +7,8 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"kra/app/system/biz"
"kra/internal/conf" "kra/internal/conf"
"kra/internal/modules/system/biz"
) )
func TestLogViewerReadsNestedCategoryFiles(t *testing.T) { func TestLogViewerReadsNestedCategoryFiles(t *testing.T) {

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"kra/internal/platform/database/pagination" "kra/pkg/database/pagination"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"kra/internal/modules/system/biz" "kra/app/system/biz"
) )
func TestMediaListKeepsZeroPageSizeContract(t *testing.T) { func TestMediaListKeepsZeroPageSizeContract(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"time" "time"
"kra/internal/modules/system/biz" "kra/app/system/biz"
"gorm.io/gorm" "gorm.io/gorm"
) )

Some files were not shown because too many files have changed in this diff Show More