feat: 初始化核心应用结构,新增循环交易、短信、分配规则和用户设置等服务,并更新相关依赖和配置。

This commit is contained in:
2026-02-02 01:41:51 +08:00
parent 49fcce531d
commit fa8a35a85b
13 changed files with 253 additions and 37 deletions

View File

@@ -31,6 +31,7 @@ type AllocationRuleInput struct {
TriggerType models.TriggerType `json:"trigger_type" binding:"required"`
SourceAccountID *uint `json:"source_account_id,omitempty"` // 触发分配的源账户
IsActive bool `json:"is_active"`
AutoExecute bool `json:"auto_execute"`
Targets []AllocationTargetInput `json:"targets" binding:"required,min=1"`
}
@@ -50,6 +51,7 @@ type AllocationResult struct {
AllocatedAmount float64 `json:"allocated_amount"`
Remaining float64 `json:"remaining"`
Allocations []AllocationDetail `json:"allocations"`
AutoExecuted bool `json:"auto_executed"`
}
// AllocationDetail 单个分配目标的详情
@@ -114,6 +116,7 @@ func (s *AllocationRuleService) CreateAllocationRule(input AllocationRuleInput)
TriggerType: input.TriggerType,
SourceAccountID: input.SourceAccountID,
IsActive: input.IsActive,
AutoExecute: input.AutoExecute,
}
// 开始数据库事务
@@ -227,6 +230,7 @@ func (s *AllocationRuleService) UpdateAllocationRule(userID, id uint, input Allo
rule.TriggerType = input.TriggerType
rule.SourceAccountID = input.SourceAccountID
rule.IsActive = input.IsActive
rule.AutoExecute = input.AutoExecute
// 保存规则
if err := tx.Save(rule).Error; err != nil {