当前位置:网站首页>开发知识点
开发知识点
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(), ";");
边栏推荐
- Where is the win11 automatic shutdown setting? Two methods of setting automatic shutdown in win11
- 购买完域名之后能干什么事儿?
- 非路由组件之头部组件和底部组件书写
- CDN 加速,需要域名先备案
- Fudian bank completes the digital upgrade | oceanbase database helps to layout the distributed architecture of the middle office
- Use the scroll bar of souI when using the real window in souI
- Remote connection of raspberry pie by VNC viewer
- Go basic anonymous variable
- [error record] the flutter reports an error (could not resolve io.flutter:flutter_embedding_debug:1.0.0.)
- JDBC practice cases
猜你喜欢
潘多拉 IOT 开发板学习(HAL 库)—— 实验4 串口通讯实验(学习笔记)
(stinger) use pystinger Socks4 to go online and not go out of the network host
Win11麦克风测试在哪里?Win11测试麦克风的方法
Compose 中的 'ViewPager' 详解 | 开发者说·DTalk
一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
Integration of revolution and batch normalization
Interface switching based on pyqt5 toolbar button -1
Potplayer set minimized shortcut keys
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
What if win11 can't turn off the sticky key? The sticky key is cancelled but it doesn't work. How to solve it
随机推荐
sourcetree 详细
【OJ】两个数组的交集(set、哈希映射 ...)
Eight honors and eight disgraces of the programmer version~
Ping domain name error unknown host, NSLOOKUP / system d-resolve can be resolved normally, how to Ping the public network address?
潘多拉 IOT 开发板学习(HAL 库)—— 实验3 按键输入实验(学习笔记)
Hisilicon VI access video process
Fudian bank completes the digital upgrade | oceanbase database helps to layout the distributed architecture of the middle office
Print out mode of go
All things work together, and I will review oceanbase's practice in government and enterprise industry
"A good programmer is worth five ordinary programmers!"
JDBC Exercise case
Where is the win11 microphone test? Win11 method of testing microphone
Convolution和Batch normalization的融合
Cryptographic technology -- key and ssl/tls
Integration of revolution and batch normalization
理想汽车×OceanBase:当造车新势力遇上数据库新势力
Win11系统explorer频繁卡死无响应的三种解决方法
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
[live broadcast appointment] database obcp certification comprehensive upgrade open class
A single element in an ordered array -- Valentine's Day mental problems