feat: 技术债务清理(支付配置动态化、API文档补全、轮询常量提取、废弃代码清理)
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m13s

This commit is contained in:
2026-04-14 11:11:15 +08:00
parent c0b64c9e30
commit 42c5ec912f
63 changed files with 1979 additions and 775 deletions

View File

@@ -6,6 +6,7 @@ import (
"gorm.io/gorm"
"github.com/break/junhong_cmp_fiber/internal/model"
"github.com/break/junhong_cmp_fiber/pkg/constants"
)
// PollingManualTriggerLogStore 手动触发日志存储
@@ -66,7 +67,7 @@ func (s *PollingManualTriggerLogStore) List(ctx context.Context, page, pageSize
func (s *PollingManualTriggerLogStore) GetRunning(ctx context.Context, triggeredBy uint) ([]*model.PollingManualTriggerLog, error) {
var logs []*model.PollingManualTriggerLog
if err := s.db.WithContext(ctx).
Where("triggered_by = ? AND status IN ('pending', 'processing')", triggeredBy).
Where("triggered_by = ? AND status IN (?, ?)", triggeredBy, constants.PollingManualTriggerStatusPending, constants.PollingManualTriggerStatusProcessing).
Order("triggered_at DESC").
Find(&logs).Error; err != nil {
return nil, err
@@ -88,7 +89,7 @@ func (s *PollingManualTriggerLogStore) UpdateProgress(ctx context.Context, id ui
// UpdateStatus 更新触发状态
func (s *PollingManualTriggerLogStore) UpdateStatus(ctx context.Context, id uint, status string) error {
updates := map[string]any{"status": status}
if status == "completed" || status == "cancelled" {
if status == constants.PollingManualTriggerStatusCompleted || status == constants.PollingManualTriggerStatusCancelled {
updates["completed_at"] = gorm.Expr("CURRENT_TIMESTAMP")
}
return s.db.WithContext(ctx).Model(&model.PollingManualTriggerLog{}).