当前位置: 首页 > news >正文

asp网站后台管理系统密码破解业务推广方案怎么写

asp网站后台管理系统密码破解,业务推广方案怎么写,网站上添加子栏目,中国文明网联盟网站建设限流整个流程过程 1.首先用户的请求进来,将用户ip和uri组成key,timestamp为value,放入zset 2. 更新当前key的缓存过期时间,这一步主要是为了定期清理掉冷数据,和上面我提到的常见错误设计2中的意义不同 3. 删除窗口之…

限流整个流程过程

1.首先用户的请求进来,将用户ip和uri组成key,timestamp为value,放入zset
2. 更新当前key的缓存过期时间,这一步主要是为了定期清理掉冷数据,和上面我提到的常见错误设计2中的意义不同
3. 删除窗口之外的数据记录
4. 统计当前窗口中的总记录数
5. 如果记录数大于阈值,则直接返回错误,否则正常处理用户请求

首先是定义一个注解,方便后续对不同接口使用不同的限制频率

package org.jeecg.common.aspect.annotation;import java.lang.annotation.*;/*** @Author xu* @create 2023/8/2 19*/
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RequestLimit {// 限制时间 单位:秒(默认值:一分钟)long period() default 60;// 允许请求的次数(默认值:5次)long count() default 5;}

切面AOP处理逻辑

package org.jeecg.common.aspect;import lombok.extern.log4j.Log4j2;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jeecg.common.aspect.annotation.RequestLimit;
import org.jeecg.common.exception.JeecgBootException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Component;import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.TimeUnit;/*** @Author xu* @create 2023/8/2 19*/
@Aspect
@Component
@Log4j2
public class RequestLimitAspect {@AutowiredRedisTemplate redisTemplate;// 切点@Pointcut("@annotation(requestLimit)")public void controllerAspect(RequestLimit requestLimit) {}@Around("controllerAspect(requestLimit)")public Object doAround(ProceedingJoinPoint joinPoint, RequestLimit requestLimit) throws Throwable {long period = requestLimit.period();long limitCount = requestLimit.count();Object[] args = joinPoint.getArgs();String ip = null;String url = null;for (Object arg : args) {if (arg instanceof HttpServletRequest) {HttpServletRequest request = (HttpServletRequest) arg;ip = request.getRemoteAddr();url = request.getRequestURI();break;  // 如果找到了符合条件的参数,可以选择跳出循环}}String key = "req_limit_".concat(url).concat(ip);ZSetOperations zSetOperations = redisTemplate.opsForZSet();long currentMs = System.currentTimeMillis();zSetOperations.add(key, currentMs, currentMs);redisTemplate.expire(key, period, TimeUnit.SECONDS);zSetOperations.removeRangeByScore(key, 0, currentMs - period * 1000);Long count = zSetOperations.zCard(key);if (count > limitCount) {log.error("接口拦截:{} 请求超过限制频率【{}次/{}s】,IP为{}", url, limitCount, period, ip);throw new JeecgBootException("请求太频繁,请稍后再试");}return joinPoint.proceed();}}

Controller层使用

	@AutoLog(value = "访客数据-添加")@RequestLimit(count = 2,period = 20)@ApiOperation(value="访客数据-添加", notes="访客数据-添加")@PostMapping(value = "/verifySave")public Result<?> verifySave(@RequestBody SysVisitantData sysVisitantData,HttpServletRequest request) {String ip = request.getRemoteAddr();String url = request.getRequestURI();return Result.OK("添加成功!");}
http://www.dinnco.com/news/42004.html

相关文章:

  • 专业做蛋糕的网站百度图片识别
  • 如何用ps做网站导航条可以发外链的论坛有哪些
  • 苏州高端网站建设设计公司seo用什么论坛引流
  • 网站开发验收报告百度图片搜索网页版
  • 个人网站建设如何赚钱互联网推广营销方案
  • 施工企业安全控制管理摘要seo霸屏
  • 金湖县政府网站软环境效能建设西安竞价托管公司
  • 买衣服的网站排行榜新闻最新头条10条
  • 体育新闻最新消息篮球沈阳网站优化
  • 网上商城网站建设方案书美国搜索引擎浏览器
  • 怎么看网站是否被k过数据分析师培训机构推荐
  • 松江做网站公司最近一周的热点新闻
  • 个人政务公开网站建设工作总结提高基层治理效能
  • 汕头百度推广公司首页优化排名
  • 青岛哪家公司做网站好环球军事网
  • 苹果商店app下载seo专业推广
  • 做的美食视频网站刘连康seo培训哪家强
  • vue做的网站多么百度官网认证多少钱
  • 辛集哪做网站曹操博客seo
  • wordpress 模板 含数据库seo北京优化
  • 网站备案大概需要多久宁波seo排名优化价格
  • 晋城市 制作网站app优化方案
  • 有个网站做彩盒的推广普通话ppt课件
  • 网站开辟两学一做专栏百度指数网页版
  • 网站备案有必要吗外贸建站公司
  • 中国网站建设服务中心上海seo排名
  • 建立b2b网站成本购物网站排名
  • 有哪些管理系统菏泽资深seo报价
  • ps可以做网站吗百度网址ip
  • 做网站宣传优化大师免费版