1、增加访问数量

2、主页的样式修改
3、头像自定义实现
4、注册修改为自动跳转到登录页面,登录失败友好提示,不进行跳转页面处理
5、博客增加私密的功能
This commit is contained in:
limqhz
2022-05-15 18:40:41 +08:00
parent 12ff775d36
commit e51efb81f4
64 changed files with 358 additions and 317 deletions

View File

@@ -13,3 +13,10 @@ docker load --input monitor.tar
-- 运行docekr镜像
docker run -p 8088:8088 -d monitor/centos:latest
docker run -it monitor/centos:latest /bin/bash
docker inspect & docker info
-- nginx地址
/usr/local/share/other

View File

@@ -120,6 +120,11 @@
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>java-emoji-converter</artifactId>
<version>0.1.1</version>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>

2
run.sh
View File

@@ -1 +1 @@
java -jar /home/monitor-3.1.5.jar > nohup.log
java -jar /home/monitor-3.1.5.jar --spring.profiles.active=dev

View File

@@ -17,20 +17,22 @@ public interface QuinnConstant {
/**
* 登录超时时间
*/
int SESSION_TIME_OUT = 30 * 60;
int SESSION_TIME_OUT = 90 * 60;
String SOURCE_KEY = "SOURCE_KEY_";
String SESSION_VIEW_KEY = "NO-ADD";
/**
* SESSION_ID
*/
String SESSION_ID = "SESSION_ID_";
String APPEND_PASSWORD = "wangna&limengqi";
String APPEND_PASSWORD = "#append_about";
String NEW_SOURCE_PASSWORD = "limengqi&wangna";
String NEW_SOURCE_PASSWORD = "#upload_source";
String EDIT_SOURCE_FIRST = "lw@";
String EDIT_SOURCE_LAST = "#";
String EDIT_SOURCE_FIRST = "#edit@";
String EDIT_SOURCE_LAST = "@";
String DEFAULT_ATTR_BASE64 = "/images/avatar/quinn.png";
String DEFAULT_ATTR_BASE64 = "/images/avatar/a1.png";
String DEFAULT_ATTR = "/images/avatar/a#.png";
}

View File

@@ -0,0 +1,9 @@
package com.quinn.common;
public class QuinnException extends RuntimeException{
public QuinnException(String message) {
super(message);
}
}

View File

@@ -8,18 +8,8 @@ import org.springframework.security.config.annotation.method.configuration.Enabl
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.AuthenticationEntryPointFailureHandler;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@@ -37,10 +27,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// .permitAll(); //无条件允许访问
// 访问权限
http.authorizeRequests()
.antMatchers("/","/index").permitAll()
.antMatchers("/register","/login","/toLogin").permitAll()
.antMatchers("/","/index","/favicon.ico").permitAll()
.antMatchers("/register","/login","/toLogin","/checkLogin").permitAll()
.antMatchers("/source","/source/view/*").permitAll()
.antMatchers("/blog","/blog/read/*").permitAll()
.antMatchers("/search/**").permitAll()
.antMatchers("//about").permitAll()
.antMatchers("/hotspot").permitAll()
.antMatchers("/blog/**").authenticated()
.antMatchers("/source/**").authenticated()
@@ -54,7 +46,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.passwordParameter("password")
.loginPage("/toLogin")
.loginProcessingUrl("/login") // 登陆表单提交请求
.failureForwardUrl("/loginError")
.defaultSuccessUrl("/index"); // 设置默认登录成功后跳转的页面
// 注销配置
@@ -63,8 +54,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
http.csrf().disable();//关闭csrf功能:跨站请求伪造,默认只能通过post方式提交logout请求
http.logout().logoutSuccessUrl("/");
// 记住我配置
http.rememberMe().rememberMeParameter("remember");
// 记住我配置 默认为remember-me
// http.rememberMe().rememberMeParameter("remember");
}
// 用户授权验证

View File

@@ -36,7 +36,7 @@ public class Swagger2Config {
.title("Quinn-Api")
.description("Quinn-Api")
.version("1.0")
.contact(new Contact("Quinn", "http://quinn.com", "24736743@qq.com"))
.contact(new Contact("Quinn", "https://www.qnforever.top", "540344226@qq.com"))
.build();
}

View File

@@ -41,7 +41,7 @@ public class AboutController extends BaseModelController {
return "page/about";
}
@PostMapping("/about")
@PostMapping("/about/append")
@PreAuthorize("hasAuthority('ADMIN')")
public String saveSay(About about){
about.setId(QuinnUtils.getUuid());

View File

@@ -6,6 +6,7 @@ import com.quinn.common.Category;
import com.quinn.pojo.*;
import com.quinn.service.*;
import com.quinn.utils.ContentUtil;
import com.quinn.utils.CovertEmojStr;
import com.quinn.utils.QuinnUtils;
import com.quinn.vo.*;
import org.slf4j.Logger;
@@ -43,10 +44,10 @@ public class BlogController extends BaseModelController{
// 列表展示
@GetMapping("/blog")
public String blogList(Model model){
public String blogList(HttpServletRequest request,Model model){
String loginUserId = getLoginUserId(request);
MyPageParam myPageParam = new MyPageParam(1, 10);
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(loginUserId,myPageParam);
// 结果
model.addAttribute("blogList",blogList);
model.addAttribute("pageParam",myPageParam);
@@ -62,13 +63,14 @@ public class BlogController extends BaseModelController{
}
@PostMapping("/blog")
public String blogListPage(NavReq navReq, Model model){
public String blogListPage(HttpServletRequest request,NavReq navReq, Model model){
String loginUserId = getLoginUserId(request);
// 用户的论坛列表
if (navReq.getPageNum() < 1){
navReq.setPageNum(1);
}
MyPageParam myPageParam = new MyPageParam(navReq.getPageNum(),navReq.getLimit());
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(loginUserId,myPageParam);
// 结果
model.addAttribute("blogList",blogList);
model.addAttribute("pageParam",myPageParam);
@@ -98,10 +100,10 @@ public class BlogController extends BaseModelController{
blog.setBid(QuinnUtils.getUuid());
blog.setTitle(questionWriteForm.getTitle());
blog.setContent(questionWriteForm.getContent());
blog.setContent(CovertEmojStr.coverStr(questionWriteForm.getContent()));
String s = ContentUtil.toTextContentFromWangEdit(questionWriteForm.getContentJson());
blog.setContentJson(s);
blog.setContentJson(CovertEmojStr.coverStr(s));
blog.setSort(0);
blog.setViews(0);
@@ -166,11 +168,10 @@ public class BlogController extends BaseModelController{
@PostMapping("/blog/editor")
public String editor(Blog blog){
Blog queryBlog = blogService.getOne(new QueryWrapper<Blog>().eq("bid", blog.getBid()));
queryBlog.setTitle(blog.getTitle());
queryBlog.setCategoryId(blog.getCategoryId());
queryBlog.setContent(blog.getContent());
String s = ContentUtil.toTextContentFromWangEdit(blog.getContentJson());
queryBlog.setContent(CovertEmojStr.coverStr(blog.getContent()));
String s = ContentUtil.toTextContentFromWangEdit(CovertEmojStr.coverStr(blog.getContentJson()));
queryBlog.setContentJson(s);
queryBlog.setGmtUpdate(QuinnUtils.getTime());

View File

@@ -1,16 +1,19 @@
package com.quinn.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.quinn.common.QuinnException;
import com.quinn.common.RoleType;
import com.quinn.intergration.AttrIcon;
import com.quinn.intergration.SendBMail;
import com.quinn.pojo.Invite;
import com.quinn.pojo.User;
import com.quinn.pojo.UserInfo;
import com.quinn.service.InviteService;
import com.quinn.service.UserInfoService;
import com.quinn.service.UserService;
import com.quinn.task.SendAsyncEmail;
import com.quinn.utils.AsyncTaskUtil;
import com.quinn.utils.QuinnUtils;
import com.quinn.vo.CheckLoginForm;
import com.quinn.vo.RegisterForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -40,10 +43,22 @@ public class LoginController {
return "index";
}
@PostMapping("/loginError")
public String error(Model model){
model.addAttribute("loginMsg","错误的用户名或者密码!");
return "forget";
@PostMapping("/checkLogin")
public void checkLogin(HttpServletResponse response,CheckLoginForm loginForm) throws IOException {
PrintWriter writer = response.getWriter();
User user = userService.getOne(new QueryWrapper<User>().eq("username", loginForm.getUsername()));
String isOk = "no";
if (user != null){
// checkPassword
String password = user.getPassword();
boolean check = new BCryptPasswordEncoder().matches(loginForm.getPassword(),password);
if (check){
isOk = "ok";
}
}
writer.write(isOk);
writer.flush();
writer.close();
}
@GetMapping("/toLogin")
@@ -57,27 +72,49 @@ public class LoginController {
}
// 注册业务
@PostMapping("/register")
public String register(HttpServletResponse response,RegisterForm registerForm, Model model) throws IOException {
@PostMapping("/checkRegister")
public void checkRegister(HttpServletResponse response,RegisterForm registerForm) throws IOException {
response.setCharacterEncoding("UTF-8");
PrintWriter writer = response.getWriter();
// 表单密码重复判断
if (!registerForm.getPassword().equals(registerForm.getRepassword())){
return toResult(writer,"两次输入密码不一致!");
toResult(writer,"两次输入密码不一致!");
}
// 用户名已存在
User hasUser = userService.getOne(new QueryWrapper<User>().eq("username", registerForm.getUsername()));
if (hasUser!=null){
return toResult(writer,"用户名太热门了,请更换用户名");
toResult(writer,"用户名太热门了,请更换用户名");
}
// 验证邀请码
Invite invite = inviteService.getOne(new QueryWrapper<Invite>().eq("code", registerForm.getCode()));
if (invite==null){
toResult(writer,"注册码不存在!");
}
if (!invite.getApplyEmail().equals(registerForm.getEmail())){
toResult(writer,"请使用申请注册码邮箱注册用户!");
}
}
// 注册业务
@PostMapping("/register")
public String register(RegisterForm registerForm, Model model) throws IOException {
// 表单密码重复判断
if (!registerForm.getPassword().equals(registerForm.getRepassword())){
throw new QuinnException("防爬虫,两次输入密码不一致!");
}
// 用户名已存在
User hasUser = userService.getOne(new QueryWrapper<User>().eq("username", registerForm.getUsername()));
if (hasUser!=null){
throw new QuinnException("防爬虫,用户名太热门了,请更换用户名");
}
// 验证邀请码
Invite invite = inviteService.getOne(new QueryWrapper<Invite>().eq("code", registerForm.getCode()));
if (invite==null){
return toResult(writer,"注册码不存在!");
throw new QuinnException("防爬虫,注册码不存在!");
}
if (invite.getApplyEmail().equals(registerForm.getEmail())){
return toResult(writer,"请使用申请注册码邮箱注册用户!");
if (!invite.getApplyEmail().equals(registerForm.getEmail())){
throw new QuinnException("防爬虫,请使用申请注册码邮箱注册用户!");
}
// 构建用户对象
User user = new User();
@@ -99,16 +136,15 @@ public class LoginController {
inviteService.updateById(invite);
userInfoService.save(new UserInfo().setUid(user.getUid()).setEmail(registerForm.getEmail()));
// 发送注册成功通知邮件
SendBMail.INSTANCE.sendWelcome(registerForm.getUsername(),registerForm.getEmail());
AsyncTaskUtil.INSTANCE.submit(new SendAsyncEmail(registerForm.getUsername(),registerForm.getEmail()));
// 注册成功,重定向到登录页面
return "redirect:/toLogin";
}
private String toResult(PrintWriter writer, String msg) {
private void toResult(PrintWriter writer, String msg) {
writer.write(msg);
writer.flush();
writer.close();
return "register";
}
}

View File

@@ -55,7 +55,7 @@ public class SearchController extends BaseModelController{
}
String loginUserId = getLoginUserId(request);
User uid = userService.getOne(new QueryWrapper<User>().eq("uid", loginUserId));
if (RoleType.ADMIN.getName().equals(uid.getRole())){
if (uid != null && RoleType.ADMIN.getName().equals(uid.getRole())){
String result = doAdmin(findWhat, model);
if (!QuinnConstant.GUN.equals(result)){
return result;

View File

@@ -138,16 +138,17 @@ public class SourceController extends BaseModelController {
* @throws IOException
*/
@PostMapping("/source/download/{sid}")
public void download(HttpServletResponse response, @PathVariable("sid") String sid) throws IOException {
public void download(HttpServletRequest request,HttpServletResponse response, @PathVariable("sid") String sid) throws IOException {
String sessionId = getSessionId(request);
Source source = sourceService.getOne(new QueryWrapper<Source>().eq("sid", sid));
if (source!=null){
if (SourceType.OSS.name().equals(source.getSourceType())){
//通知浏览器以附件形式下载
response.setHeader("Content-Disposition",
"attachment;filename=" + source.getEnName() + QuinnConstant.LINK_SUFFIX + source.getFileType());
this.sourceService.downloadSource(response,source);
sourceService.downloadSource(response,source,sessionId);
}else {
this.sourceService.downloadForBaidu(response,source);
sourceService.downloadForBaidu(response,source,sessionId);
}
}
}

View File

@@ -13,12 +13,22 @@ public enum AttrIcon {
INSTANCE;
/**
* 用户名
* 用户名 使用第三方生成工具
* @param name
*/
public String generateThirdUrl(String name) {
String attrUrl = "https://api.multiavatar.com/";
return attrUrl + name + ".png";
}
/**
* 用户名 为提高效率,使用本地生成工具算法
* @param name
*/
public String generateImgUrl(String name) {
String attrUrl = "https://api.multiavatar.com/";
return attrUrl + name + ".png";
int num = name.hashCode();
int index = num % 15;
return QuinnConstant.DEFAULT_ATTR.replace("#",index + "");
}
/**
@@ -39,9 +49,4 @@ public enum AttrIcon {
return QuinnConstant.DEFAULT_ATTR_BASE64;
}
public static void main(String[] args) {
String limengqi = AttrIcon.INSTANCE.generateImg("limengqi");
System.out.println(limengqi);
}
}

View File

@@ -19,9 +19,9 @@ public interface BlogMapper extends BaseMapper<Blog> {
List<Blog> getTopBlog();
List<BlogWithUser> getBlogWithUserOrderBySort(MyPageParam myPageParam);
int getBlogWithUserOrderBySortCount(String userId);
List<BlogWithUser> getBlogWithUser(MyPageParam myPageParam);
List<BlogWithUser> getBlogWithUserOrderBySort(String userId,MyPageParam myPageParam);
List<BlogWithUser> getMyBlogs(String userId,MyPageParam myPageParam);
}

View File

@@ -9,22 +9,21 @@
order by (views + star) desc limit 7
</select>
<select id="getBlogWithUserOrderBySort" parameterType="com.quinn.vo.MyPageParam" resultType="com.quinn.pojo.BlogWithUser">
select a.id,a.bid,a.title,a.sort,a.views,a.author_id,a.category_id,a.category_name,a.gmt_create,a.gmt_update
,b.username,b.avatar,
(select count(1) from qn_star c where c.topic_id = a.bid and c.topic_category = 'BLOG') as star
from qn_blog a,qn_user b
where a.author_id = b.uid order by a.sort desc,a.gmt_create desc
limit #{pageNum},#{size}
<select id="getBlogWithUserOrderBySortCount" resultType="int">
select count(1)
from qn_blog a
where (case when a.category_id = '1' then a.author_id = #{userId} else 1 end)
</select>
<select id="getBlogWithUser" parameterType="com.quinn.vo.MyPageParam" resultType="com.quinn.pojo.BlogWithUser">
<select id="getBlogWithUserOrderBySort" resultType="com.quinn.pojo.BlogWithUser">
select a.id,a.bid,a.title,a.sort,a.views,a.author_id,a.category_id,a.category_name,a.gmt_create,a.gmt_update
,b.username,b.avatar,
(select count(1) from qn_star c where c.topic_id = a.bid and c.topic_category = 'BLOG') as star
from qn_blog a,qn_user b
where a.author_id = b.uid order by a.gmt_create desc
limit #{pageNum},#{size}
where a.author_id = b.uid
and (case when a.category_id = '1' then a.author_id = #{userId} else 1 end)
order by a.sort desc,a.gmt_create desc
limit #{myPageParam.pageNum},#{myPageParam.size}
</select>
<select id="getMyBlogs" resultType="com.quinn.pojo.BlogWithUser">

View File

@@ -20,9 +20,7 @@ public interface BlogService extends IService<Blog> {
List<Blog> getTopBlog();
List<BlogWithUser> getBlogWithUserOrderBySort(MyPageParam myPageParam);
List<BlogWithUser> getBlogWithUser(MyPageParam myPageParam);
List<BlogWithUser> getBlogWithUserOrderBySort(String userId,MyPageParam myPageParam);
List<BlogWithUser> getMyBlogs(String userId,MyPageParam myPageParam);

View File

@@ -31,9 +31,9 @@ public interface SourceService extends IService<Source> {
* @param source
* @throws IOException
*/
void downloadSource(HttpServletResponse response, Source source) throws IOException;
void downloadSource(HttpServletResponse response, Source source,String sessionId) throws IOException;
void downloadForBaidu(HttpServletResponse response, Source source) throws IOException;
void downloadForBaidu(HttpServletResponse response, Source source,String sessionId) throws IOException;
/**
* 点击对应的资源

View File

@@ -28,6 +28,8 @@ import java.util.List;
public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements BlogService {
@Resource
BlogMapper blogMapper;
@Resource
RedisUtils redisUtils;
@Override
public List<Blog> getTopBlog(){
@@ -41,17 +43,10 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements Bl
}
@Override
public List<BlogWithUser> getBlogWithUserOrderBySort(MyPageParam myPageParam) {
int count = count(null);
public List<BlogWithUser> getBlogWithUserOrderBySort(String userId,MyPageParam myPageParam) {
int count = blogMapper.getBlogWithUserOrderBySortCount(userId);
myPageParam.setTotal(count);
return blogMapper.getBlogWithUserOrderBySort(myPageParam);
}
@Override
public List<BlogWithUser> getBlogWithUser(MyPageParam myPageParam) {
int count = count(null);
myPageParam.setTotal(count);
return blogMapper.getBlogWithUser(myPageParam);
return blogMapper.getBlogWithUserOrderBySort(userId,myPageParam);
}
@Override
@@ -63,8 +58,12 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements Bl
@Override
public void addRecord(Blog blog, String sessionId) {
String value = redisUtils.get(sessionId + blog.getBid());
if (!QuinnConstant.SESSION_VIEW_KEY.equals(value)){
blog.setViews(blog.getViews()+1);
redisUtils.set(sessionId + blog.getBid(),QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT);
updateById(blog);
}
}
}

View File

@@ -10,10 +10,7 @@ import com.quinn.pojo.SourceCategory;
import com.quinn.pojo.SourceWithStar;
import com.quinn.service.SourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.quinn.utils.ContentUtil;
import com.quinn.utils.OSSClientUtil;
import com.quinn.utils.QuinnUtils;
import com.quinn.utils.RedisUtils;
import com.quinn.utils.*;
import com.quinn.vo.MyPageParam;
import com.quinn.vo.QuerySource;
import com.quinn.vo.SourceUpdateForm;
@@ -52,9 +49,9 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
SourceMapper sourceMapper;
@Override
public void downloadSource(HttpServletResponse response, Source source) throws IOException {
public void downloadSource(HttpServletResponse response, Source source,String sessionId) throws IOException {
String sourceLink = source.getSourceLink();
addDownLoadRecord(source);
addDownLoadRecord(source,sessionId);
// 读取文件内容。
BufferedInputStream in = new BufferedInputStream(ossClientUtil.downloadFile(sourceLink));
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
@@ -73,8 +70,8 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
}
@Override
public void downloadForBaidu(HttpServletResponse response, Source source) throws IOException {
addDownLoadRecord(source);
public void downloadForBaidu(HttpServletResponse response, Source source,String sessionId) throws IOException {
addDownLoadRecord(source,sessionId);
PrintWriter writer = response.getWriter();
writer.write(source.getSourceLink());
writer.flush();
@@ -84,7 +81,7 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
@Override
public Source view(String sid,String sessionId) {
Source source = getOne(new QueryWrapper<Source>().eq("sid", sid));
addDownLoadRecord(source);
addDownLoadRecord(source,sessionId);
return source;
}
@@ -105,9 +102,9 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
source.setEnName(sourceWriteForm.getEnName());
source.setFileType(fileType);
source.setSourceName(sourceWriteForm.getTitle());
source.setDetail(sourceWriteForm.getSubContent());
source.setDetail(CovertEmojStr.coverStr(sourceWriteForm.getSubContent()));
source.setSourceContent(sourceWriteForm.getContent());
String s = ContentUtil.toTextContentFromWangEdit(sourceWriteForm.getContentJson());
String s = ContentUtil.toTextContentFromWangEdit(CovertEmojStr.coverStr(sourceWriteForm.getContentJson()));
sourceWriteForm.setContentJson(s);
source.setSourceType(sourceWriteForm.getSourceType());
source.setSourceLink(fileLink);
@@ -143,8 +140,8 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
before.setFileType(fileType);
before.setSourceName(sourceUpdateForm.getSourceName());
before.setDetail(sourceUpdateForm.getDetail());
before.setSourceContent(sourceUpdateForm.getSourceContent());
String s = ContentUtil.toTextContentFromWangEdit(sourceUpdateForm.getContentJson());
before.setSourceContent(CovertEmojStr.coverStr(sourceUpdateForm.getSourceContent()));
String s = ContentUtil.toTextContentFromWangEdit(CovertEmojStr.coverStr(sourceUpdateForm.getContentJson()));
before.setContentJson(s);
before.setSourceType(sourceUpdateForm.getSourceType());
before.setSourceLink(fileLink);
@@ -189,23 +186,20 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
}
/**
* 更新页码
* 更新热度
* @param source
*/
private void addDownLoadRecord(Source source) {
private void addDownLoadRecord(Source source,String sessionId) {
/** 使用redis记录访问量可以降低数据库压力,但是时效性就会降低,
* 需要不断跑批处理,用户量小或者单实例不推荐这么做
* 我们此处是为了实现session级别不能恶意刷热度
*/
// int downTimes = 0;
// if (StringUtils.isEmpty(downLoadTime)){
// downTimes = source.getDownRecord() + 1;
// }else {
// downTimes = Integer.parseInt(downLoadTime) + 1;
// }
int downTimes = source.getDownRecord() + 1;
redisUtils.set(QuinnConstant.SOURCE_KEY + source.getSid(),downTimes + "");
String value = redisUtils.get(sessionId + source.getSid());
if (!QuinnConstant.SESSION_VIEW_KEY.equals(value)){
source.setDownRecord(source.getDownRecord() + 1);
redisUtils.set(sessionId + source.getSid(),QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT);
updateById(source);
}
}
}

View File

@@ -0,0 +1,22 @@
package com.quinn.task;
import com.quinn.intergration.SendBMail;
import lombok.Data;
@Data
public class SendAsyncEmail implements Runnable{
String username;
String email;
public SendAsyncEmail(String username, String email) {
this.username = username;
this.email = email;
}
@Override
public void run() {
SendBMail.INSTANCE.sendWelcome(username,email);
}
}

View File

@@ -1,52 +1,17 @@
package com.quinn.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.quinn.common.QuinnConstant;
import com.quinn.pojo.Source;
import com.quinn.service.SourceService;
import com.quinn.utils.RedisUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
/**
*
* @author limqsh
*/
@Component
//@Component
public class UpdateViewTask {
@Resource
SourceService sourceService;
@Resource
RedisUtils redisUtils;
/**
* 每小时执行一次
*/
@Scheduled(cron = "0 0 */1 * * ?")
// @Scheduled(cron = "0 0 */1 * * ?")
public void execute(){
List<String> keys = redisUtils.scan(QuinnConstant.SOURCE_KEY);
// List<Source> list = sourceService.list(null);
if (!CollectionUtils.isEmpty(keys)){
keys.forEach(x->{
Source source = sourceService.getById(getIdFromKey(x,QuinnConstant.SOURCE_KEY));
if (source != null && !StringUtils.isEmpty(source.getSourceName())){
source.setDownRecord(Integer.parseInt(redisUtils.get(x)));
sourceService.updateById(source);
redisUtils.del(x);
}
});
}
}
private String getIdFromKey(String key,String keyType){
return key.substring(keyType.length());
}
}

View File

@@ -0,0 +1,16 @@
package com.quinn.utils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public enum AsyncTaskUtil {
INSTANCE;
ExecutorService executorService = Executors.newCachedThreadPool();
public void submit(Runnable runnable){
executorService.submit(runnable);
}
}

View File

@@ -0,0 +1,12 @@
package com.quinn.utils;
import com.github.binarywang.java.emoji.EmojiConverter;
public class CovertEmojStr {
public static String coverStr(String before){
EmojiConverter emojiConverter = EmojiConverter.getInstance();
return emojiConverter.toHtml(before);
}
}

View File

@@ -0,0 +1,19 @@
package com.quinn.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CheckLoginForm {
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "密码")
private String password;
}

View File

@@ -6,7 +6,7 @@ spring.thymeleaf.cache=false
swagger.enable=true
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/quinn?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/quinn?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456

View File

@@ -6,7 +6,7 @@ spring.thymeleaf.cache=true
swagger.enable=false
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/smallapp_point?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smallapp_point?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=hyty1234

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 985 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -21,5 +21,5 @@ function navChange(page){
});
}
function changeImg(){
layer.open({ content: '大佬不意思!这块还在努力建设中...', skin: 'msg', time: 2 });
layer.open({ content: '大佬不意思!这块还在努力建设中...', skin: 'msg', time: 2 });
}

View File

@@ -135,7 +135,7 @@ try {
live2d_settings['waifuToolFont'] = '14px'; // 工具栏字体,例如 '14px', '36px'
live2d_settings['waifuToolLine'] = '20px'; // 工具栏行高,例如 '20px', '36px'
live2d_settings['waifuToolTop'] = '0px' // 工具栏顶部边距,例如 '0px', '-60px'
live2d_settings['waifuMinWidth'] = 'disable'; // 面页小于 指定宽度 隐藏看板娘,例如 'disable'(禁用), '768px'
live2d_settings['waifuMinWidth'] = '768px'; // 面页小于 指定宽度 隐藏看板娘,例如 'disable'(禁用), '768px'
live2d_settings['waifuEdgeSide'] = 'right:88'; // 看板娘贴边方向,例如 'left:0'(靠左 0px), 'right:30'(靠右 30px)
live2d_settings['waifuDraggable'] = 'unlimited'; // 拖拽样式,例如 'disable'(禁用), 'axis-x'(只能水平拖拽), 'unlimited'(自由拖拽)
live2d_settings['waifuDraggableRevert'] = false; // 松开鼠标还原拖拽位置,可选 true(真), false(假)

View File

@@ -26,18 +26,18 @@
<div class="col-md-12 order-md-1">
<h4 class="mb-3">编辑论坛</h4>
<form class="needs-validation" th:action="@{/blog/editor}" method="post">
<form id="editForm" class="needs-validation" th:action="@{/blog/editor}" method="post">
<!-- 隐藏域 -->
<input type="hidden" name="bid" th:value="${blog.getBid()}">
<div class="row">
<div class="col-md-10 mb-3">
<label for="title">论坛标题</label>
<input required th:value="${blog.getTitle()}" name="title" type="text" class="form-control" id="title">
<input required th:value="${blog.getTitle()}" maxlength="30" name="title" type="text" class="form-control" id="title">
</div>
<div class="col-md-2 mb-3">
<label for="categoryId">标签</label>
<label for="categoryId">权限</label>
<select name="categoryId" class="custom-select d-block w-100" id="categoryId" required>
<option th:each="category:${categoryList}"
th:selected="${blog.getCategoryId() == category.getId()}"
@@ -51,14 +51,14 @@
<div id="blog-content">
<div id="editor-toolbar"></div>
<div id="editor-text-area" style="height: 600px;border: 1px solid lightgrey"></div>
<textarea id="content-textarea" name="content" th:text="${blog.getContent()}" style="display: none;"></textarea>
<textarea id="content-textarea" name="content" th:text="${blog.getContent()}" style="display: none;" minlength="30" required></textarea>
<textarea id="contentText-textarea" name="contentJson" style="display: none;"></textarea>
</div>
</div>
</div>
<button class="btn btn-primary btn-lg btn-block" onclick="talkWith()" type="submit">提交修改</button>
<button class="btn btn-primary btn-lg btn-block" onclick="talkWith()" type="button">提交修改</button>
</form>
</div>
</div>
@@ -100,7 +100,7 @@
return;
}
this.disabled = true;
this.submit();
$('#editForm').submit();
}
</script>
</body>

View File

@@ -25,11 +25,14 @@
<div class="col-md-12 blog-main">
<div class="blog-post">
<h2 class="blog-post-title" th:text="${blog.getTitle()}"></h2>
<h2 class="blog-post-title">
[[${blog.getTitle()}]]
<small th:if="@{${session.loginUser} ? ${session.loginUser.getUid()==blog.getAuthorId()} : false}"
style="font-size: 15px;" class="badge badge-pill badge-warning" th:text="${blog.getCategoryName()}">
</small>
</h2>
<p class="blog-post-meta">
<span th:text="${#dates.format(blog.getGmtUpdate(),'yyyy-MM-dd HH:mm:ss')}"></span>
by
<!-- <a href="#" th:text="${blog.getAuthorName()}"></a>-->
<span>
<svg class="bi bi-eye-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>

View File

@@ -27,7 +27,7 @@
<div class="col-md-12 order-md-1">
<h4 class="mb-3">发布文章</h4>
<form class="needs-validation" th:action="@{/blog/write}" method="post">
<form id="editForm" class="needs-validation" th:action="@{/blog/write}" method="post">
<!-- 隐藏域 -->
<input type="hidden" name="authorId" th:value="${session.loginUser.getUid()}">
<input type="hidden" name="authorName" th:value="${session.loginUser.getUsername()}">
@@ -38,7 +38,7 @@
</div>
<div class="col-md-2 mb-3">
<label for="categoryId">文章标签</label>
<label for="categoryId">权限</label>
<select name="categoryId" class="custom-select d-block w-100" id="categoryId" required>
<option th:each="category:${categoryList}"
th:value="${category.getId()}" th:text="${category.getCategory()}">
@@ -58,7 +58,7 @@
</div>
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="talkWith()" >发布文章</button>
<button class="btn btn-primary btn-lg btn-block" type="button" onclick="talkWith()" >发布文章</button>
</form>
</div>
</div>
@@ -93,12 +93,13 @@
layer.open({ content: '请选择博客分类', skin: 'msg', time: 2 });
return;
}
console.log(content.length < 30);
if (content.length < 30){
layer.open({ content: '内容过短!请多表达一点思想吧?', skin: 'msg', time: 2 });
return;
}
this.disabled = true;
this.submit();
$('#editForm').submit();
}
</script>
</body>

View File

@@ -37,15 +37,14 @@
</li>
</ul>
<!--如果未登录-->
<div>
<form th:action="@{/search}" method="get">
<ul class="navbar-nav mr-2">
<ul class="navbar-nav">
<li>
<input class="mr-2" name="findWhat" type="text" placeholder="大佬想找什么呢?"/>
<input class="mr-2 mt-2" name="findWhat" type="text" placeholder="大佬想找什么呢?"/>
</li>
<li>
<button type="submit" class="btn btn-sm btn-primary mr-2">
<button type="submit" class="btn btn-sm btn-primary mr-2 mt-2">
全站搜索
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
@@ -57,8 +56,8 @@
</div>
<!--如果未登录-->
<div sec:authorize="!isAuthenticated()">
<a class="btn btn-sm btn-primary" th:href="@{/toLogin}" role="button">
<div class="mt-2" sec:authorize="!isAuthenticated()">
<a class="btn btn-sm btn-primary mr-auto" th:href="@{/toLogin}" role="button">
<svg class="bi bi-person-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
</svg>

View File

@@ -1,36 +0,0 @@
<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>注册-Quinn</title>
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4" >
</div>
<div class="col-md-4 mt-5" id='login_box'>
<form id="registerForm" class="form-horizontal was-validated" method="post" noValidate>
<div class="justify-content-center">
<h1>联系我们<small style="font-size: small">Quinn</small></h1>
<p th:text="${loginMsg}"></p>
</div>
<p class="mt-1 clearfix">
<a style="color: white" th:href="@{/toLogin}" class="float-right text-decoration-none">我记得密码!去登录</a>
</p>
</form>
</div>
<div class="col-md-4" >
</div>
</div>
</div>
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<!--<script th:src="@{/js/jquery-ui.min.js}"></script>-->
<!--<script th:src="@{/live/js/addlive2d.js}"></script>-->
<script th:src="@{/layer/mobile/layer.js}"></script>
</body>
</html>

View File

@@ -7,98 +7,84 @@
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
</head>
<style>
#register{
background: url(/images/menu/register.png) no-repeat;
background-size: 100% 100%;
height: 400px;
}
.inverted{
background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAHklEQVQImWNkYGBgYGD4//8/A5wF5SBYyAr+//8PAPOCFO0Q2zq7AAAAAElFTkSuQmCC) repeat;text-shadow: 5px -5px black, 4px -4px white;font-weight: bold;-webkit-text-fill-color: transparent;-webkit-background-clip: text
}
.invertedContent p{
background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAHklEQVQImWNkYGBgYGD4//8/A5wF5SBYyAr+//8PAPOCFO0Q2zq7AAAAAElFTkSuQmCC) repeat;text-shadow: 2px -2px black, 1px -1px white;font-weight: bold;-webkit-text-fill-color: transparent;-webkit-background-clip: text
}
#fastLink{
font-size: 20px;
}
</style>
<body>
<div th:replace="~{common/header::header(activeUrl='index.html')}"></div>
<main role="main">
<div class="container ">
<div class="jumbotron jumbotron-fluid mt-5">
<div class="container">
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item mt-5 active">
<img th:src="@{/images/menu/menu1.png}" class="d-block w-100" alt="第一个">
<!-- <div class="carousel-caption d-none d-md-block">-->
<!-- <h5>First slide label</h5>-->
<!-- <p>Some representative placeholder content for the first slide.</p>-->
<!-- </div>-->
</div>
<div class="carousel-item mt-5">
<img th:src="@{/images/menu/menu2.png}" class="d-block w-100" alt="第二个">
</div>
<div class="carousel-item mt-5">
<img th:src="@{/images/menu/menu3.png}" class="d-block w-100" alt="第三个">
</div>
</div>
<!-- <button class="carousel-control-prev" type="button" data-target="#carouselExampleCaptions" data-slide="prev">-->
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span>-->
<!-- <span class="sr-only">Previous</span>-->
<!-- </button>-->
<!-- <button class="carousel-control-next" type="button" data-target="#carouselExampleCaptions" data-slide="next">-->
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span>-->
<!-- <span class="sr-only">Next</span>-->
<!-- </button>-->
</div>
</div>
<div class="container mt-5">
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<!-- <img th:src="@{/images/menu/3.png}" alt="一起去下载" width="320" height="200">-->
<div class="caption">
<a th:href="@{/blog}">
<h3 class="btn btn-secondary">论坛
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-send-plus-fill" viewBox="0 0 16 16">
<path d="M15.964.686a.5.5 0 0 0-.65-.65L.767 5.855H.766l-.452.18a.5.5 0 0 0-.082.887l.41.26.001.002 4.995 3.178 1.59 2.498C8 14 8 13 8 12.5a4.5 4.5 0 0 1 5.026-4.47L15.964.686Zm-1.833 1.89L6.637 10.07l-.215-.338a.5.5 0 0 0-.154-.154l-.338-.215 7.494-7.494 1.178-.471-.47 1.178Z"/>
<path d="M16 12.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Zm-3.5-2a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1a.5.5 0 0 0-.5-.5Z"/>
<h1 class="display-3 inverted">Quinn</h1>
<br/>
<div class="lead invertedContent">
<p>欢迎访问</p>
<p><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightbulb-fill" viewBox="0 0 16 16">
<path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13h-5a.5.5 0 0 1-.46-.302l-.761-1.77a1.964 1.964 0 0 0-.453-.618A5.984 5.984 0 0 1 2 6zm3 8.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1-.5-.5z"/>
</svg>
</h3>
</a>
<p>提供一些系统的建议,或者问题,或者建议!问有所答,您的答案是我们的前进的动力!</p>
Quinn 包含资源推荐,资源分享,论坛交流模块</p>
<p>戳下方了解详情↓↓↓</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<div class="caption">
<a th:href="@{/source}">
<h3 class="btn btn-secondary">资源
<div id="fastLink" class="row">
<div class="col-md-1">
<a th:href="@{/blog/read/1}" class="text-dark font-weight-bold text-decoration-none">
<p class= "badge badge-pill badge-dark">注册说明
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-postcard-fill" viewBox="0 0 16 16">
<path d="M11 8h2V6h-2v2Z"/>
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm8.5.5a.5.5 0 0 0-1 0v7a.5.5 0 0 0 1 0v-7ZM2 5.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5ZM2.5 7a.5.5 0 0 0 0 1H6a.5.5 0 0 0 0-1H2.5ZM2 9.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5Zm8-4v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z"/>
</svg>
</h3>
</p>
</a>
<p>提供玩家共享资源信息,打造整体更出色的游戏体验!</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<div class="caption">
<a th:href="@{/hotspot}">
<h3 class="btn btn-secondary">热点
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-thermometer-high" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V2.5a.5.5 0 0 1 1 0v8.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
<div class="ml-2 col-md-1">
<a th:href="@{/blog/read/2}" class="text-dark font-weight-bold text-decoration-none">
<p class="badge badge-pill badge-success">网站建设
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-postcard-fill" viewBox="0 0 16 16">
<path d="M11 8h2V6h-2v2Z"/>
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm8.5.5a.5.5 0 0 0-1 0v7a.5.5 0 0 0 1 0v-7ZM2 5.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5ZM2.5 7a.5.5 0 0 0 0 1H6a.5.5 0 0 0 0-1H2.5ZM2 9.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5Zm8-4v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z"/>
</svg>
</h3>
</p>
</a>
</div>
<div class="ml-2 col-md-1">
<a th:href="@{/blog/read/3}" class="text-dark font-weight-bold text-decoration-none">
<p class="badge badge-pill badge-warning">建议反馈
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-postcard-fill" viewBox="0 0 16 16">
<path d="M11 8h2V6h-2v2Z"/>
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm8.5.5a.5.5 0 0 0-1 0v7a.5.5 0 0 0 1 0v-7ZM2 5.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5ZM2.5 7a.5.5 0 0 0 0 1H6a.5.5 0 0 0 0-1H2.5ZM2 9.5a.5.5 0 0 0 .5.5H6a.5.5 0 0 0 0-1H2.5a.5.5 0 0 0-.5.5Zm8-4v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z"/>
</svg>
</p>
</a>
<p>提供用户免费游戏资源,请各位玩家免费获取!分享心得!</p>
</div>
</div>
</div>
</div>
<hr/>
<div id="register" class="mt-3">
</div>
</div>
</main>
<div th:replace="~{common/footer::footer}"></div>
<a class="to-top badge badge-light">返回顶部</a>
<div class="to-top">
<img class="d-block pl-2" src="/images/logo/qrcode.png" width="50" height="50">
<a class="badge badge-light">返回顶部</a>
</div>
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/js/toTop.js}"></script>

View File

@@ -13,7 +13,7 @@
<div class="col-md-4" >
</div>
<div class="col-md-4 mt-5" id='login_box'>
<form class="form-horizontal" method="post" th:action="@{/login}" novalidate>
<form id="loginForm" class="form-horizontal" method="post" th:action="@{/login}" novalidate>
<div class="justify-content-center">
<h1>登录<small style="font-size: small">Quinn</small></h1>
</div>
@@ -27,10 +27,10 @@
</div>
<div class="checkbox float-left mb-3">
<label>
<input type="checkbox" name="remember" value="remember-me"> 记住密码
<input type="checkbox" name="remember-me"> 记住密码
</label>
</div>
<button class="btn btn-dark btn-block" type="submit" onclick="loginSubmit()">登 录</button>
<button class="btn btn-dark btn-block" type="button" onclick="loginSubmit()">登 录</button>
<p class="mt-1 clearfix">
<a style="color: white" th:href="@{/register}" class="float-right text-decoration-none">没有账号?去注册</a>
</p>
@@ -42,8 +42,6 @@
</div>
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<!--<script th:src="@{/js/jquery-ui.min.js}"></script>-->
<!--<script th:src="@{/live/js/addlive2d.js}"></script>-->
<script th:src="@{/layer/mobile/layer.js}"></script>
<script type="text/javascript">
function loginSubmit(){
@@ -57,7 +55,25 @@
layer.open({ content: '密码不能为空', skin: 'msg', time: 2 });
return;
}
this.submit();
if (username && password){
$.ajax({
url: "/checkLogin",
async: false,
type: "post",
data: {"username":username,"password":password},
success: function (data) {
if(data == 'ok') {
this.disabled = true;
$('#loginForm').submit();
}else {
layer.open({ content: '用户名不存在或密码有误', skin: 'msg', time: 2 });
}
},
fail: function (error){
layer.open({ content: error, skin: 'msg', time: 2 });
}
})
}
}
</script>
</body>

View File

@@ -15,7 +15,7 @@
<main role="main">
<div class="container">
<div class="col-md-12 blog-main" style="margin-top: 20px">
<form th:action="@{'/about'}" method="post">
<form th:action="@{'/about/append'}" method="post">
<div class="col-md-12 mb-3">
<label>标题</label>
<input type="text" name="title" class="form-control" value="" required>

View File

@@ -35,8 +35,8 @@
<input id="email" type="text" name="email" class="form-control" placeholder="邮箱" pattern="^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+" required>
</div>
<div class="form-group">
<label for="code">邀请</label>
<input id="code" type="text" name="code" class="form-control" placeholder="邀请码" required>
<label for="code">注册</label>
<input id="code" type="text" name="code" class="form-control" placeholder="注册码" required>
</div>
<button class="btn btn-dark btn-block" type="button" onclick="javascript:registerSubmit();">注 册</button>
<p class="mt-1 clearfix">
@@ -52,7 +52,7 @@
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/js/jquery-ui.min.js}"></script>
<!--<script th:src="@{/live/js/addlive2d.js}"></script>-->
<!--<script th:src="@{/layer/mobile/layer.js}"></script>-->
<script th:src="@{/layer/mobile/layer.js}"></script>
<script type="text/javascript">
function registerSubmit(){
let username = $('#username').val();
@@ -86,12 +86,17 @@
return;
}
$.ajax({
url: "/register",
url: "/checkRegister",
async: false,
type: "post",
data: {"username":username,"password":password,"repassword":repassword,"email":email,"code":code},
success: function (data) {
if(data == 'ok'){
this.disabled = true;
$('#registerForm').submit();
}else {
layer.open({ content: data, skin: 'msg', time: 2 });
}
},
fail: function (error){
layer.open({ content: error, skin: 'msg', time: 2 });

View File

@@ -6,7 +6,6 @@
<title>资源库-Quinn</title>
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
<style>
#maxLength {
max-width: 500px;
@@ -26,15 +25,18 @@
大佬需要什么资料请提交论坛或者关注公众号反馈。
</div>
<div class="row row-cols-1 row-cols-md-3 text-center">
<div class="row row-cols-md-3 text-center">
<div class="col mb-3" th:each="source:${sourceList}">
<div class="card">
<div class="card-header">
<a class="text-dark font-weight-bold text-decoration-none" th:href="@{'/source/view/'+${source.getSid()}}">
<h4 class="font-weight-normal d-inline">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightning-fill" viewBox="0 0 16 16">
<path d="M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641l2.5-8.5z"/>
</svg>
[[${source.getSourceName()}]]
</h4>
<span class="badge badge-danger">
<span class="badge badge-pill badge-warning">
[[${source.getCategoryName()}]]
</span>
</a>

View File

@@ -138,8 +138,8 @@
<span th:text="${session.loginUser.getUsername()}"></span>
<br>
<small>
<span th:if="${session.loginUser.getRole()=='ADMIN'}" class="badge badge-primary">超级管理员</span>
<span th:if="${session.loginUser.getRole()!='ADMIN'}" th:class="${session.loginUser.getRole()=='VIP'?'badge badge-warning':'badge badge-success'}"
<span th:if="${session.loginUser.getRole()=='KOBE'}" class="badge badge-primary">超级管理员</span>
<span th:if="${session.loginUser.getRole()!='KOBE'}" th:class="${session.loginUser.getRole()=='VIP'?'badge badge-warning':'badge badge-success'}"
th:text="${session.loginUser.getRole()=='VIP'?'VIP会员':'普通用户'}">
</span>
</small>

View File

@@ -27,28 +27,12 @@ public class RedisTest {
@Test
public void updateViewTask(){
List<String> keys = redisUtils.scan(QuinnConstant.SOURCE_KEY + QuinnConstant.REDIS_PATTEN);
if (!CollectionUtils.isEmpty(keys)){
keys.forEach(x->{
Source source = sourceService.getById(getIdFromKey(x,QuinnConstant.SOURCE_KEY));
if (source != null && !StringUtils.isEmpty(source.getSourceName())){
source.setDownRecord(Integer.parseInt(redisUtils.get(x)));
sourceService.updateById(source);
redisUtils.del(x);
}
});
}
}
@Test
public void setTestKey(){
redisUtils.set(QuinnConstant.SOURCE_KEY+1,"123");
redisUtils.set(QuinnConstant.SOURCE_KEY+2,"456");
redisUtils.set(QuinnConstant.SOURCE_KEY+3,"789");
}
private String getIdFromKey(String key,String keyType){
return key.substring(keyType.length());
}
}