ArtList 短信验证码投递日志手机号脱敏,避免日志输出明文号码
自动发布开发环境 Nacos 配置 / publish (push) Successful in 22s

This commit is contained in:
2026-11-04 19:55:25 +08:00
parent 772835d80d
commit ac35984ca3
@@ -6,6 +6,7 @@ import com.xiaowang.jayucloud.artlist.core.modules.integration.entity.MessageHub
import com.xiaowang.jayucloud.artlist.core.modules.integration.service.MessageHubClientService;
import com.xiaowang.jayucloud.artlist.core.modules.integration.service.MessageHubPushConfigService;
import com.xiaowang.jayucloud.artlist.core.support.id.TimeOrderedSnowflakeIdGenerator;
import com.xiaowang.jayucloud.artlist.core.support.privacy.PhoneCrypto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
@@ -51,6 +52,7 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
* 平台品牌文案配置。
*/
private final BrandProperties brandProperties;
private final PhoneCrypto phoneCrypto;
@Value("${messagehub.client.sms-queue:smsQueue}")
/**
@@ -123,7 +125,7 @@ public class MessageHubClientServiceImpl implements MessageHubClientService {
String queueName = config == null ? smsQueue : config.getQueueName();
rabbitTemplate.convertAndSend(queueName, message);
log.info("短信验证码消息已投递到 MessageHub,sceneCode: {}, phone: {}, queue: {}, sourceSystem: {}, templateCode: {}",
sceneCode, phone, queueName, messageBody.get("sourceSystem"), messageBody.get("templateCode"));
sceneCode, phoneCrypto.mask(phone), queueName, messageBody.get("sourceSystem"), messageBody.get("templateCode"));
} catch (Exception exception) {
log.error("发送短信验证码失败", exception);
throw new RuntimeException("发送短信验证码失败: " + exception.getMessage(), exception);