diff --git a/README.md b/README.md index 5b26310..55ac2cb 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ git clone git@github.com:wayn111/waynboot-mall.git # 2. 导入项目依赖 将 waynboot-mall 目录用 idea 打开,导入 maven 依赖 -# 3. 安装 Mysql8.0+、Redis3.0+、RabbitMQ3.0+(含延迟消息插件)、ElasticSearch7.0+(含分词、拼英插件)到本地 +# 3. 安装 Jdk17、Mysql8.0+、Redis3.0+、RabbitMQ3.0+(含延迟消息插件)、ElasticSearch7.0+(含分词、拼英插件)到本地 # 4. 导入 sql 文件 在项目根目录下,找到 `wayn_shop_*.sql` 文件,新建 mysql 数据库 wayn_shop,导入其中 @@ -150,42 +150,15 @@ h5商城api: 所以如有咨询大量问题,请先付出金钱成本😜。 -# 演示截图 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
商城首页更多商品
商城搜索金刚位跳转
商品详情商品分类
商品sku选择购物车查看
确认下单选择支付方式
下单成功订单列表
商品评论我的页面
登录注册
+# 演示gif + +## 前台演示 + +![mall.gif](images%2Fmall.gif) + +## 后台演示 + +![admin.gif](images%2Fadmin.gif) # 文件目录 diff --git a/db-init/wayn_shop_20230719.sql b/db-init/wayn_shop_20230719.sql index f1eea80..cdbd91b 100644 --- a/db-init/wayn_shop_20230719.sql +++ b/db-init/wayn_shop_20230719.sql @@ -3577,16 +3577,17 @@ INSERT INTO `sys_user_role` VALUES (110, 3346); -- ---------------------------- DROP TABLE IF EXISTS `tool_email_config`; CREATE TABLE `tool_email_config` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', - `from_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '收件人', - `host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮件服务器SMTP地址', - `pass` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '密码', - `port` int DEFAULT NULL COMMENT '端口', - `ssl_port` int DEFAULT NULL COMMENT 'ssl端口', - `user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '发件者用户名', - `del_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除 0存在 1删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='邮箱配置'; + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', + `from_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '收件人', + `host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '邮件服务器SMTP地址', + `pass` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '密码', + `port` int NULL DEFAULT NULL COMMENT '端口', + `ssl_port` int NULL DEFAULT NULL COMMENT 'ssl端口', + `user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '发件者用户名', + `ssl_enable` tinyint(1) NOT NULL COMMENT '是否启用 ssl port 0不启用 1启用', + `del_flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除 0存在 1删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '邮箱配置' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tool_email_config diff --git a/images/admin.gif b/images/admin.gif new file mode 100644 index 0000000..ac64c51 Binary files /dev/null and b/images/admin.gif differ diff --git a/images/mall.gif b/images/mall.gif new file mode 100644 index 0000000..36e7ca7 Binary files /dev/null and b/images/mall.gif differ diff --git a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/message/EmailController.java b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/message/EmailController.java index 0705a03..efcc89b 100644 --- a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/message/EmailController.java +++ b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/message/EmailController.java @@ -40,7 +40,7 @@ public class EmailController { sendMailVO.setSubject(subject); sendMailVO.setContent(content); sendMailVO.setTos(Collections.singletonList(tos)); - MailUtil.sendMail(emailConfig, sendMailVO, false, true); + MailUtil.sendMail(emailConfig, sendMailVO, false); return R.success(); } } diff --git a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/tool/EmailConfigController.java b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/tool/EmailConfigController.java index 3e5be0a..f06afc2 100644 --- a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/tool/EmailConfigController.java +++ b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/tool/EmailConfigController.java @@ -46,7 +46,7 @@ public class EmailConfigController { if (!mailConfigService.checkMailConfig(emailConfig)) { return R.error(ReturnCodeEnum.TOOL_EMAIL_ERROR); } - MailUtil.sendMail(emailConfig, mailVO, false, true); + MailUtil.sendMail(emailConfig, mailVO, false); return R.success(); } } diff --git a/waynboot-common/src/main/java/com/wayn/common/core/domain/tool/EmailConfig.java b/waynboot-common/src/main/java/com/wayn/common/core/domain/tool/EmailConfig.java index f43def4..cc39868 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/domain/tool/EmailConfig.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/domain/tool/EmailConfig.java @@ -44,7 +44,10 @@ public class EmailConfig implements Serializable { * 发件者用户名 */ private String user; - + /** + * 是否启用 ssl port 0不启用 1启用 + */ + private Integer sslEnable; /** * 逻辑删除 0存在1删除 */ diff --git a/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/EmailConfigVO.java b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/EmailConfigVO.java index f14eb46..2d64ed2 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/EmailConfigVO.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/EmailConfigVO.java @@ -1,6 +1,7 @@ package com.wayn.common.core.domain.vo; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import java.io.Serial; @@ -26,9 +27,10 @@ public class EmailConfigVO implements Serializable { /** * 邮件服务器SMTP端口 */ - @NotBlank(message = "邮件服务器SMTP端口不能为空") + @NotNull(message = "邮件服务器SMTP端口不能为空") private Integer port; + @NotNull(message = "邮件服务器SMTP SSL端口不能为空") private Integer sslPort; @NotBlank(message = "邮箱密钥不能为空") @@ -49,4 +51,9 @@ public class EmailConfigVO implements Serializable { * 逻辑删除 0存在1删除 */ private Integer delFlag; + + /** + * 是否启用 ssl port 0不启用 1启用 + */ + private Integer sslEnable; } diff --git a/waynboot-common/src/main/java/com/wayn/common/util/mail/MailUtil.java b/waynboot-common/src/main/java/com/wayn/common/util/mail/MailUtil.java index 58c3669..ebfdbab 100644 --- a/waynboot-common/src/main/java/com/wayn/common/util/mail/MailUtil.java +++ b/waynboot-common/src/main/java/com/wayn/common/util/mail/MailUtil.java @@ -15,6 +15,7 @@ import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.List; +import java.util.Objects; import java.util.Properties; /** @@ -23,7 +24,7 @@ import java.util.Properties; @Slf4j public class MailUtil { - public static void sendMail(EmailConfig emailConfig, SendMailVO mailVO, boolean isHtml, boolean ssl) { + public static void sendMail(EmailConfig emailConfig, SendMailVO mailVO, boolean isHtml) { if (emailConfig == null) { log.warn("emailConfig is null"); return; @@ -42,7 +43,7 @@ public class MailUtil { Properties properties = System.getProperties(); properties.setProperty("mail.smtp.port", String.valueOf(emailConfig.getPort())); // SSL加密 - if (ssl) { + if (Objects.equals(emailConfig.getSslEnable(), 1)) { MailSSLSocketFactory sf = new MailSSLSocketFactory(); sf.setTrustAllHosts(true); properties.put("mail.smtp.ssl.enable", "true"); diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java index cd84ca2..95f76cb 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/LoginController.java @@ -176,7 +176,7 @@ public class LoginController { sendMailVO.setSubject("mall商城注册通知"); sendMailVO.setContent("邮箱验证码:" + verCode); sendMailVO.setTos(Collections.singletonList(registryObj.getEmail())); - MailUtil.sendMail(emailConfig, sendMailVO, false, true); + MailUtil.sendMail(emailConfig, sendMailVO, false); }); return R.success().add("emailKey", key); } diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/UserController.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/UserController.java index 395ee56..1719b7c 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/UserController.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/UserController.java @@ -109,7 +109,7 @@ public class UserController { sendMailVO.setSubject("mall商城重置密码通知"); sendMailVO.setContent("邮箱验证码:" + verCode); sendMailVO.setTos(Collections.singletonList(registryObj.getEmail())); - MailUtil.sendMail(emailConfig, sendMailVO, false, true); + MailUtil.sendMail(emailConfig, sendMailVO, false); return R.success().add("key", key); } diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/callback/EmailController.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/callback/EmailController.java index 78cf681..fcf7741 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/callback/EmailController.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/callback/EmailController.java @@ -36,7 +36,7 @@ public class EmailController { sendMailVO.setSubject(subject); sendMailVO.setContent(content); sendMailVO.setTos(List.of(tos)); - MailUtil.sendMail(emailConfig, sendMailVO, false, true); + MailUtil.sendMail(emailConfig, sendMailVO, false); return R.success(); } }