当前位置:网站首页>开发知识点
开发知识点
2022-07-02 22:20:00 【捕風捉影】
//TODO 5、防重令牌(防止表单重复提交)
//为用户设置一个token,三十分钟过期时间(存在redis)
String token = UUID.randomUUID().toString().replace("-", "");
redisTemplate.opsForValue().set(USER_ORDER_TOKEN_PREFIX+memberResponseVo.getId(),token,30, TimeUnit.MINUTES);
confirmVo.setOrderToken(token);
生成uuid 作为redis 的key
redis脚本程序判断判断前端传递过来的数据是否和后端一致
//1、验证令牌是否合法【令牌的对比和删除必须保证原子性】
String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
String orderToken = vo.getOrderToken();
//通过lure脚本原子验证令牌和删除令牌
Long result = redisTemplate.execute(new DefaultRedisScript<Long>(script, Long.class),
Arrays.asList(USER_ORDER_TOKEN_PREFIX + memberResponseVo.getId()),
orderToken);
集合转为string
//使用StringUtils.collectionToDelimitedString将list集合转换为String
String skuAttrValues = StringUtils.collectionToDelimitedString(items.getSkuAttrValues(), ";");
边栏推荐
- 返回二叉树中最大的二叉搜索子树的大小
- @BindsInstance在Dagger2中怎么使用
- How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
- 程序分析与优化 - 9 附录 XLA的缓冲区指派
- SharedPreferences 保存List<Bean> 到本地并解决com.google.gson.internal.LinkedTreeMap cannot be cast to异常
- JDBC教程
- Mapper代理开发
- C MVC creates a view to get rid of the influence of layout
- 提交代码流程
- Eight bit responder [51 single chip microcomputer]
猜你喜欢
YOLOX加强特征提取网络Panet分析
Tiktok actual combat ~ number of likes pop-up box
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
Bean加载控制
Win11系统explorer频繁卡死无响应的三种解决方法
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
Fusion de la conversion et de la normalisation des lots
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
Speech recognition Series 1: speech recognition overview
Convolution和Batch normalization的融合
随机推荐
Request and response
Speech recognition Series 1: speech recognition overview
判断二叉树是否为满二叉树
Catalogue of digital image processing experiments
(毒刺)利用Pystinger Socks4上线不出网主机
【STL源码剖析】仿函数(待补充)
万物并作,吾以观复|OceanBase 政企行业实践
JSON数据传递参数
I've been interviewed. The starting salary is 16K
Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
[proteus simulation] 51 MCU +lcd12864 push box game
Bean load control
How can cross-border e-commerce achieve low-cost and steady growth by laying a good data base
MarkDown基本语法
SQL advanced syntax
JDBC練習案例
Call vs2015 with MATLAB to compile vs Project
Pandora IOT development board learning (HAL Library) - Experiment 3 key input experiment (learning notes)
Dishes launcher small green program and directory management (efficiency tool)
基于FPGA的VGA协议实现