类 SmsUtil

java.lang.Object
plus.hiver.common.sms.SmsUtil

@Component public class SmsUtil extends Object
短信工具类

尊重知识产权,CV 请保留版权,海文科技 https://hiver.cc 出品,不允许非法使用,后果自负

作者:
Yazhi Li
  • 构造器详细资料

    • SmsUtil

      public SmsUtil()
  • 方法详细资料

    • getSmsUsed

      public String getSmsUsed()
    • getTemplate

      public String getTemplate(String type)
      获得对应完整短信模版Key
      参数:
      type -
      返回:
    • getTemplateCode

      public String getTemplateCode(String type)
    • sendCode

      public void sendCode(String mobile, String code, String type)
      发送验证码 模版变量为${code} 无需模版编号
      参数:
      mobile -
      code -
      type - 短信模版类型 详见SettingConstant
      抛出:
      com.aliyuncs.exceptions.ClientException
    • sendSms

      public void sendSms(String mobile, String params, String templateCode)
      发送短信
      参数:
      mobile - 手机号 多个,逗号分隔 若为11位国内手机号无需加国家区号86 国际号码需加上区号 [国家或地区码][手机号] 如8109012345678、86为日本、09012345678为手机号
      params - 参数 JSON格式,如{"code": "1234"} 若启用腾讯短信会自动按顺序转换为逗号分隔的数组值如[1234]
      templateCode - 短信模板code/id