mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-21 06:20:59 +08:00
fix: add log
This commit is contained in:
@@ -22,6 +22,7 @@ import com.openisle.repository.PostSubscriptionRepository;
|
||||
import com.openisle.repository.NotificationRepository;
|
||||
import com.openisle.model.Role;
|
||||
import com.openisle.exception.RateLimitException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
@@ -44,6 +45,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PostService {
|
||||
private final PostRepository postRepository;
|
||||
@@ -224,6 +226,7 @@ public class PostService {
|
||||
}
|
||||
|
||||
private void finalizeLottery(Long postId) {
|
||||
log.info("start to finalizeLottery for {}", postId);
|
||||
scheduledFinalizations.remove(postId);
|
||||
lotteryPostRepository.findById(postId).ifPresent(lp -> {
|
||||
List<User> participants = new ArrayList<>(lp.getParticipants());
|
||||
@@ -233,6 +236,7 @@ public class PostService {
|
||||
Collections.shuffle(participants);
|
||||
int winnersCount = Math.min(lp.getPrizeCount(), participants.size());
|
||||
java.util.Set<User> winners = new java.util.HashSet<>(participants.subList(0, winnersCount));
|
||||
log.info("winner count {}", winnersCount);
|
||||
lp.setWinners(winners);
|
||||
lotteryPostRepository.save(lp);
|
||||
for (User w : winners) {
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<div v-if="loggedIn && !hasJoined && !lotteryEnded" class="join-prize-button" @click="joinLottery">
|
||||
<div class="join-prize-button-text">参与抽奖</div>
|
||||
</div>
|
||||
<div v-else-if="hasJoined" class="join-prize-button disabled">
|
||||
<div v-else-if="hasJoined" class="join-prize-button-disabled">
|
||||
<div class="join-prize-button-text">已参与</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1197,16 +1197,17 @@ export default {
|
||||
background-color: var(--primary-color-hover);
|
||||
}
|
||||
|
||||
.join-prize-button.disabled {
|
||||
background-color: var(--background-color-disabled);
|
||||
.join-prize-button-disabled {
|
||||
margin-left: 10px;
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 8px;
|
||||
background-color: var(--primary-color-disabled);
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.join-prize-button.disabled:hover {
|
||||
background-color: var(--background-color-disabled);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.prize-member-avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
|
||||
Reference in New Issue
Block a user