package com.ruoyi.message.sms;
|
|
import com.ruoyi.message.SendResult;
|
|
/**
|
* 短信发送方(一个渠道一个实现)。
|
* <p>
|
* 各站点对接方式差异很大 —— 报文格式、鉴权/签名、token 换取、返回码判定、配置来源都不同,
|
* 因此不要用一个实现加参数分支来做,而是一个渠道一个类,类内部保持与线上完全一致的行为。
|
*/
|
public interface SmsSender {
|
|
/**
|
* 发送方唯一 key。
|
* <p>
|
* 该 key 同时是 {@code spring.profiles.active} 的取值(xh / ls / sltd / nhfy / hzszlyy ...),
|
* 由 {@code MessageSenderFactory} 按 key 路由。
|
*/
|
String key();
|
|
/**
|
* 发送短信
|
*
|
* @param request 统一入参
|
* @return 统一结果,不抛异常(网络/解析异常也会被包装成失败结果)
|
*/
|
SendResult send(SmsSendRequest request);
|
|
/**
|
* 发送方说明,用于日志与排查
|
*/
|
default String description() {
|
return key();
|
}
|
}
|