//package com.ruoyi.study.utils;
|
//
|
//
|
//public class Sample {
|
//
|
// /**
|
// * <b>description</b> :
|
// * <p>使用凭据初始化账号Client</p>
|
// * @return Client
|
// *
|
// * @throws Exception
|
// */
|
// public static com.aliyun.teaopenapi.Client createClient() throws Exception {
|
// // 工程代码建议使用更安全的无AK方式,凭据配置方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
// com.aliyun.credentials.Client credential = new com.aliyun.credentials.Client();
|
// com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
// .setCredential(credential);
|
// // Endpoint 请参考 https://api.aliyun.com/product/Dysmsapi
|
// config.endpoint = "dysmsapi.aliyuncs.com";
|
// return new com.aliyun.teaopenapi.Client(config);
|
// }
|
//
|
// /**
|
// * <b>description</b> :
|
// * <p>API 相关</p>
|
// *
|
// * @param path string Path parameters
|
// * @return OpenApi.Params
|
// */
|
// public static com.aliyun.teaopenapi.models.Params createApiInfo() throws Exception {
|
// com.aliyun.teaopenapi.models.Params params = new com.aliyun.teaopenapi.models.Params()
|
// // 接口名称
|
// .setAction("SendSms")
|
// // 接口版本
|
// .setVersion("2017-05-25")
|
// // 接口协议
|
// .setProtocol("HTTPS")
|
// // 接口 HTTP 方法
|
// .setMethod("POST")
|
// .setAuthType("AK")
|
// .setStyle("RPC")
|
// // 接口 PATH
|
// .setPathname("/")
|
// // 接口请求体内容格式
|
// .setReqBodyType("json")
|
// // 接口响应体内容格式
|
// .setBodyType("json");
|
// return params;
|
// }
|
//
|
// public static void main(String[] args_) throws Exception {
|
//
|
// com.aliyun.teaopenapi.Client client = Sample.createClient();
|
// com.aliyun.teaopenapi.models.Params params = Sample.createApiInfo();
|
// // query params
|
// java.util.Map<String, Object> queries = new java.util.HashMap<>();
|
// queries.put("PhoneNumbers", "17828262728");
|
// queries.put("SignName", "海南众慧智能教育");
|
// queries.put("TemplateCode", "SMS_333505709");
|
// queries.put("TemplateParam", "{\"code\":\"1234\"}");
|
// // runtime options
|
// com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
// com.aliyun.teaopenapi.models.OpenApiRequest request = new com.aliyun.teaopenapi.models.OpenApiRequest()
|
// .setQuery(com.aliyun.openapiutil.Client.query(queries));
|
// // 返回值实际为 Map 类型,可从 Map 中获得三类数据:响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
|
// Object resp = client.callApi(params, request, runtime);
|
// System.out.println(new com.google.gson.Gson().toJson(resp));
|
// }
|
//}
|