feat(sms): 新增节点短信提醒(审核未通过/被租用需辅助/上架未成交)

This commit is contained in:
yml2213
2026-10-14 14:57:52 +08:00
parent efa0aa4ffd
commit 93e102b7c0
38 changed files with 3228 additions and 70 deletions
@@ -3,6 +3,8 @@ package systemconfig
import (
"strconv"
"strings"
smsnode "hfb_sys/backend/internal/modules/sms"
)
// DistributionSettlementHoldDaysKey 是「新建分销站点默认结算冷却天数」的系统配置键。
@@ -29,6 +31,11 @@ func validateConfigValue(key, value string) error {
switch key {
case DistributionSettlementHoldDaysKey:
return validateDistributionSettlementHoldDays(value)
case smsnode.ConfigKey:
if _, err := smsnode.ParseConfigValue(value); err != nil {
return ErrInvalidConfig
}
return nil
default:
return nil
}
@@ -10,6 +10,7 @@ import (
"hfb_sys/backend/internal/auditlog"
"hfb_sys/backend/internal/model"
"hfb_sys/backend/internal/modules/rentergrowth"
smsnode "hfb_sys/backend/internal/modules/sms"
"gorm.io/gorm"
"gorm.io/gorm/clause"
@@ -41,6 +42,7 @@ var defaultConfigs = []defaultConfig{
{Key: orderAgreementsConfigKey, Value: defaultOrderAgreementsConfigValue(), Description: "下单前协议配置 JSON"},
{Key: postRentalNoticeConfigKey, Value: defaultPostRentalNoticeConfigValue(), Description: "租后须知配置 JSON"},
{Key: rentergrowth.ConfigKey, Value: rentergrowth.DefaultConfigValue(), Description: "租客成长等级规则(积分门槛、租金折扣、等级免押额度)"},
{Key: smsnode.ConfigKey, Value: smsnode.DefaultConfigValue(), Description: "节点短信模板配置(总开关、各业务节点模板 CODE)"},
{Key: "chat.default_support_admin_id", Value: "2", Description: "默认客服 ID(必须是启用状态的客服角色)"},
{Key: "chat.auto_welcome_message", Value: "欢迎加入订单群聊!如有任何问题,请随时沟通。", Description: "建群后自动发送的欢迎话术"},
{Key: "chat.listing_group_welcome", Value: "欢迎加入账号群!请号主扫描下方二维码加入企业微信群,方便客服与您及时联系。", Description: "发布群创建后自动发送的欢迎语"},
@@ -87,6 +89,7 @@ var adminVisibleConfigKeys = []string{
"order.return_overdue_grace_minutes",
"profile.post_rental_notice",
"renter.growth_level_rules",
"sms.business_templates",
}
func NewRepository(db *gorm.DB) *Repository {
@@ -6,6 +6,7 @@ import (
"strings"
"hfb_sys/backend/internal/modules/rentergrowth"
smsnode "hfb_sys/backend/internal/modules/sms"
)
func (s *Service) Update(ctx context.Context, actorID uint64, key string, req UpdateRequest, meta AuditMeta) (*ConfigDTO, error) {
@@ -36,6 +37,17 @@ func (s *Service) Update(ctx context.Context, actorID uint64, key string, req Up
}
req.Value = value
}
if key == smsnode.ConfigKey {
cfg, err := smsnode.ParseConfigValue(req.Value)
if err != nil {
return nil, ErrInvalidConfig
}
value, err := smsnode.MarshalConfig(cfg)
if err != nil {
return nil, ErrInvalidConfig
}
req.Value = value
}
return s.repo.Update(ctx, actorID, key, req, meta)
}