优化结构

This commit is contained in:
Yvan
2026-08-28 16:56:10 +08:00
parent 6f9908d926
commit b370089942
11 changed files with 65 additions and 49 deletions
@@ -243,7 +243,11 @@ func validateCommunicationIntegrationConfig(kind, provider string, values map[st
return errors.New("不支持的通信集成")
}
for _, field := range definition.Fields {
if field.Required && integrationText(values, field.Key) == "" {
value := integrationText(values, field.Key)
if provider == bizpayment.PaymentDouyin && field.Key == "platform_serial_no" {
value = integrationFirst(values, "platform_serial_no", "platform_cert_serial")
}
if field.Required && value == "" {
return fmt.Errorf("%s 缺少配置字段 %s", provider, field.Key)
}
}
+4 -2
View File
@@ -50,8 +50,10 @@ func sanitizeFailureMessage(message string) string {
return "操作失败"
}
}
if strings.Contains(message, "失败:") {
return strings.TrimSpace(strings.SplitN(message, "失败:", 2)[0]) + "失败"
for _, separator := range []string{"失败:", "失败:"} {
if strings.Contains(message, separator) {
return strings.TrimSpace(strings.SplitN(message, separator, 2)[0]) + "失败"
}
}
return message
}
+1 -1
View File
@@ -70,7 +70,7 @@ func failureLogModule(path string) string {
}
func expectedClientFailure(message string) bool {
for _, value := range []string{"参数错误", "请输入用户名和密码", "验证码错误", "用户名不存在或者密码错误", "用户被禁止登录", "账号已锁定", "请求太过频繁", "权限不足", "密码已过期", "未登录", "token", "令牌失效"} {
for _, value := range []string{"参数错误", "请输入用户名和密码", "验证码错误", "用户名不存在或者密码错误", "用户被禁止登录", "账号已锁定", "请求太过频繁", "权限不足", "密码已过期", "未登录", "token 失效", "令牌失效"} {
if strings.Contains(message, value) {
return true
}
+17
View File
@@ -92,6 +92,23 @@ func (s *TaskScheduler) Start(ctx context.Context) error {
s.lifecycleMu.Unlock()
if err := s.Reload(runContext); err != nil {
logger.WarnContext(runContext, "timed task table is not ready", "error", err)
go func() {
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for {
select {
case <-runContext.Done():
return
case <-ticker.C:
if retryErr := s.Reload(runContext); retryErr == nil {
logger.InfoContext(runContext, "timed task table loaded after retry")
return
} else {
logger.WarnContext(runContext, "timed task table retry failed", "error", retryErr)
}
}
}
}()
}
// Stop cancels runContext. Waiting on the child context is important: the
// application lifecycle passes a long-lived parent context to Start and