diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7aff5c5..9c11c84 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -61,10 +61,10 @@ services: - JUNHONG_STORAGE_S3_USE_SSL=false - JUNHONG_STORAGE_S3_PATH_STYLE=true # Gateway 配置(可选) - # - JUNHONG_GATEWAY_BASE_URL=https://lplan.whjhft.com/openapi - # - JUNHONG_GATEWAY_APP_ID=your_app_id - # - JUNHONG_GATEWAY_APP_SECRET=your_app_secret - # - JUNHONG_GATEWAY_TIMEOUT=30 + - JUNHONG_GATEWAY_BASE_URL=https://lplan.whjhft.com/openapi + - JUNHONG_GATEWAY_APP_ID=60bgt1X8i7AvXqkd + - JUNHONG_GATEWAY_APP_SECRET=BZeQttaZQt0i73moF + - JUNHONG_GATEWAY_TIMEOUT=30 # 微信公众号配置(可选) # - JUNHONG_WECHAT_OFFICIAL_ACCOUNT_APP_ID=your_app_id # - JUNHONG_WECHAT_OFFICIAL_ACCOUNT_APP_SECRET=your_app_secret @@ -133,10 +133,10 @@ services: - JUNHONG_STORAGE_S3_USE_SSL=false - JUNHONG_STORAGE_S3_PATH_STYLE=true # Gateway 配置(可选) - # - JUNHONG_GATEWAY_BASE_URL=https://lplan.whjhft.com/openapi - # - JUNHONG_GATEWAY_APP_ID=your_app_id - # - JUNHONG_GATEWAY_APP_SECRET=your_app_secret - # - JUNHONG_GATEWAY_TIMEOUT=30 + - JUNHONG_GATEWAY_BASE_URL=https://lplan.whjhft.com/openapi + - JUNHONG_GATEWAY_APP_ID=60bgt1X8i7AvXqkd + - JUNHONG_GATEWAY_APP_SECRET=BZeQttaZQt0i73moF + - JUNHONG_GATEWAY_TIMEOUT=30 # 微信公众号配置(可选) # - JUNHONG_WECHAT_OFFICIAL_ACCOUNT_APP_ID=your_app_id # - JUNHONG_WECHAT_OFFICIAL_ACCOUNT_APP_SECRET=your_app_secret diff --git a/tests/unit/commission_calculation_service_test.go b/tests/unit/commission_calculation_service_test.go index c7e7ca3..8b15bcf 100644 --- a/tests/unit/commission_calculation_service_test.go +++ b/tests/unit/commission_calculation_service_test.go @@ -69,7 +69,7 @@ func TestCommissionCalculation_AccumulatedRecharge(t *testing.T) { CarrierName: "中国移动", Status: 3, ShopID: &shop.ID, - SeriesAllocationID: &allocation.ID, + SeriesID: &allocation.ID, FirstCommissionPaid: false, AccumulatedRecharge: 0, } @@ -109,7 +109,7 @@ func TestCommissionCalculation_AccumulatedRecharge(t *testing.T) { require.NoError(t, err) assert.Equal(t, int64(0), cardBefore.AccumulatedRecharge) - alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesAllocationID) + alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesID) require.NoError(t, err) if alloc.OneTimeCommissionTrigger == model.OneTimeCommissionTriggerAccumulatedRecharge { @@ -146,7 +146,7 @@ func TestCommissionCalculation_AccumulatedRecharge(t *testing.T) { require.NoError(t, err) assert.Equal(t, int64(3000), cardBefore.AccumulatedRecharge) - alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesAllocationID) + alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesID) require.NoError(t, err) if alloc.OneTimeCommissionTrigger == model.OneTimeCommissionTriggerAccumulatedRecharge { @@ -183,7 +183,7 @@ func TestCommissionCalculation_AccumulatedRecharge(t *testing.T) { require.NoError(t, err) assert.Equal(t, int64(7000), cardBefore.AccumulatedRecharge) - alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesAllocationID) + alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesID) require.NoError(t, err) if alloc.OneTimeCommissionTrigger == model.OneTimeCommissionTriggerAccumulatedRecharge { @@ -232,7 +232,7 @@ func TestCommissionCalculation_AccumulatedRecharge(t *testing.T) { assert.Equal(t, int64(11000), cardBefore.AccumulatedRecharge) assert.True(t, cardBefore.FirstCommissionPaid, "标记应保持为true") - alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesAllocationID) + alloc, err := shopSeriesAllocationStore.GetByID(ctx, *card.SeriesID) require.NoError(t, err) if alloc.OneTimeCommissionTrigger == model.OneTimeCommissionTriggerAccumulatedRecharge { @@ -334,7 +334,7 @@ func TestCommissionCalculation_OneTimeCommissionLogic(t *testing.T) { CarrierName: "中国移动", Status: 3, ShopID: &shop.ID, - SeriesAllocationID: &allocation.ID, + SeriesID: &allocation.ID, FirstCommissionPaid: false, AccumulatedRecharge: 0, } diff --git a/tests/unit/permission_store_test.go b/tests/unit/permission_store_test.go index bd346ca..82628a4 100644 --- a/tests/unit/permission_store_test.go +++ b/tests/unit/permission_store_test.go @@ -152,7 +152,7 @@ func TestPermissionStore_GetAll_AvailableForRoleType(t *testing.T) { t.Run("GetAll按平台角色类型过滤", func(t *testing.T) { roleType := 1 - perms, err := store.GetAll(ctx, &roleType) + perms, err := store.GetAll(ctx, &roleType, nil) require.NoError(t, err) var codes []string @@ -165,7 +165,7 @@ func TestPermissionStore_GetAll_AvailableForRoleType(t *testing.T) { t.Run("GetAll按客户角色类型过滤", func(t *testing.T) { roleType := 2 - perms, err := store.GetAll(ctx, &roleType) + perms, err := store.GetAll(ctx, &roleType, nil) require.NoError(t, err) var codes []string @@ -177,7 +177,7 @@ func TestPermissionStore_GetAll_AvailableForRoleType(t *testing.T) { }) t.Run("GetAll不过滤时返回所有", func(t *testing.T) { - perms, err := store.GetAll(ctx, nil) + perms, err := store.GetAll(ctx, nil, nil) require.NoError(t, err) var codes []string diff --git a/tests/unit/role_assignment_limit_test.go b/tests/unit/role_assignment_limit_test.go index 3dd55ad..d3c29b0 100644 --- a/tests/unit/role_assignment_limit_test.go +++ b/tests/unit/role_assignment_limit_test.go @@ -9,6 +9,7 @@ import ( "github.com/break/junhong_cmp_fiber/internal/model" "github.com/break/junhong_cmp_fiber/internal/service/account" + "github.com/break/junhong_cmp_fiber/internal/service/account_audit" "github.com/break/junhong_cmp_fiber/internal/store/postgres" "github.com/break/junhong_cmp_fiber/pkg/constants" "github.com/break/junhong_cmp_fiber/pkg/middleware" @@ -24,7 +25,11 @@ func TestRoleAssignmentLimit_PlatformUser(t *testing.T) { accountStore := postgres.NewAccountStore(tx, rdb) roleStore := postgres.NewRoleStore(tx) accountRoleStore := postgres.NewAccountRoleStore(tx, rdb) - service := account.New(accountStore, roleStore, accountRoleStore) + shopStore := postgres.NewShopStore(tx, rdb) + enterpriseStore := postgres.NewEnterpriseStore(tx, rdb) + auditLogStore := postgres.NewAccountOperationLogStore(tx) + auditService := account_audit.NewService(auditLogStore) + service := account.New(accountStore, roleStore, accountRoleStore, shopStore, enterpriseStore, auditService) ctx := context.Background() ctx = middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0)) @@ -65,7 +70,11 @@ func TestRoleAssignmentLimit_AgentUser(t *testing.T) { accountStore := postgres.NewAccountStore(tx, rdb) roleStore := postgres.NewRoleStore(tx) accountRoleStore := postgres.NewAccountRoleStore(tx, rdb) - service := account.New(accountStore, roleStore, accountRoleStore) + shopStore := postgres.NewShopStore(tx, rdb) + enterpriseStore := postgres.NewEnterpriseStore(tx, rdb) + auditLogStore := postgres.NewAccountOperationLogStore(tx) + auditService := account_audit.NewService(auditLogStore) + service := account.New(accountStore, roleStore, accountRoleStore, shopStore, enterpriseStore, auditService) ctx := context.Background() ctx = middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0)) @@ -109,7 +118,11 @@ func TestRoleAssignmentLimit_EnterpriseUser(t *testing.T) { accountStore := postgres.NewAccountStore(tx, rdb) roleStore := postgres.NewRoleStore(tx) accountRoleStore := postgres.NewAccountRoleStore(tx, rdb) - service := account.New(accountStore, roleStore, accountRoleStore) + shopStore := postgres.NewShopStore(tx, rdb) + enterpriseStore := postgres.NewEnterpriseStore(tx, rdb) + auditLogStore := postgres.NewAccountOperationLogStore(tx) + auditService := account_audit.NewService(auditLogStore) + service := account.New(accountStore, roleStore, accountRoleStore, shopStore, enterpriseStore, auditService) ctx := context.Background() ctx = middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0)) @@ -153,7 +166,11 @@ func TestRoleAssignmentLimit_SuperAdmin(t *testing.T) { accountStore := postgres.NewAccountStore(tx, rdb) roleStore := postgres.NewRoleStore(tx) accountRoleStore := postgres.NewAccountRoleStore(tx, rdb) - service := account.New(accountStore, roleStore, accountRoleStore) + shopStore := postgres.NewShopStore(tx, rdb) + enterpriseStore := postgres.NewEnterpriseStore(tx, rdb) + auditLogStore := postgres.NewAccountOperationLogStore(tx) + auditService := account_audit.NewService(auditLogStore) + service := account.New(accountStore, roleStore, accountRoleStore, shopStore, enterpriseStore, auditService) ctx := context.Background() ctx = middleware.SetUserContext(ctx, middleware.NewSimpleUserContext(1, constants.UserTypeSuperAdmin, 0))