修复飘红问题
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 15h48m25s

This commit is contained in:
2026-02-02 17:52:14 +08:00
parent 301eb6158e
commit 0b82f30f86
4 changed files with 38 additions and 21 deletions

View File

@@ -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

View File

@@ -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,
}

View File

@@ -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

View File

@@ -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))