【仅供内部供应商使用,不提供对外解答和培训】

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

接口作用

通过第三方短信平台发送短信,可以根据自己需求实现短信服务和监听服务。

接口内容

主要接口

SMSServiceProcessor
public interface SMSServiceProcessor extends Immutable {

    int CURRENT_LEVEL = 1;

    String XML_TAG = "SMSServiceProcessor";

    /**
     * 发送测试短信
     * @param mobile 接收短信的手机号
     * @return 结果
     */
    ThirdResponse sendTest(String mobile);
   
    /**
     * FR包含的短信发送功能
     * @param template 发送短信的模板(里面有参数,需要根据后面的para里的参数值进行替换)
     * @param mobile 接收短信的手机号
     * @param para 生成最终短信需要的参数
     * @param receiver 接收者(用户)
     * @return 结果
     * @throws Exception 异常
     */
    ThirdResponse send(String template, String mobile, JSONObject para, String receiver) throws Exception;

    /**
     * FR包含的批量发送短信的功能
     * @param template 发送短信的模板(里面有参数,需要根据后面的para里的参数值进行替换)
     * @param mobiles 接收短信的手机号列表
     * @param params 对应的生成最终短信需要的参数JSON数组
     * @param receivers 接收者(用户)列表,三个列表/数组,根据序号一一对应
     * @return 结果
     * @throws Exception 异常
     */
    ThirdResponse batchSendSMS(String template, List<String> mobiles, JSONArray params, List<String> receivers) throws Exception;
}
SMSListener
public interface SMSListener {

    /**
     * 短信发送前事件处理接口
     * @param text 发送短信的模板(里面有参数,需要根据后面的para里的参数值进行替换)
     * @param mobiles 接收短信的手机号列表
     * @param params 生成最终短信需要的参数JSON数组
     * @param receivers 接收者(用户)列表
     */
    void beforeSend(String text, List<String> mobiles, JSONArray params, List<String> receivers);

    /**
     * 短信发送后事件处理接口
     * @param text 发送短信的模板(里面有参数,需要根据后面的para里的参数值进行替换)
     * @param mobiles 接收短信的手机号列表
     * @param params 生成最终短信需要的参数JSON数组
     * @param receivers 接收者(用户)列表
     * @param response 响应(仅在使用了第三方服务接口后且仅在发送结束后事件有效!)
     */
    void afterSend(String text, List<String> mobiles, JSONArray params, List<String> receivers, ThirdResponse response);
}

关联接口

Immutable接口

接口接入

<extra-core>
    <SMSServiceProcessor class="com.fr.plugin.third.sms.SRGT"/>
</extra-core>

示例效果

接口示例

示例源码:https://git.fanruan.com/fanruan/demo-third-sms

注意事项

项目短信编号默认模板内容
日志清理预警49 
定时任务发送失败提醒10 
上报流程提醒54 
上报流程预警53 
短信平台告警136 
 短信平台开通通知19 
短息登录验证码20 
  • No labels