-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/1.1.x'
- Loading branch information
Showing
10 changed files
with
439 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package fishmaple.DAO; | ||
|
||
import fishmaple.DTO.Anonymous; | ||
import fishmaple.DTO.BlogTopic; | ||
import org.apache.ibatis.annotations.Param; | ||
import org.apache.ibatis.annotations.Select; | ||
import org.apache.ibatis.annotations.Update; | ||
|
||
import java.util.List; | ||
|
||
|
||
public interface BlogTopicMapper { | ||
public List<BlogTopic> getTopicsByUserId(@Param("userId")String userId); | ||
public List<BlogTopic> getAllTopics(); | ||
public String getTopicName(@Param("id")Integer topicId); | ||
public List<BlogTopic> getTopicsByUserIdAndTopicId(@Param("userId")String userId,@Param("topicId")Integer topicId); | ||
public Integer addTopic(BlogTopic blogTopic); | ||
public Integer verifyTopic(BlogTopic blogTopic); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package fishmaple.DTO; | ||
|
||
public class BlogTopic { | ||
Integer id; | ||
String topic; | ||
String userId; | ||
Integer fTopicId; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getTopic() { | ||
return topic; | ||
} | ||
|
||
public void setTopic(String topic) { | ||
this.topic = topic; | ||
} | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(String userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public Integer getfTopicId() { | ||
return fTopicId; | ||
} | ||
|
||
public void setfTopicId(Integer fTopicId) { | ||
this.fTopicId = fTopicId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package fishmaple.api; | ||
|
||
import fishmaple.Objects.FileObject; | ||
import fishmaple.utils.SendEmail; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.security.GeneralSecurityException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
public class TalkTo { | ||
|
||
@PostMapping("sendTalk") | ||
public String sendTalk(@RequestBody Map<String,String> map) throws GeneralSecurityException { | ||
if(map.get("content").equals("")||map.get("email").equals("")||map.get("name").equals("")){ | ||
return "请完善必填项"; | ||
} | ||
String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; | ||
Pattern regex = Pattern.compile(check); | ||
Matcher matcher = regex.matcher(map.get("email")); | ||
boolean isMatched = matcher.matches(); | ||
if(!isMatched){ | ||
return "邮箱地址格式错误"; | ||
} else{ | ||
try { | ||
SendEmail.send("新留言(#^.^#)-鱼鱼的博客", "收到新留言<br>" + map.get("content") + "<br>" + | ||
map.get("email") + "<br>" + map.get("name") + "<br>" + map.get("website") + "<br>", | ||
"[email protected]", SendEmail.REDIRECT); | ||
|
||
String content = "你好 ,我已经收到你在我网站的留言噜,我会及时处理并给予反馈,敬请关注邮件。<br> 感谢您对本博客的关注<br> 祝:生活愉快<br><br>" + | ||
" <a href=\"https://www.fishmaple.cn\"><img src=\"https://www.fishmaple.cn/pics/logo_m_m.png\" class=\"logo middle_pic\"> <img src=\"https://www.fishmaple.cn/pics/logo-fish-small.png\" class=\"logo middle_fish\"></a>"+ | ||
" <br><br><br><span style='float:right'>from </strong>鱼鱼的博客</strong></span>" + | ||
" <br><br><span style='float:right;color:darkgrey'>Copyright © fishmaple. </span>"; | ||
|
||
SendEmail.send("留言已揽收(#^.^#)-鱼鱼的博客", content, map.get("email"), SendEmail.REDIRECT); | ||
}catch(Exception e){ | ||
e.printStackTrace(); | ||
}finally{ | ||
return "博主已经收到留言 请等待反馈"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package fishmaple.utils; | ||
import com.sun.mail.util.MailSSLSocketFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.mail.*; | ||
import javax.mail.internet.*; | ||
import java.security.GeneralSecurityException; | ||
import java.util.Properties; | ||
|
||
public class SendEmail { | ||
static String HOST = "smtp.qq.com"; // smtp服务器 | ||
static String FROM = "[email protected]"; // 发件人地址 | ||
public static String REDIRECT = "[email protected]"; // 发件人地址 | ||
static String USER = "鱼鱼"; // 用户名 | ||
static String PWD = "-"; // 授权码 | ||
static Logger log = LoggerFactory.getLogger(SendEmail.class); | ||
|
||
|
||
public static void send(String subject,String context,String tos,String ccs) { | ||
Properties props = new Properties(); | ||
|
||
try { | ||
|
||
MailSSLSocketFactory sf = new MailSSLSocketFactory(); | ||
sf.setTrustAllHosts(true); | ||
props.put("mail.smtp.ssl.socketFactory",sf);//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
}catch(Exception e){ | ||
|
||
// props.put("mail.smtp.ssl.socketFactory.class", "javax.net.ssl.SSLSocketFactory");//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
|
||
} props.put("mail.smtp.ssl.enable", "true");//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
// props.put("mail.smtp.socketFactory.port", "456");//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
props.put("mail.smtp.host", HOST);//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
props.put("mail.smtp.port", "465");//设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器) | ||
props.put("mail.smtp.auth", "true"); //需要经过授权,也就是有户名和密码的校验,这样才能通过验证(一定要有这一条) | ||
Session session = Session.getDefaultInstance(props);//用props对象构建一个session | ||
session.setDebug(true); | ||
try { | ||
Transport transport = session.getTransport("smtp");//发送邮件 | ||
transport.connect(HOST,FROM, PWD);//连接服务器的邮箱 | ||
MimeMessage message = new MimeMessage(session);//用session为参数定义消息对象 | ||
message.setFrom(new InternetAddress(FROM));// 加载发件人地址 | ||
String TOS[]=tos.split(","); | ||
InternetAddress[] sendTo = new InternetAddress[TOS.length]; // 加载收件人地址 | ||
for (int i = 0; i < TOS.length; i++) { | ||
sendTo[i] = new InternetAddress(TOS[i]); | ||
} | ||
String CCS[]=ccs.split(","); | ||
InternetAddress[] cc = new InternetAddress[CCS.length]; // 加载收件人地址 | ||
InternetAddress[] sendCC = new InternetAddress[CCS.length]; // 加载收件人地址 | ||
for (int i = 0; i < CCS.length; i++) { | ||
sendCC[i] = new InternetAddress(CCS[i]); | ||
} | ||
message.addRecipients(Message.RecipientType.TO,sendTo); | ||
message.addRecipients(MimeMessage.RecipientType.CC, sendCC);//抄送 | ||
message.setSubject(MimeUtility.encodeText(subject,"utf-8","B"));//加载标题 | ||
Multipart multipart = new MimeMultipart();//向multipart对象中添加邮件的各个部分内容,包括文本内容和附件 | ||
BodyPart contentPart = new MimeBodyPart();//设置邮件的文本内容 | ||
contentPart.setContent(context, "text/html;charset=utf-8"); | ||
//contentPart.setText(context); | ||
multipart.addBodyPart(contentPart); | ||
message.setContent(multipart);//将multipart对象放到message中 | ||
message.saveChanges(); //保存邮件 | ||
|
||
|
||
transport.sendMessage(message, message.getAllRecipients());//把邮件发送出去 | ||
transport.close();//关闭连接 | ||
//// | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
System.out.println(e.toString()); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
<a target="_blank"v-bind:href="link.url" class="linkcard-describe">{{link.describe}}</a> | ||
</el-card> | ||
<div style="margin-top:20px"> | ||
<p style="color:grey">交换友链请发送邮件到[email protected],友链页UI设计中,目前只接受技术领域相关的网站,望见谅</p> | ||
<p style="color:grey">交换友链请发送邮件到[email protected]或点击页面下方的"与我互动",友链页UI设计中,目前只接受技术领域相关的网站,望见谅</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
Oops, something went wrong.