礼金过期

This commit is contained in:
雷欧(林平凡)
2025-06-13 15:17:47 +08:00
parent 0a503e04fc
commit 8635c05565
2 changed files with 62 additions and 1 deletions

View File

@@ -947,6 +947,9 @@ public class JDUtil {
result.append(" ").append(skuName).append(" 礼金创建成功\n");
if (giftKey == null) {
result.append(" ").append(skuName).append(" 礼金创建失败但是转链成功\n");
}else {
// 将开通成功的怼进去redis 做一个定时调度去扫描如果礼金今天会过期就发送通知需要判断是自营还是poppop礼金有效期是7天
saveGiftCouponToRedis(skuId, giftKey, skuName, owner);
}
} else {
@@ -966,7 +969,22 @@ public class JDUtil {
cacheMap.remove("finalWenAn" + wxid);
}
}
/*
将礼金信息写入 Redis **/
public void saveGiftCouponToRedis(String skuId, String giftKey, String skuName, String owner) {
String key = "gift_coupon:" + skuId ;
String hashKey = giftKey;
LocalDateTime expireTime = LocalDateTime.now().plus(owner.equals("g") ? 0 : 7, ChronoUnit.DAYS);
Map<String, Object> data = new HashMap<>();
data.put("giftKey", giftKey);
data.put("skuName", skuName);
data.put("owner", owner);
data.put("expireTime", expireTime.format(DateTimeFormatter.ISO_DATE_TIME));
// 存入 Redis Hash
redisTemplate.opsForHash().put(key, hashKey, JSON.toJSONString(data));
}
/**
* 处理用户输入的推广方案内容
*