文章管理点击量查询逻辑更改
This commit is contained in:
parent
52634eda67
commit
59c998e8dd
|
|
@ -14,7 +14,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
|
@ -304,7 +303,6 @@ public class ArticleManageController extends BaseController {
|
|||
* 保存(更新)文章静态页面 @Title: updateArticle @Description: TODO() @param @return
|
||||
* 参数 @return Message 返回类型 @throws
|
||||
*/
|
||||
@CrossOrigin(allowCredentials = "true", allowedHeaders = "*", origins = "*", maxAge = 1800)
|
||||
@RequestMapping("/updateArticle")
|
||||
@ResponseBody
|
||||
public Message updateArticle(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
|
|
|||
|
|
@ -1017,7 +1017,7 @@
|
|||
cache: false,
|
||||
success: function (data) {
|
||||
if (data.result) {
|
||||
$.modal.open('文章预览', data.object.editUrl)
|
||||
$.modal.open('文章预览', data.object.editUrl + '?l=1')
|
||||
|
||||
} else {
|
||||
$.modal.alertError("预览失败,请稍后重试!");
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ public class ShiroConfig
|
|||
// Shiro连接约束配置,即过滤链的定义
|
||||
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
||||
// 对静态资源设置匿名访问
|
||||
filterChainDefinitionMap.put("/article/updateArticle", "anon");
|
||||
filterChainDefinitionMap.put("/favicon.ico**", "anon");
|
||||
filterChainDefinitionMap.put("/ruoyi.png**", "anon");
|
||||
filterChainDefinitionMap.put("/css/**", "anon");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.ruoyi.framework.interceptor;
|
|||
import java.lang.reflect.Method;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
|
@ -17,29 +19,31 @@ import com.ruoyi.common.utils.ServletUtils;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
|
||||
{
|
||||
public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
|
||||
{
|
||||
if (handler instanceof HandlerMethod)
|
||||
{
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
response.setHeader("Access-control-Allow-Origin", request.getHeader("Origin"));
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers"));
|
||||
response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
|
||||
if ("OPTIONS".equals(request.getMethod())) {
|
||||
response.setStatus(HttpStatus.OK.value());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handler instanceof HandlerMethod) {
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
Method method = handlerMethod.getMethod();
|
||||
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
|
||||
if (annotation != null)
|
||||
{
|
||||
if (this.isRepeatSubmit(request))
|
||||
{
|
||||
if (annotation != null) {
|
||||
if (this.isRepeatSubmit(request)) {
|
||||
AjaxResult ajaxResult = AjaxResult.error("不允许重复提交,请稍后再试");
|
||||
ServletUtils.renderString(response, JSON.marshal(ajaxResult));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return super.preHandle(request, response, handler);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue