5 分钟发布一次

This commit is contained in:
yml2213
2026-06-27 22:26:37 +08:00
parent 3abd513543
commit fed7d6af71
10 changed files with 261 additions and 9 deletions
@@ -32,6 +32,7 @@ var defaultConfigs = []defaultConfig{
{Key: "order.pending_payment_timeout_minutes", Value: "15", Description: "订单待支付超时取消分钟数"},
{Key: "order.return_overdue_grace_minutes", Value: "10", Description: "预计截止后结账宽限分钟数"},
{Key: "listing.review_required", Value: "false", Description: "发布账号是否需要后台人工审核"},
{Key: "listing.publish_cooldown_minutes", Value: "5", Description: "同一用户两次新增发布账号的最小间隔分钟数(0 表示关闭)"},
{Key: listingPublishAgreementsConfigKey, Value: defaultListingPublishAgreementsConfigValue(), Description: "发布账号前协议配置 JSON"},
{Key: orderAgreementsConfigKey, Value: defaultOrderAgreementsConfigValue(), Description: "下单前协议配置 JSON"},
{Key: postRentalNoticeConfigKey, Value: defaultPostRentalNoticeConfigValue(), Description: "租后须知配置 JSON"},
@@ -60,6 +61,7 @@ var adminVisibleConfigKeys = []string{
"integration.paddle_ocr_model",
"integration.paddle_ocr_token",
"listing.publish_agreements",
"listing.publish_cooldown_minutes",
"listing.publish_options",
"listing.review_required",
"listing.sale_price_config",
@@ -2,6 +2,8 @@ package systemconfig
import (
"context"
"strconv"
"strings"
)
func (s *Service) Update(ctx context.Context, actorID uint64, key string, req UpdateRequest, meta AuditMeta) (*ConfigDTO, error) {
@@ -11,5 +13,11 @@ func (s *Service) Update(ctx context.Context, actorID uint64, key string, req Up
if key == "" || (req.Value == "" && key != "integration.paddle_ocr_token") {
return nil, ErrInvalidConfig
}
if key == "listing.publish_cooldown_minutes" {
minutes, err := strconv.Atoi(strings.TrimSpace(req.Value))
if err != nil || minutes < 0 {
return nil, ErrInvalidConfig
}
}
return s.repo.Update(ctx, actorID, key, req, meta)
}