优化结构

This commit is contained in:
Yvan
2026-08-22 15:53:14 +08:00
parent ca52de5db0
commit 491ed21d48
72 changed files with 746 additions and 695 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ package data
import (
"encoding/json"
"errors"
"kra/internal/biz/system"
integrationbiz "kra/internal/biz/integration"
"gorm.io/gorm"
)
@@ -13,15 +13,15 @@ func ensureCommunicationIntegrationConfigs(db *gorm.DB) error {
kind string
provider string
}{
{kind: system.IntegrationKindMQ, provider: "emqx"},
{kind: system.IntegrationKindMQ, provider: "rabbitmq"},
{kind: system.IntegrationKindWebSocket, provider: "melody"},
{kind: integrationbiz.IntegrationKindMQ, provider: "emqx"},
{kind: integrationbiz.IntegrationKindMQ, provider: "rabbitmq"},
{kind: integrationbiz.IntegrationKindWebSocket, provider: "melody"},
}
for _, item := range defaults {
var row integrationConfigPO
err := db.Where("kind = ? AND provider = ?", item.kind, item.provider).First(&row).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
values, marshalErr := json.Marshal(system.DefaultIntegrationConfig(item.kind, item.provider))
values, marshalErr := json.Marshal(integrationbiz.DefaultIntegrationConfig(item.kind, item.provider))
if marshalErr != nil {
return marshalErr
}