当前位置:网站首页>开发知识点
开发知识点
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(), ";");
边栏推荐
猜你喜欢

Go basic anonymous variable

JDBC练习案例

Print out mode of go
![[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)](/img/75/3f6203410dd2754e578e0baaaa9aef.png)
[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)

Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)

Golang common settings - modify background

Fusion de la conversion et de la normalisation des lots

Bean load control

基于FPGA的VGA协议实现

Go project operation method
随机推荐
采用VNC Viewer方式远程连接树莓派
SharedPreferences save list < bean > to local and solve com google. gson. internal. Linkedtreemap cannot be cast to exception
golang入门:for...range修改切片中元素的值的另类方法
Interface switching based on pyqt5 toolbar button -2
How to maintain the brand influence of clothing enterprises
[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)
Convolution和Batch normalization的融合
Use the scroll bar of souI when using the real window in souI
Getting started with golang: for Range an alternative method of modifying the values of elements in slices
理想汽车×OceanBase:当造车新势力遇上数据库新势力
Which common ports should the server open
Win11麦克风测试在哪里?Win11测试麦克风的方法
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
What can I do after buying a domain name?
【直播预约】数据库OBCP认证全面升级公开课
Convolution和Batch normalization的融合
Warning: implicitly declaring library function 'printf' with type 'int (const char *,...)‘
@BindsInstance在Dagger2中怎么使用
MarkDown基本语法
Mapper代理开发