From 0a4e55b1cbeb7b81dfa51ebcee2ce83f303dad91 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期日, 28 九月 2025 18:43:04 +0800 Subject: [PATCH] app用户登录,后台用户登录 --- ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java | 108 +++++++++++++++++++++++++++--------------------------- 1 files changed, 54 insertions(+), 54 deletions(-) diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java index 119a5ea..c38d11f 100644 --- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java +++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/tool/MsgUtils.java @@ -13,58 +13,58 @@ @Slf4j public class MsgUtils { - @Value("${code.config.accessKeyId}") - private String accessKeyId; - @Value("${code.config.accessKeySecret}") - private String accessKeySecret; - @Value("${code.config.signName}") - private String signName; - @Value("${code.config.templateCode}") - private String templateCode; - @Value("${code.config.signNameTest}") - private String signNameTest; - @Value("${code.config.templateCodeTest}") - private String templateCodeTest; - - /** - * 使用AK&SK初始化账号Client - * @param accessKeyId - * @param accessKeySecret - * @return Client - * @throws Exception - */ - public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { - Config config = new Config() - // 您的 AccessKey ID - .setAccessKeyId(accessKeyId) - // 您的 AccessKey Secret - .setAccessKeySecret(accessKeySecret); - // 访问的域名 - config.endpoint = "dysmsapi.aliyuncs.com"; - return new com.aliyun.dysmsapi20170525.Client(config); - } - - public void sendMsg(String phone,String code) throws Exception { - com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); - SendSmsRequest sendSmsRequest = new SendSmsRequest() - .setSignName(signName) - .setTemplateCode(templateCode) - .setPhoneNumbers(phone) - .setTemplateParam("{\"code\":\""+code+"\"}"); - RuntimeOptions runtime = new RuntimeOptions(); - try { - // 复制代码运行请自行打印 API 的返回值 - SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); - log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); - } catch (TeaException error) { - // 如有需要,请打印 error - com.aliyun.teautil.Common.assertAsString(error.message); - log.info("短信发送失败:{}",error.message); - } catch (Exception _error) { - TeaException error = new TeaException(_error.getMessage(), _error); - // 如有需要,请打印 error - com.aliyun.teautil.Common.assertAsString(error.message); - log.info("短信发送失败:{}",error.message); - } - } +// @Value("${code.config.accessKeyId}") +// private String accessKeyId; +// @Value("${code.config.accessKeySecret}") +// private String accessKeySecret; +// @Value("${code.config.signName}") +// private String signName; +// @Value("${code.config.templateCode}") +// private String templateCode; +// @Value("${code.config.signNameTest}") +// private String signNameTest; +// @Value("${code.config.templateCodeTest}") +// private String templateCodeTest; +// +// /** +// * 使用AK&SK初始化账号Client +// * @param accessKeyId +// * @param accessKeySecret +// * @return Client +// * @throws Exception +// */ +// public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { +// Config config = new Config() +// // 您的 AccessKey ID +// .setAccessKeyId(accessKeyId) +// // 您的 AccessKey Secret +// .setAccessKeySecret(accessKeySecret); +// // 访问的域名 +// config.endpoint = "dysmsapi.aliyuncs.com"; +// return new com.aliyun.dysmsapi20170525.Client(config); +// } +// +// public void sendMsg(String phone,String code) throws Exception { +// com.aliyun.dysmsapi20170525.Client client = MsgUtils.createClient(accessKeyId,accessKeySecret); +// SendSmsRequest sendSmsRequest = new SendSmsRequest() +// .setSignName(signName) +// .setTemplateCode(templateCode) +// .setPhoneNumbers(phone) +// .setTemplateParam("{\"code\":\""+code+"\"}"); +// RuntimeOptions runtime = new RuntimeOptions(); +// try { +// // 复制代码运行请自行打印 API 的返回值 +// SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); +// log.info("短信发送成功:{},{}",sendSmsResponse.getBody().getMessage(),sendSmsResponse.getStatusCode()); +// } catch (TeaException error) { +// // 如有需要,请打印 error +// com.aliyun.teautil.Common.assertAsString(error.message); +// log.info("短信发送失败:{}",error.message); +// } catch (Exception _error) { +// TeaException error = new TeaException(_error.getMessage(), _error); +// // 如有需要,请打印 error +// com.aliyun.teautil.Common.assertAsString(error.message); +// log.info("短信发送失败:{}",error.message); +// } +// } } -- Gitblit v1.7.1