From df84264e37b9f4397e31db01d2ed98dfcbc7888b Mon Sep 17 00:00:00 2001 From: Menethil Date: Mon, 16 Jul 2018 19:11:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=B1=BB=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=A8=A1=E7=89=88=E9=80=9A=E7=9F=A5=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=85=8D=E7=BD=AE=E4=B8=BAyaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-core/pom.xml | 9 +++ .../litemall/core/notify/ExecutorConfig.java | 8 +- .../core/notify/LitemallNotifyService.java | 81 +++++++++++-------- .../litemall/core/notify/MailSendService.java | 42 +++++----- .../litemall/core/notify/NotifyUtils.java | 14 ---- .../litemall/core/notify/SMSSendService.java | 31 ++++--- ...ervice.java => WXTemplateSendService.java} | 50 ++++++++---- .../core/notify/config/MailNotifyConfig.java | 54 +++++++++++++ .../core/notify/config/SMSNotifyConfig.java | 58 +++++++++++++ .../core/notify/config/WXNotifyConfig.java | 31 +++++++ .../litemall/core/notify/util/ConfigUtil.java | 51 ++++++++++++ .../src/main/resources/application.yaml | 36 +++++++++ .../src/main/resources/notify.properties | 23 ------ .../org/linlinjava/litemall/core/SmsTest.java | 6 +- .../litemall/wx/web/WxOrderController.java | 4 +- 15 files changed, 366 insertions(+), 132 deletions(-) delete mode 100644 litemall-core/src/main/java/org/linlinjava/litemall/core/notify/NotifyUtils.java rename litemall-core/src/main/java/org/linlinjava/litemall/core/notify/{WXTemplateMsgSendService.java => WXTemplateSendService.java} (78%) create mode 100644 litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/MailNotifyConfig.java create mode 100644 litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/SMSNotifyConfig.java create mode 100644 litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/WXNotifyConfig.java create mode 100644 litemall-core/src/main/java/org/linlinjava/litemall/core/notify/util/ConfigUtil.java create mode 100644 litemall-core/src/main/resources/application.yaml delete mode 100644 litemall-core/src/main/resources/notify.properties diff --git a/litemall-core/pom.xml b/litemall-core/pom.xml index 9855ec35..8137e305 100644 --- a/litemall-core/pom.xml +++ b/litemall-core/pom.xml @@ -47,6 +47,15 @@ qcloudsms 1.0.5 + + com.github.binarywang + weixin-java-miniapp + + + org.springframework.boot + spring-boot-configuration-processor + true + diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/ExecutorConfig.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/ExecutorConfig.java index 143fc191..6a7c9c0c 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/ExecutorConfig.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/ExecutorConfig.java @@ -19,11 +19,11 @@ import java.util.concurrent.ThreadPoolExecutor; @EnableAsync class ExecutorConfig { - @Value("${spring.notify.corePoolSize}") + @Value("${NotifyPoolConfig.corePoolSize}") private int corePoolSize; - @Value("${spring.notify.maxPoolSize}") + @Value("${NotifyPoolConfig.maxPoolSize}") private int maxPoolSize; - @Value("${spring.notify.queueCapacity}") + @Value("${NotifyPoolConfig.queueCapacity}") private int queueCapacity; @Bean(name = "notifyAsync") @@ -37,4 +37,4 @@ class ExecutorConfig { executor.initialize(); return executor; } -} +} \ No newline at end of file diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/LitemallNotifyService.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/LitemallNotifyService.java index fcdaecbd..ffc78d2e 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/LitemallNotifyService.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/LitemallNotifyService.java @@ -1,55 +1,62 @@ package org.linlinjava.litemall.core.notify; +import org.linlinjava.litemall.core.notify.util.ConfigUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; /** * Litemall商城通知服务类 */ -@PropertySource(value = "classpath:notify.properties") @Service("litemallNotifyService") public class LitemallNotifyService { @Autowired - MailSendService mailSendService; + private MailSendService mailSendService; @Autowired - SMSSendService smsSendService; + private SMSSendService smsSendService; @Autowired - Environment environment; + private WXTemplateSendService wxTemplateSendService; - @Value("${sprint.mail.enable}") - private boolean sendMailEnable; - @Value("${spring.sms.enable}") - private boolean sendSMSEnable; - - public void notifySMSMessage(String phoneNumber,String message) { - if (!sendSMSEnable) + @Async("notifyAsync") + public void notifySMSMessage(String phoneNumber, String message) { + if (!smsSendService.config.isEnable()) return; smsSendService.sendSMS(phoneNumber, message); } /** - * 短信模版通知 - * @param phoneNumber 接收通知的电话号码 + * 微信模版消息通知 + * @param token 通过wxMAService获取token或者通过url请求token + * @param touser 接收者openId + * @param formId 表单ID或者 prepayId * @param notifyType 通知类别,通过该枚举值在配置文件中获取相应的模版ID * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 */ - public void notifySMSTemplate(String phoneNumber, NotifyUtils.NotifyType notifyType, String[] params) { - if (!sendSMSEnable) + @Async("notifyAsync") + public void notifyWXTemplate(String token,String touser, String formId, ConfigUtil.NotifyType notifyType, String[] params) { + if (!wxTemplateSendService.config.isEnable()) return; - int templateId = -1; - switch (notifyType) { - case PAY_SUCCEED: - templateId = Integer.parseInt(environment.getProperty("spring.sms.template.paySucceed")); - break; - case CAPTCHA: - templateId = Integer.parseInt(environment.getProperty("spring.sms.template.captcha")); - break; - } + String templateId = ConfigUtil.getTemplateId(notifyType, wxTemplateSendService.config.getTemplate()); + + if (templateId != "") + wxTemplateSendService.sendWechatMsg(token,touser, templateId, formId, "", "", params); + } + + /** + * 短信模版通知 + * + * @param phoneNumber 接收通知的电话号码 + * @param notifyType 通知类别,通过该枚举值在配置文件中获取相应的模版ID + * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 + */ + @Async("notifyAsync") + public void notifySMSTemplate(String phoneNumber, ConfigUtil.NotifyType notifyType, String[] params) { + if (!smsSendService.config.isEnable()) + return; + + int templateId = Integer.parseInt(ConfigUtil.getTemplateId(notifyType, smsSendService.config.getTemplate())); if (templateId != -1) smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params); @@ -57,24 +64,28 @@ public class LitemallNotifyService { /** * 短信模版通知 - * @param phoneNumber 接收通知的电话号码 - * @param templateId 模板ID - * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 + * + * @param phoneNumber 接收通知的电话号码 + * @param templateId 模板ID + * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 */ + @Async("notifyAsync") public void notifySMSTemplate(String phoneNumber, int templateId, String[] params) { - if (!sendSMSEnable) + if (!smsSendService.config.isEnable()) return; - smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params); + smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params); } /** * 发送邮件通知,接收者在spring.mail.sendto中指定 - * @param setSubject 邮件标题 - * @param setText 邮件内容 + * + * @param setSubject 邮件标题 + * @param setText 邮件内容 */ + @Async("notifyAsync") public void notifyMailMessage(String setSubject, String setText) { - if(!sendMailEnable) + if (!mailSendService.config.isEnable()) return; mailSendService.sendEmail(setSubject, setText); diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/MailSendService.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/MailSendService.java index 85a0311d..6966dbda 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/MailSendService.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/MailSendService.java @@ -1,43 +1,47 @@ package org.linlinjava.litemall.core.notify; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.PropertySource; -import org.springframework.mail.javamail.JavaMailSender; +import org.linlinjava.litemall.core.notify.config.MailNotifyConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import javax.mail.internet.MimeMessage; -@PropertySource(value = "classpath:notify.properties") @Service("mailSendService") class MailSendService { - @Resource - private JavaMailSender mailSender; + @Autowired + MailNotifyConfig config; - @Value("${spring.mail.username}") - private String from; + private JavaMailSenderImpl mailSender; - @Value("${spring.mail.sendto}") - private String sendto; + private JavaMailSenderImpl getMailSender() { + if (mailSender == null) { + mailSender = new JavaMailSenderImpl(); + mailSender.setHost(config.getHost()); + mailSender.setUsername(config.getUsername()); + mailSender.setPassword(config.getPassword()); + } + + return mailSender; + } /** - * 异步发送邮件通知 + * 发送邮件通知 + * * @param setSubject 邮件标题 - * @param setText 邮件内容 + * @param setText 邮件内容 */ - @Async("notifyAsync") public void sendEmail(String setSubject, String setText) { try { - final MimeMessage mimeMessage = mailSender.createMimeMessage(); + final MimeMessage mimeMessage = getMailSender().createMimeMessage(); final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); - message.setFrom(from); - message.setTo(sendto); + message.setFrom(config.getUsername()); + message.setTo(config.getSendto()); message.setSubject(setSubject); message.setText(setText); - mailSender.send(mimeMessage); + getMailSender().send(mimeMessage); } catch (Exception ex) { ex.printStackTrace(); diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/NotifyUtils.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/NotifyUtils.java deleted file mode 100644 index 6ffaf236..00000000 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/NotifyUtils.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.linlinjava.litemall.core.notify; - -public class NotifyUtils { - /** - * 该枚举定义了所有的需要通知的事件,调用通知时作为参数 - * - * PAY_SUCCEED 支付成功,通常用于用户支付成功 - * CAPTCHA 验证码,通常用于登录、注册、找回密码 - */ - public enum NotifyType { - PAY_SUCCEED, - CAPTCHA - } -} diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/SMSSendService.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/SMSSendService.java index 6b2375fd..4bc7ee8d 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/SMSSendService.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/SMSSendService.java @@ -4,29 +4,21 @@ import com.github.qcloudsms.SmsSingleSender; import com.github.qcloudsms.SmsSingleSenderResult; import com.github.qcloudsms.httpclient.HTTPException; import org.json.JSONException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.PropertySource; -import org.springframework.scheduling.annotation.Async; +import org.linlinjava.litemall.core.notify.config.SMSNotifyConfig; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; -@PropertySource(value = "classpath:notify.properties") + @Service("smsSendService") class SMSSendService { - @Value("${spring.sms.appid}") - private int appid; + @Autowired + SMSNotifyConfig config; - @Value("${spring.sms.appkey}") - private String appkey; - - @Value("${spring.sms.sign}") - private String smsSign; - - @Async("notifyAsync") public void sendSMS(String phoneNumber, String content) { try { - SmsSingleSender ssender = new SmsSingleSender(appid, appkey); + SmsSingleSender ssender = new SmsSingleSender(config.getAppid(), config.getAppkey()); SmsSingleSenderResult result = ssender.send(0, "86", phoneNumber, content, "", ""); @@ -43,12 +35,17 @@ class SMSSendService { } } - @Async("notifyAsync") + /** + * 通过模版发送短信息 + * @param phoneNumber + * @param templateId + * @param params + */ public void sendSMSWithTemplate(String phoneNumber, int templateId, String[] params) { try { - SmsSingleSender ssender = new SmsSingleSender(appid, appkey); + SmsSingleSender ssender = new SmsSingleSender(config.getAppid(), config.getAppkey()); SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumber, - templateId, params, smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 + templateId, params, config.getSign(), "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 // System.out.println(result); } catch (HTTPException e) { // HTTP响应码错误 diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateMsgSendService.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateSendService.java similarity index 78% rename from litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateMsgSendService.java rename to litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateSendService.java index cdaca41f..1b55237b 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateMsgSendService.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/WXTemplateSendService.java @@ -1,7 +1,8 @@ package org.linlinjava.litemall.core.notify; import org.json.JSONObject; -import org.springframework.context.annotation.PropertySource; +import org.linlinjava.litemall.core.notify.config.WXNotifyConfig; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.net.ssl.*; @@ -16,11 +17,13 @@ import java.security.cert.CertificateException; import java.security.cert.X509Certificate; /** - * 微信模版消息通知,未完成 + * 微信模版消息通知 */ -@PropertySource(value = "classpath:notify.properties") @Service("wxTemplateMsgSendService") -public class WXTemplateMsgSendService { +class WXTemplateSendService { + @Autowired + WXNotifyConfig config; + /** * 发送微信消息(模板消息) * @@ -29,19 +32,20 @@ public class WXTemplateMsgSendService { * @param formId payId或者表单ID * @param clickurl URL置空,则在发送后,点击模板消息会进入一个空白页面(ios),或无法点击(android)。 * @param topcolor 标题颜色 - * @param data 详细内容 + * @param parms 详细内容 * @return */ - public String sendWechatMsgToUser(String token, String touser, String templatId, String formId, String clickurl, String topcolor, JSONObject data) { - String tmpurl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + token; - JSONObject json = new JSONObject(); - json.put("touser", touser); - json.put("template_id", templatId); - json.put("form_id", formId); - json.put("url", clickurl); - json.put("topcolor", topcolor); - json.put("data", data); + public String sendWechatMsg(String token, String touser, String templatId, String formId, String clickurl, String topcolor, String[] parms) { try { + String tmpurl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + token; + JSONObject json = new JSONObject(); + json.put("touser", touser); + json.put("template_id", templatId); + json.put("form_id", formId); + json.put("url", clickurl); + json.put("topcolor", topcolor); + json.put("data", createParmData(parms)); + JSONObject result = httpsRequest(tmpurl, "POST", json.toString()); // log.info("发送微信消息返回信息:" + resultJson.get("errcode")); String errmsg = (String) result.get("errmsg"); @@ -55,6 +59,23 @@ public class WXTemplateMsgSendService { return "success"; } + /** + * 根据参数生成对应的 json 数据 + * @param parms + * @return + */ + private JSONObject createParmData(String[] parms) { + JSONObject json = new JSONObject(); + for (int i = 1; i <= parms.length; i++) { + JSONObject json2 = new JSONObject(); + json2.put("value", parms[i-1]); + + json.put("keyword" + i, json2); + } + + return json; + } + /** * 发送https请求 * @@ -125,7 +146,6 @@ public class WXTemplateMsgSendService { @Override public X509Certificate[] getAcceptedIssuers() { - // return new X509Certificate[0]; return null; } } diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/MailNotifyConfig.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/MailNotifyConfig.java new file mode 100644 index 00000000..5e32ab61 --- /dev/null +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/MailNotifyConfig.java @@ -0,0 +1,54 @@ +package org.linlinjava.litemall.core.notify.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "MailNotifyConfig") +public class MailNotifyConfig { + private boolean enable; + private String host; + private String username; + private String password; + private String sendto; + + public boolean isEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSendto() { + return sendto; + } + + public void setSendto(String sendto) { + this.sendto = sendto; + } +} diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/SMSNotifyConfig.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/SMSNotifyConfig.java new file mode 100644 index 00000000..56e0ff76 --- /dev/null +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/SMSNotifyConfig.java @@ -0,0 +1,58 @@ +package org.linlinjava.litemall.core.notify.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component +@ConfigurationProperties(prefix = "SMSNotifyConfig") +public class SMSNotifyConfig { + private boolean enable; + private int appid; + private String appkey; + private String sign; + private List> template = new ArrayList<>(); + + public boolean isEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public int getAppid() { + return appid; + } + + public void setAppid(int appid) { + this.appid = appid; + } + + public String getAppkey() { + return appkey; + } + + public void setAppkey(String appkey) { + this.appkey = appkey; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public List> getTemplate() { + return template; + } + + public void setTemplate(List> template) { + this.template = template; + } +} diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/WXNotifyConfig.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/WXNotifyConfig.java new file mode 100644 index 00000000..958a0743 --- /dev/null +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/config/WXNotifyConfig.java @@ -0,0 +1,31 @@ +package org.linlinjava.litemall.core.notify.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component +@ConfigurationProperties(prefix = "WXNotifyConfig") +public class WXNotifyConfig { + private boolean enable; + private List> template = new ArrayList<>(); + + public boolean isEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public List> getTemplate() { + return template; + } + + public void setTemplate(List> template) { + this.template = template; + } +} diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/util/ConfigUtil.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/util/ConfigUtil.java new file mode 100644 index 00000000..55faf59a --- /dev/null +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/notify/util/ConfigUtil.java @@ -0,0 +1,51 @@ +package org.linlinjava.litemall.core.notify.util; + +import java.util.List; +import java.util.Map; + +public class ConfigUtil { + + /** + * 通过枚举获取对应的 templateId,注意 application.yaml 里字段名必须一致 + * @param notifyType + * @param values + * @return + */ + public static String getTemplateId(NotifyType notifyType, List> values) { + for (Map item : values) { + String notifyTypeStr = getNotifyType(notifyType); + + if (item.get("name").equals(notifyTypeStr)) + return item.get("templateId"); + } + return ""; + } + + /** + * 该处字符串对应 application.yaml 里 template.name 的值,请注意 + * @param notifyType + * @return + */ + private static String getNotifyType(NotifyType notifyType) + { + switch (notifyType) { + case PAY_SUCCEED: + return "paySucceed"; + case CAPTCHA: + return "captcha"; + } + + return ""; + } + + /** + * 该枚举定义了所有的需要通知的事件,调用通知时作为参数 + * + * PAY_SUCCEED 支付成功,通常用于用户支付成功 + * CAPTCHA 验证码,通常用于登录、注册、找回密码 + */ + public enum NotifyType { + PAY_SUCCEED, + CAPTCHA + } +} diff --git a/litemall-core/src/main/resources/application.yaml b/litemall-core/src/main/resources/application.yaml new file mode 100644 index 00000000..49f334cc --- /dev/null +++ b/litemall-core/src/main/resources/application.yaml @@ -0,0 +1,36 @@ +# 邮件通知配置,邮箱一般用于接收业务通知例如收到新的订单,sendto 定义邮件接收者,通常为商城运营人员 +MailNotifyConfig: + enable: false + host: smtp.exmail.qq.com + username: ex@ex.com.cn + password: XXXXXXXXXXXXX + sendto: ex@qq.com + +# 短消息模版通知配置 +# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值 +SMSNotifyConfig: + enable: false + appid: 111111111 + appkey: xxxxxxxxxxxxxx + sign: xxxxxxxxx + template: + - name: paySucceed + templateId: 156349 + - name: captcha + templateId: 156433 + +# 微信模版通知配置 +# 微信模版用于通知客户或者运营者,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值 +WXNotifyConfig: + enable: false + template: + - name: paySucceed + templateId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + - name: captcha + templateId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +# 发送线程池配置 +NotifyPoolConfig: + corePoolSize: 5 + maxPoolSize: 100 + queueCapacity: 50 \ No newline at end of file diff --git a/litemall-core/src/main/resources/notify.properties b/litemall-core/src/main/resources/notify.properties deleted file mode 100644 index 313e3278..00000000 --- a/litemall-core/src/main/resources/notify.properties +++ /dev/null @@ -1,23 +0,0 @@ -# \u90AE\u4EF6\u53D1\u9001\u914D\u7F6E -sprint.mail.enable=false -spring.mail.host=smtp.exmail.qq.com -spring.mail.username=xxxxxx -spring.mail.password=xxxxxx -spring.mail.sendto=example@qq.com - -# \u77ED\u4FE1\u53D1\u9001\u914D\u7F6E -spring.sms.enable=false -spring.sms.appid=111111 -spring.sms.appkey=xxxxxx -spring.sms.sign=xxxxxx - -# \u77ED\u4FE1\u6A21\u677F\u6D88\u606F\u914D\u7F6E -# \u8BF7\u5728\u817E\u8BAF\u77ED\u4FE1\u5E73\u53F0\u914D\u7F6E\u901A\u77E5\u6D88\u606F\u6A21\u677F\uFF0C\u7136\u540E\u8FD9\u91CC\u8BBE\u7F6E\u4E0D\u540C\u77ED\u4FE1\u6A21\u677FID -# \u8BF7\u53C2\u8003LitemallNotifyService.notifySMSTemplate -spring.sms.template.paySucceed=111111 -spring.sms.template.captcha=222222 - -# \u53D1\u9001\u7EBF\u7A0B\u6C60\u914D\u7F6E -spring.notify.corePoolSize=5 -spring.notify.maxPoolSize=100 -spring.notify.queueCapacity=50 \ No newline at end of file diff --git a/litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java b/litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java index f8b6d2ad..9d89483e 100644 --- a/litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java +++ b/litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java @@ -3,7 +3,7 @@ package org.linlinjava.litemall.core; import org.junit.Test; import org.junit.runner.RunWith; import org.linlinjava.litemall.core.notify.LitemallNotifyService; -import org.linlinjava.litemall.core.notify.NotifyUtils; +import org.linlinjava.litemall.core.notify.util.ConfigUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -47,7 +47,7 @@ public class SmsTest { String phone = "xxxxxxxxxxx"; String[] params = new String[] {"123456"}; - litemallNotifyService.notifySMSTemplate(phone, NotifyUtils.NotifyType.CAPTCHA, params); + litemallNotifyService.notifySMSTemplate(phone, ConfigUtil.NotifyType.CAPTCHA, params); try { Thread.sleep(5000); @@ -61,7 +61,7 @@ public class SmsTest { String phone = "xxxxxxxxxxx"; String[] params = new String[] {"123456"}; - litemallNotifyService.notifySMSTemplate(phone, NotifyUtils.NotifyType.PAY_SUCCEED, params); + litemallNotifyService.notifySMSTemplate(phone, ConfigUtil.NotifyType.PAY_SUCCEED, params); try { Thread.sleep(5000); diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java index 47a4a39f..78305a19 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java @@ -10,7 +10,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.linlinjava.litemall.core.notify.LitemallNotifyService; -import org.linlinjava.litemall.core.notify.NotifyUtils; +import org.linlinjava.litemall.core.notify.util.ConfigUtil; import org.linlinjava.litemall.core.util.JacksonUtil; import org.linlinjava.litemall.core.util.ResponseUtil; import org.linlinjava.litemall.db.domain.*; @@ -554,7 +554,7 @@ public class WxOrderController { //TODO 发送邮件和短信通知,这里采用异步发送 // 订单支付成功以后,会发送短信给用户,以及发送邮件给管理员 litemallNotifyService.notifyMailMessage("新订单通知", order.toString()); - litemallNotifyService.notifySMSTemplate(order.getMobile(), NotifyUtils.NotifyType.PAY_SUCCEED, new String[]{orderSn}); + litemallNotifyService.notifySMSTemplate(order.getMobile(), ConfigUtil.NotifyType.PAY_SUCCEED, new String[]{orderSn}); return WxPayNotifyResponse.success("处理成功!"); } catch (Exception e) { From 691ac1cbd3b2dc7160acdac1be2a9a4a38cf0778 Mon Sep 17 00:00:00 2001 From: Menethil Date: Mon, 16 Jul 2018 19:32:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=AD=98=E5=82=A8=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 ++-- README.md | 6 +-- litemall-os-api/.gitignore | 1 + ...torageService.java => LocalOsService.java} | 17 +++---- ...Service.java => ObjectStorageService.java} | 2 +- .../TencentOsService.java} | 18 +++----- .../litemall/os/web/OsStorageController.java | 4 +- .../src/main/resources/application.properties | 8 ++-- .../src/main/resources/tencent.properties | 12 ++--- .../org/linlinjava/litemall/os/LosTest.java | 42 ++++++++++++++++++ .../org/linlinjava/litemall/os/TosTest.java | 42 ++++++++++++++++++ .../src/test/resources/litemall.png | Bin 0 -> 8524 bytes 12 files changed, 124 insertions(+), 37 deletions(-) rename litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/{FileSystemStorageService.java => LocalOsService.java} (81%) rename litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/{StorageService.java => ObjectStorageService.java} (94%) rename litemall-os-api/src/main/java/org/linlinjava/litemall/os/{tencent/TencentOSService.java => service/TencentOsService.java} (90%) create mode 100644 litemall-os-api/src/test/java/org/linlinjava/litemall/os/LosTest.java create mode 100644 litemall-os-api/src/test/java/org/linlinjava/litemall/os/TosTest.java create mode 100644 litemall-os-api/src/test/resources/litemall.png diff --git a/CHANGELOG.md b/CHANGELOG.md index ccee4258..f1100b0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,15 @@ ## V 0.7.0 -*2018-06-30*,数据库再次简化 +*2018-07-16*,数据库再次简化,同时支持短信提醒、邮件提醒、腾讯对象存储服务 + * `管理后台`页面查询时默认基于创建时间排序 + * `管理后台`多个页面完善页面效果 * `管理后台`支持商品上架和商品编辑 - * `项目`数据库再次简化、小商城和管理后台代码进行相应调整 + * `基础系统`支持腾讯云短信提醒和邮件提醒,感谢[Menethil](https://github.com/linlinjava/litemall/pull/23) + * `基础系统`支持腾讯对象存储,感谢[Menethil](https://github.com/linlinjava/litemall/pull/24) + * `项目`数据库再次简化,同时小商城和管理后台代码进行相应调整 - ## V 0.6.0 *2018-06-30*,项目支持商品上架和统计功能 diff --git a/README.md b/README.md index dc48e648..0eb81486 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ V 2.0.0 完成以下目标: 1. 小商城能够完成基本的业务功能; 2. 管理后台实现较好的业务操作和交互效果,而不是简单的CRUD; -3. 管理后台实现统计功能、日志功能 +3. 管理后台实现统计功能、日志功能、权限功能 V 3.0.0 完成以下目标: @@ -114,7 +114,7 @@ V 3.0.0 完成以下目标: 查看[更新日志](CHANGELOG.md) -目前V0.6.0 +目前V0.7.0 ## 警告 @@ -158,4 +158,4 @@ V 3.0.0 完成以下目标: ## 相关项目 -[HubertYoung](https://github.com/HubertYoung)正在开发Android端[Litemall-Android](https://github.com/HubertYoung/Litemall-Android) \ No newline at end of file +HubertYoung正在开发Android端[Litemall-Android](https://github.com/HubertYoung/Litemall-Android) \ No newline at end of file diff --git a/litemall-os-api/.gitignore b/litemall-os-api/.gitignore index ee0b013a..63b6b474 100644 --- a/litemall-os-api/.gitignore +++ b/litemall-os-api/.gitignore @@ -1,3 +1,4 @@ /target/ /litemall-os-api.iml +/storage/ diff --git a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/FileSystemStorageService.java b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/LocalOsService.java similarity index 81% rename from litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/FileSystemStorageService.java rename to litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/LocalOsService.java index 3fef0c31..ebe2af6b 100644 --- a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/FileSystemStorageService.java +++ b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/LocalOsService.java @@ -2,7 +2,6 @@ package org.linlinjava.litemall.os.service; import java.io.IOException; -import java.io.InputStream; import java.net.MalformedURLException; import java.nio.file.*; import java.util.stream.Stream; @@ -15,10 +14,12 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; /** - * 服务器本地文件存储 + * 服务器本地对象存储服务 + * + * 缩写los(local object storage) */ -@Service("localStorage") -public class FileSystemStorageService implements StorageService { +@Service("los") +public class LocalOsService implements ObjectStorageService { @Autowired private ObjectStorageConfig osConfig; @@ -35,7 +36,7 @@ public class FileSystemStorageService implements StorageService { @Override public void store(MultipartFile file, String keyName) { try { - Files.copy(file.getInputStream(), this.rootLocation.resolve(keyName), StandardCopyOption.REPLACE_EXISTING); + Files.copy(file.getInputStream(), LocalOsService.rootLocation.resolve(keyName), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new RuntimeException("Failed to store file " + keyName, e); } @@ -44,9 +45,9 @@ public class FileSystemStorageService implements StorageService { @Override public Stream loadAll() { try { - return Files.walk(this.rootLocation, 1) - .filter(path -> !path.equals(this.rootLocation)) - .map(path -> this.rootLocation.relativize(path)); + return Files.walk(LocalOsService.rootLocation, 1) + .filter(path -> !path.equals(LocalOsService.rootLocation)) + .map(path -> LocalOsService.rootLocation.relativize(path)); } catch (IOException e) { throw new RuntimeException("Failed to read stored files", e); } diff --git a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/StorageService.java b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/ObjectStorageService.java similarity index 94% rename from litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/StorageService.java rename to litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/ObjectStorageService.java index 2354e9c1..6b2df45b 100644 --- a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/StorageService.java +++ b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/ObjectStorageService.java @@ -10,7 +10,7 @@ import java.util.stream.Stream; /** * 对象存储接口 */ -public interface StorageService { +public interface ObjectStorageService { /** * 存储一个文件对象 diff --git a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/tencent/TencentOSService.java b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/TencentOsService.java similarity index 90% rename from litemall-os-api/src/main/java/org/linlinjava/litemall/os/tencent/TencentOSService.java rename to litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/TencentOsService.java index a3d02501..eefce850 100644 --- a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/tencent/TencentOSService.java +++ b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/service/TencentOsService.java @@ -1,4 +1,4 @@ -package org.linlinjava.litemall.os.tencent; +package org.linlinjava.litemall.os.service; import com.qcloud.cos.COSClient; import com.qcloud.cos.ClientConfig; @@ -8,7 +8,6 @@ import com.qcloud.cos.model.ObjectMetadata; import com.qcloud.cos.model.PutObjectRequest; import com.qcloud.cos.model.PutObjectResult; import com.qcloud.cos.region.Region; -import org.linlinjava.litemall.os.service.StorageService; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.core.io.Resource; @@ -22,11 +21,13 @@ import java.nio.file.Path; import java.util.stream.Stream; /** - * 腾讯对象存储服务类 + * 腾讯对象存储服务 + * + * 注意:虽然腾讯对象存储英文缩写是cos(cloud object storage),但这里称之为tos(tencent object storage) */ @PropertySource(value = "classpath:tencent.properties") -@Service("tencent") -public class TencentOSService implements StorageService { +@Service("tos") +public class TencentOsService implements ObjectStorageService { @Value("${tencent.os.secretId}") private String accessKey; @@ -39,10 +40,6 @@ public class TencentOSService implements StorageService { private COSClient cosClient; - public TencentOSService() { - - } - private COSClient getCOSClient() { if (cosClient == null) { // 1 初始化用户身份信息(secretId, secretKey) @@ -56,7 +53,6 @@ public class TencentOSService implements StorageService { } private String getBaseUrl() { - //https://litemall-1256968571.cos-website.ap-guangzhou.myqcloud.com return "https://" + bucketName + ".cos-website." + region + ".myqcloud.com/"; } @@ -71,7 +67,7 @@ public class TencentOSService implements StorageService { PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, file.getInputStream(), objectMetadata); PutObjectResult putObjectResult = getCOSClient().putObject(putObjectRequest); } catch (Exception ex) { - System.console().printf(ex.getMessage()); + ex.printStackTrace(); } } diff --git a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/web/OsStorageController.java b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/web/OsStorageController.java index 451ce81c..13a31105 100644 --- a/litemall-os-api/src/main/java/org/linlinjava/litemall/os/web/OsStorageController.java +++ b/litemall-os-api/src/main/java/org/linlinjava/litemall/os/web/OsStorageController.java @@ -4,7 +4,7 @@ import org.linlinjava.litemall.core.util.CharUtil; import org.linlinjava.litemall.core.util.ResponseUtil; import org.linlinjava.litemall.db.domain.LitemallStorage; import org.linlinjava.litemall.db.service.LitemallStorageService; -import org.linlinjava.litemall.os.service.StorageService; +import org.linlinjava.litemall.os.service.ObjectStorageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; @@ -25,7 +25,7 @@ import java.util.Map; public class OsStorageController { @javax.annotation.Resource(name="${activeStorage}") - private StorageService storageService; + private ObjectStorageService storageService; @Autowired private LitemallStorageService litemallStorageService; diff --git a/litemall-os-api/src/main/resources/application.properties b/litemall-os-api/src/main/resources/application.properties index 59eb1f3b..cb2d82a3 100644 --- a/litemall-os-api/src/main/resources/application.properties +++ b/litemall-os-api/src/main/resources/application.properties @@ -3,6 +3,8 @@ server.port=8081 logging.level.org.linlinjava.litemall.os.Application=DEBUG -# \u5B58\u50A8\u5B9E\u73B0\uFF0C\u53EF\u9009\u62E9 localStorage \u6216\u8005 tencent \uFF0C\u5982\u679C\u9009\u62E9 tencent\uFF0C\u9700\u8981\u5F00\u901A\u817E\u8BAF\u5BF9\u8C61\u5B58\u50A8\u5E76\u914D\u7F6E tencent.properties -activeStorage=localStorage -#activeStorage=tencent +# 当前存储模式 +# los,本地对象存储模式,上传图片保存在服务器中 +# tos,腾讯对象存储模式,上传图片保存在腾讯云存储服务器中,请在tencent.properties配置相关信息 +activeStorage=los +#activeStorage=tos diff --git a/litemall-os-api/src/main/resources/tencent.properties b/litemall-os-api/src/main/resources/tencent.properties index 435d03ba..6d9052b6 100644 --- a/litemall-os-api/src/main/resources/tencent.properties +++ b/litemall-os-api/src/main/resources/tencent.properties @@ -1,6 +1,6 @@ - -# \u817E\u8BAF\u4E91\u5B58\u50A8\u76F8\u5173\u914D\u7F6E,\u817E\u8BAF\u4E91\u5FC5\u987B\u6253\u5F00 #\u9759\u6001\u7F51\u7AD9(https://cloud.tencent.com/document/product/436/6249) \u652F\u6301\uFF0C\u5426\u5219\u56FE\u7247\u4F1A\u76F4\u63A5\u4E0B\u8F7D\u800C\u4E0D\u662F\u663E\u793A -tencent.os.secretId="" -tencent.os.secretKey="" -tencent.os.region="" -tencent.os.bucketName="" +# 腾讯对象存储配置信息 +# 请参考 https://cloud.tencent.com/document/product/436/6249 +tencent.os.secretId="xxxxxx" +tencent.os.secretKey="xxxxxx" +tencent.os.region="xxxxxx" +tencent.os.bucketName="xxxxxx" diff --git a/litemall-os-api/src/test/java/org/linlinjava/litemall/os/LosTest.java b/litemall-os-api/src/test/java/org/linlinjava/litemall/os/LosTest.java new file mode 100644 index 00000000..002c90a2 --- /dev/null +++ b/litemall-os-api/src/test/java/org/linlinjava/litemall/os/LosTest.java @@ -0,0 +1,42 @@ +package org.linlinjava.litemall.os; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.linlinjava.litemall.os.service.LocalOsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.io.Resource; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.util.FileCopyUtils; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +@WebAppConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest +public class LosTest { + @Autowired + private LocalOsService localOsService; + + @Test + public void test() throws IOException { + String test = getClass().getClassLoader().getResource("litemall.png").getFile(); + byte[] content = (byte[])FileCopyUtils.copyToByteArray(new FileInputStream(test)); + MockMultipartFile mockMultipartFile = new MockMultipartFile("litemall.png", "litemall.png", "image/jpeg", content); + localOsService.store(mockMultipartFile, "los.png"); + Resource resource = localOsService.loadAsResource("los.png"); + String url = localOsService.generateUrl("los.png"); + System.out.println("test file " + test); + System.out.println("store file " + resource.getURI()); + System.out.println("generate url " + url); + +// localOsService.delete("los.png"); + + } + +} \ No newline at end of file diff --git a/litemall-os-api/src/test/java/org/linlinjava/litemall/os/TosTest.java b/litemall-os-api/src/test/java/org/linlinjava/litemall/os/TosTest.java new file mode 100644 index 00000000..c84d3d2e --- /dev/null +++ b/litemall-os-api/src/test/java/org/linlinjava/litemall/os/TosTest.java @@ -0,0 +1,42 @@ +package org.linlinjava.litemall.os; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.linlinjava.litemall.os.config.ObjectStorageConfig; +import org.linlinjava.litemall.os.service.TencentOsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.io.Resource; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.util.FileCopyUtils; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +@WebAppConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest +public class TosTest { + @Autowired + private TencentOsService tencentOsService; + + @Test + public void test() throws IOException { + String test = getClass().getClassLoader().getResource("litemall.png").getFile(); + byte[] content = (byte[])FileCopyUtils.copyToByteArray(new FileInputStream(test)); + MockMultipartFile mockMultipartFile = new MockMultipartFile("litemall.png", "litemall.png", "image/png", content); + tencentOsService.store(mockMultipartFile, "tos.png"); + Resource resource = tencentOsService.loadAsResource("tos.png"); + String url = tencentOsService.generateUrl("tos.png"); + System.out.println("test file " + test); + System.out.println("store file " + resource.getURI()); + System.out.println("generate url " + url); + +// tencentOsService.delete("tos.png"); + } + +} \ No newline at end of file diff --git a/litemall-os-api/src/test/resources/litemall.png b/litemall-os-api/src/test/resources/litemall.png new file mode 100644 index 0000000000000000000000000000000000000000..d16e9afa0012582aa308a4807f857195301382d5 GIT binary patch literal 8524 zcmb_>c{r5&`~QPNM{>$JAr+N4MPz9dS)ycD%AR$|I)ug&GovGw5R#?DB+FzN%ozJx zwk$O=ma$Gk!VKAFFvffzo$7Ob-|PDQ{`g&=xvrUO-tT$d_x8H)*L^?FL|-wzEcn}j z-v9s*G|<0j4glQXSAfpX3jkd8YHTrZ!4+tJSqCWkaBv1(>~OzeasdGF@dBI9JHhp? zTlzME03fn=`_0uMy{rWQlH&#!FI*3CppObX^|7*_UVO5XfA-t&w=E-DUh-blP53?G zfop`=-#YxHBNGo_i}EHuklcGkteyX1llpnRhx`}zW`r3GX!cdz;NR`=r@bW4JuzK9 zQLf`s+5t6;qTwn7z<@Mn!3kvbp5v5~vOnY(&4z1vv-|04EDOZ^{AkUbz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^`XdrwUQFt<+73?GT~hZnc`Mbv z^0)Ne%vUX3GMBV5j~Em^NO?G(^BNO$RH*`EyFPf$eK1TAKRUxa5s@d-vR+Q4We$4zBOa!RM_f-Qz4H(jmalX*OS;NF z@3HvTj-RmyhgEYNnx|M_L_DIcD@ra@_*Qp#^1Uq*Gj%1bV79a8&Gn`DW$+ fUtCEWZzM;kUP%RC(0>iHEyv)J>BS-)r@#LPIjKke literal 0 HcmV?d00001 From 15af17aadbdbec706e9ec03d68016f6c562f30a7 Mon Sep 17 00:00:00 2001 From: Menethil Date: Mon, 16 Jul 2018 19:46:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/notify.properties | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 litemall-core/src/main/resources/notify.properties diff --git a/litemall-core/src/main/resources/notify.properties b/litemall-core/src/main/resources/notify.properties deleted file mode 100644 index 9606a29e..00000000 --- a/litemall-core/src/main/resources/notify.properties +++ /dev/null @@ -1,23 +0,0 @@ -# 邮件发送配置 -sprint.mail.enable=false -spring.mail.host=smtp.exmail.qq.com -spring.mail.username=xxxxxx -spring.mail.password=xxxxxx -spring.mail.sendto=example@qq.com - -# 短信发送配置 -spring.sms.enable=false -spring.sms.appid=111111 -spring.sms.appkey=xxxxxx -spring.sms.sign=xxxxxx - -# 短信模板消息配置 -# 请在腾讯短信平台配置通知消息模板,然后这里设置不同短信模板ID -# 请参考LitemallNotifyService.notifySMSTemplate -spring.sms.template.paySucceed=111111 -spring.sms.template.captcha=222222 - -# \u53D1\u9001\u7EBF\u7A0B\u6C60\u914D\u7F6E -spring.notify.corePoolSize=5 -spring.notify.maxPoolSize=100 -spring.notify.queueCapacity=50 \ No newline at end of file