1、广告分页查询广告位置组合查询修复;2、短信ip/手机号限制zset设置ttl;

This commit is contained in:
gaoqr
2025-09-04 16:45:12 +08:00
parent 41775c05aa
commit ecae82b507
3 changed files with 11 additions and 7 deletions
@@ -25,17 +25,18 @@ public interface AdvertisementMapper extends BaseMapperX<AdvertisementDO> {
default PageResult<AdvertisementDO> selectPage(AdvertisementPageReqVO reqVO) {
List<Integer> adPosition = reqVO.getAdPosition();
String adPositionStr = null;
if(CollUtil.isNotEmpty(adPosition)) {
adPositionStr = CollUtil.join(adPosition.stream().sorted().distinct().toList(), ",");
}
LambdaQueryWrapperX<AdvertisementDO> queryWrapper = new LambdaQueryWrapperX<AdvertisementDO>()
.likeIfPresent(AdvertisementDO::getAdName, reqVO.getAdName())
.likeIfPresent(AdvertisementDO::getAdPosition, adPositionStr)
.eqIfPresent(AdvertisementDO::getStatus, reqVO.getStatus())
.eqIfPresent(AdvertisementDO::getDeleted, false);
List<Integer> adPosition = reqVO.getAdPosition();
if (CollUtil.isNotEmpty(adPosition)) {
queryWrapper.and(wrapper -> {
adPosition.stream().distinct().forEach(pos -> wrapper.or().apply("FIND_IN_SET({0}, ad_position)", pos));
});
}
return selectPage(reqVO, queryWrapper);
}
@@ -29,6 +29,7 @@ import jakarta.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import static cn.hutool.core.util.RandomUtil.randomInt;
@@ -163,6 +164,8 @@ public class SmsCodeServiceImpl implements SmsCodeService {
// 窗口足够添加当前请求的时间戳
redisTemplate.opsForZSet().add(key, currentTime, currentTime);
// 设置过期时间 = 窗口大小 + 30分钟缓冲
redisTemplate.expire(key, winSizeMin + 30, TimeUnit.MINUTES);
return true;
}
@@ -35,7 +35,7 @@
ad_redirect_url
from advertisement
where deleted = false
and ad_position like concat('%', #{adPosition},'%')
and find_in_set (#{adPosition}, ad_position)
and status = #{status}
and start_time &lt;= #{now}
and end_time &gt;= #{now}