task 修复3
This commit is contained in:
parent
91b5cb524c
commit
79f0c8f15a
@ -211,7 +211,8 @@ public class TaskListener implements MessageListener {
|
|||||||
|
|
||||||
private void handleTask2(TaskApprovalEvent eventBody) {
|
private void handleTask2(TaskApprovalEvent eventBody) {
|
||||||
log.warn("处理任务-2 在房间内赠送礼物: {}", eventBody);
|
log.warn("处理任务-2 在房间内赠送礼物: {}", eventBody);
|
||||||
// 更新任务状态的逻辑 直接更新
|
eventBody.setTargetValue(1);
|
||||||
|
eventBody.setCompleteValue(1);
|
||||||
updateTaskStatus(eventBody);
|
updateTaskStatus(eventBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +230,8 @@ public class TaskListener implements MessageListener {
|
|||||||
private void handleTask4(TaskApprovalEvent eventBody) {
|
private void handleTask4(TaskApprovalEvent eventBody) {
|
||||||
// 具体的任务 4 处理逻辑
|
// 具体的任务 4 处理逻辑
|
||||||
log.warn("处理任务-4 玩一局游戏: {}", eventBody);
|
log.warn("处理任务-4 玩一局游戏: {}", eventBody);
|
||||||
// 更新任务状态的逻辑
|
eventBody.setTargetValue(1);
|
||||||
|
eventBody.setCompleteValue(1);
|
||||||
updateTaskStatus(eventBody);
|
updateTaskStatus(eventBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +264,8 @@ public class TaskListener implements MessageListener {
|
|||||||
|
|
||||||
private void handleTask3(TaskApprovalEvent eventBody) {
|
private void handleTask3(TaskApprovalEvent eventBody) {
|
||||||
log.warn("处理任务-3: {}", eventBody);
|
log.warn("处理任务-3: {}", eventBody);
|
||||||
// 在商店购买任意商品
|
eventBody.setTargetValue(1);
|
||||||
|
eventBody.setCompleteValue(1);
|
||||||
updateTaskStatus(eventBody);
|
updateTaskStatus(eventBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,20 +294,17 @@ public class TaskListener implements MessageListener {
|
|||||||
// 关注用户计数,每日过期
|
// 关注用户计数,每日过期
|
||||||
String redisKey = "task:follow-user:" + eventBody.getUserId();
|
String redisKey = "task:follow-user:" + eventBody.getUserId();
|
||||||
String countStr = redisService.getString(redisKey);
|
String countStr = redisService.getString(redisKey);
|
||||||
|
|
||||||
if (StringUtils.isEmpty(countStr)) {
|
if (StringUtils.isBlank(countStr)) {
|
||||||
// 计算到凌晨的过期时间(秒)
|
// 计算到凌晨的过期时间(秒)
|
||||||
long expireSeconds = DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight();
|
long expireSeconds = DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight();
|
||||||
redisService.increment(redisKey, 1, expireSeconds, TimeUnit.SECONDS);
|
redisService.increment(redisKey, 1, expireSeconds, TimeUnit.SECONDS);
|
||||||
// 第一次关注就完成任务
|
// 第一次关注就完成任务
|
||||||
updateTaskStatus(eventBody);
|
eventBody.setTargetValue(1);
|
||||||
} else {
|
eventBody.setCompleteValue(1);
|
||||||
// 已经完成过了
|
boolean updated = updateTaskStatus(eventBody);
|
||||||
if (Integer.parseInt(countStr) >= 1) {
|
if (updated) {
|
||||||
updateTaskStatus(eventBody);
|
redisService.increment(redisKey, 1);
|
||||||
} else {
|
|
||||||
redisService.increment(redisKey, 1);
|
|
||||||
updateTaskStatus(eventBody);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,6 +319,8 @@ public class TaskListener implements MessageListener {
|
|||||||
// 计算到凌晨的过期时间(秒)
|
// 计算到凌晨的过期时间(秒)
|
||||||
long expireSeconds = DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight();
|
long expireSeconds = DateTimeAsiaRiyadhUtils.getSecondsUntilMidnight();
|
||||||
redisService.increment(redisKey, 1, expireSeconds, TimeUnit.SECONDS);
|
redisService.increment(redisKey, 1, expireSeconds, TimeUnit.SECONDS);
|
||||||
|
eventBody.setTargetValue(1);
|
||||||
|
eventBody.setCompleteValue(1);
|
||||||
// 第一次关注就完成任务
|
// 第一次关注就完成任务
|
||||||
updateTaskStatus(eventBody);
|
updateTaskStatus(eventBody);
|
||||||
} else {
|
} else {
|
||||||
@ -362,6 +364,8 @@ public class TaskListener implements MessageListener {
|
|||||||
|
|
||||||
private void handleTask5(TaskApprovalEvent eventBody) {
|
private void handleTask5(TaskApprovalEvent eventBody) {
|
||||||
log.warn("处理任务-5 创建我的房间: {}", eventBody);
|
log.warn("处理任务-5 创建我的房间: {}", eventBody);
|
||||||
|
eventBody.setTargetValue(1);
|
||||||
|
eventBody.setCompleteValue(1);
|
||||||
updateTaskStatus(eventBody);
|
updateTaskStatus(eventBody);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user