zoukankan      html  css  js  c++  java
  • 阿里云短信服务模板

    引入短信服务包

    <!--        短信服务-->
            <dependency>
                <groupId>com.aliyun</groupId>
                <artifactId>aliyun-java-sdk-core</artifactId>
                <version>4.5.1</version>
            </dependency>
    
    
    public interface SendSms {
        public boolean sendSms(String phoneNum , String templateCode, Map<String,Object> code);
    }
    
    
    public class SendSmsImpl implements SendSms {
        @Override
        public boolean sendSms(String phoneNum, String templateCode, Map<String, Object> code) {
    
    //        更换为自己的阿里云key
            DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "", "");
            IAcsClient client = new DefaultAcsClient(profile);
    
            CommonRequest request = new CommonRequest();
            request.setSysMethod(MethodType.POST);
            request.setSysDomain("dysmsapi.aliyuncs.com");
            request.setSysVersion("2017-05-25");
            request.setSysAction("SendSms");
    
            request.putQueryParameter("PhoneNumbers", phoneNum);
            request.putQueryParameter("SignName", "小老弟科技");
            request.putQueryParameter("TemplateCode", templateCode);
    
            request.putQueryParameter("TemplateParam", JSONObject.toJSONString(code));
            try {
                CommonResponse response = client.getCommonResponse(request);
                System.out.println(response.getData());
                return response.getHttpResponse().isSuccess();
            } catch (ServerException e) {
                e.printStackTrace();
            } catch (ClientException e) {
                e.printStackTrace();
            }
            return false;
        }
    }
    
    
  • 相关阅读:
    纹理作用于栅格建模
    Blender模拟全局照明的简单方法
    材质组合卡通眼球
    Blender 曲线操作
    材质纹理的初级示例
    Quick Noodle Physics in Blender Tutorial
    Blender简单动画:一个小球从一座山上滚下.
    PostgreSQL的目录结构及修改数据目录
    PostgreSQL的配置文件
    CentOS7安装PostgreSQL10,pgadmin4
  • 原文地址:https://www.cnblogs.com/xiaolaodi1999/p/13398861.html
Copyright © 2011-2022 走看看