新视频推送接收(未测) app升级 告警 国际短信跟谷歌邮箱接入

This commit is contained in:
yuhaiming
2026-09-19 08:47:04 +08:00
parent e4ef35c795
commit bc1074d194
92 changed files with 5535 additions and 340 deletions

View File

@@ -8,6 +8,7 @@ import com.aliyun.teautil.models.RuntimeOptions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.DesensitizedUtils;
import org.dromara.common.sms.config.AliyunInternationalSmsProperties;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -33,7 +34,9 @@ public class AliyunInternationalSmsService {
* @return 发送结果
*/
public SendMessageToGlobeResponseBody sendMessageToGlobe(String to, String message) {
log.info("国际短信发送开始, 手机号={}, message={}", to, message);
String maskedTo = DesensitizedUtils.maskHighSecurity(to, 3, 2);
// 国际短信正文包含验证码,日志只保留脱敏后的目标号码,不记录验证码。
log.info("国际短信发送开始, 手机号={}", maskedTo);
SendMessageToGlobeRequest request = new SendMessageToGlobeRequest()
.setTo(to)
.setMessage("您的验证码为:" + message + ",请勿泄露于他人!");
@@ -45,15 +48,19 @@ public class AliyunInternationalSmsService {
.sendMessageToGlobeWithOptions(request, new RuntimeOptions());
SendMessageToGlobeResponseBody body = response.getBody();
if (body == null || !"OK".equalsIgnoreCase(body.getResponseCode())) {
log.error("国际短信发送失败, to={}, body={}", to, body);
log.error("国际短信发送失败, to={}, responseCode={}", maskedTo,
body == null ? null : body.getResponseCode());
throw new ServiceException("国际短信发送失败:" + (body == null ? "无响应" : body.getResponseCode()));
}
return body;
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.error("国际短信发送异常, to={}", to, e);
throw new ServiceException("国际短信发送异常:" + e.getMessage());
// 供应商异常可能回显请求参数,日志不输出异常原文或堆栈。
log.error("国际短信发送异常, to={}, error={}",
maskedTo, e.getClass().getSimpleName());
// 底层异常可能回显请求参数,不向客户端透传供应商原文。
throw new ServiceException("国际短信发送异常");
}
}