From 95a23b572b73d16ce9e999038d93d992ce9e3678 Mon Sep 17 00:00:00 2001 From: limqhz Date: Tue, 17 May 2022 14:50:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E4=BA=86=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E8=AE=B0=E4=BD=8F=E5=AF=86=E7=A0=81=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=EF=BC=8C=20=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=AD=E5=BF=83=E7=9A=84=E6=A0=B7=E5=BC=8F=E3=80=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E7=BC=96=E8=BE=91=E6=A0=8F=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/quinn/config/SecurityConfig.java | 2 +- .../java/com/quinn/service/impl/BlogServiceImpl.java | 9 +++++---- .../com/quinn/service/impl/SourceServiceImpl.java | 7 +++++-- src/main/resources/static/wangedit/js/wang.init.js | 4 ++-- src/main/resources/static/wangedit/js/wang.read.js | 4 ++-- src/main/resources/templates/blog/editor.html | 2 +- src/main/resources/templates/blog/read.html | 2 +- src/main/resources/templates/blog/write.html | 2 +- src/main/resources/templates/login.html | 2 +- src/main/resources/templates/source/editorSource.html | 2 +- src/main/resources/templates/source/list.html | 11 +++++------ src/main/resources/templates/source/uploadSource.html | 2 +- src/main/resources/templates/source/view.html | 2 +- src/main/resources/templates/user/index.html | 7 ++++--- 14 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/quinn/config/SecurityConfig.java b/src/main/java/com/quinn/config/SecurityConfig.java index 86fcf17..1c304d9 100644 --- a/src/main/java/com/quinn/config/SecurityConfig.java +++ b/src/main/java/com/quinn/config/SecurityConfig.java @@ -58,7 +58,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { // http.requiresChannel().anyRequest().requiresSecure(); // 记住我配置 默认为remember-me - http.rememberMe(); + http.rememberMe().tokenValiditySeconds(604800); } // 用户授权验证 diff --git a/src/main/java/com/quinn/service/impl/BlogServiceImpl.java b/src/main/java/com/quinn/service/impl/BlogServiceImpl.java index 73ad343..1288694 100644 --- a/src/main/java/com/quinn/service/impl/BlogServiceImpl.java +++ b/src/main/java/com/quinn/service/impl/BlogServiceImpl.java @@ -57,13 +57,14 @@ public class BlogServiceImpl extends ServiceImpl implements Bl } private void addRecord(BlogWithUser blogRead, String sessionId) { - String value = redisUtils.get(sessionId + blogRead.getBid()); + String bid = blogRead.getBid(); + String value = redisUtils.get(sessionId + bid); Blog blog = new Blog(); - blog.setBid(blogRead.getBid()); if (!QuinnConstant.SESSION_VIEW_KEY.equals(value)){ blog.setViews(blogRead.getViews()+1); - redisUtils.set(sessionId + blog.getBid(),QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT); - updateById(blog); + blogRead.setViews(blogRead.getViews()+1); + redisUtils.set(sessionId + bid,QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT); + update(blog,new QueryWrapper().eq("bid",bid)); } } diff --git a/src/main/java/com/quinn/service/impl/SourceServiceImpl.java b/src/main/java/com/quinn/service/impl/SourceServiceImpl.java index e14d6c5..24ed8ae 100644 --- a/src/main/java/com/quinn/service/impl/SourceServiceImpl.java +++ b/src/main/java/com/quinn/service/impl/SourceServiceImpl.java @@ -196,9 +196,12 @@ public class SourceServiceImpl extends ServiceImpl impleme */ String value = redisUtils.get(sessionId + source.getSid()); if (!QuinnConstant.SESSION_VIEW_KEY.equals(value)){ - source.setDownRecord(source.getDownRecord() + 1); + Source update = new Source(); + update.setId(source.getId()); + update.setDownRecord(source.getDownRecord() + 1); redisUtils.set(sessionId + source.getSid(),QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT); - updateById(source); + // 不更新大字段 + updateById(update); } } diff --git a/src/main/resources/static/wangedit/js/wang.init.js b/src/main/resources/static/wangedit/js/wang.init.js index 4836d40..a393a44 100644 --- a/src/main/resources/static/wangedit/js/wang.init.js +++ b/src/main/resources/static/wangedit/js/wang.init.js @@ -1,6 +1,6 @@ /* 如果使用该初始化方法,请一定要在html放三个标签,或者直接看代码修改内容 *
-*
+*
* * 另外此方法依赖layer.js & axios.js 做遮罩弹框, * 也可以重写 uploadImage:onFailed | onError 自定义提示 @@ -13,7 +13,7 @@ E.i18nChangeLanguage(LANG) const editorConfig = { placeholder: '请输入...', - scroll: true, // 禁止编辑器滚动 + scroll: false, // 禁止编辑器滚动 MENU_CONF: { uploadImage: { fieldName: 'your-fileName', diff --git a/src/main/resources/static/wangedit/js/wang.read.js b/src/main/resources/static/wangedit/js/wang.read.js index a85a896..dca44b7 100644 --- a/src/main/resources/static/wangedit/js/wang.read.js +++ b/src/main/resources/static/wangedit/js/wang.read.js @@ -1,6 +1,6 @@ /* 如果使用该初始化方法,请一定要在html放三个标签,或者直接看代码修改内容 *
-*
+*
* * 另外此方法依赖layer.js & axios.js 做遮罩弹框, * 也可以重写 uploadImage:onFailed | onError 自定义提示 @@ -14,7 +14,7 @@ E.i18nChangeLanguage(LANG) const editorConfig = { placeholder: '', readOnly: true, - scroll: true, // 禁止编辑器滚动 + scroll: false, // 禁止编辑器滚动 } // 先创建 editor diff --git a/src/main/resources/templates/blog/editor.html b/src/main/resources/templates/blog/editor.html index 9f2f433..a353f0b 100644 --- a/src/main/resources/templates/blog/editor.html +++ b/src/main/resources/templates/blog/editor.html @@ -50,7 +50,7 @@

论坛详情

-
+
diff --git a/src/main/resources/templates/blog/read.html b/src/main/resources/templates/blog/read.html index 72d163d..53b6014 100644 --- a/src/main/resources/templates/blog/read.html +++ b/src/main/resources/templates/blog/read.html @@ -96,7 +96,7 @@
-
+
diff --git a/src/main/resources/templates/blog/write.html b/src/main/resources/templates/blog/write.html index 8062d07..aa81e2f 100644 --- a/src/main/resources/templates/blog/write.html +++ b/src/main/resources/templates/blog/write.html @@ -50,7 +50,7 @@

文章内容

-
+
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 38aaf3c..5771b14 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -27,7 +27,7 @@
diff --git a/src/main/resources/templates/source/editorSource.html b/src/main/resources/templates/source/editorSource.html index 9483c46..a1c0b0d 100644 --- a/src/main/resources/templates/source/editorSource.html +++ b/src/main/resources/templates/source/editorSource.html @@ -79,7 +79,7 @@
-
+
diff --git a/src/main/resources/templates/source/list.html b/src/main/resources/templates/source/list.html index 85a0504..98eea8c 100644 --- a/src/main/resources/templates/source/list.html +++ b/src/main/resources/templates/source/list.html @@ -8,7 +8,7 @@