幸运25-日志

This commit is contained in:
khalil
2025-05-05 20:20:17 +08:00
parent 42806f1937
commit cac74af670
2 changed files with 43 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import com.accompany.business.model.Gift;
import com.accompany.business.service.lucky.*;
import com.accompany.core.model.Room;
import com.accompany.sharding.model.Lucky25Record;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RMap;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +57,10 @@ public class Lucky25DrawService {
if (null != highRechargeResult){
Long receiver = receiverList.remove(0);
highRechargeResult.setReceiverUid(receiver);
//todo log
log.info("[lucky25] highRechargeResult uid {} beforeTotalInput {} afterTotalInput {} highRechargeResult {} receiverUid {}",
senderUid, beforeTotalInput, afterTotalInput, JSON.toJSONString(highRechargeResult), receiver);
resultList.add(highRechargeResult);
if (CollectionUtils.isEmpty(receiverList)){
@@ -67,14 +71,16 @@ public class Lucky25DrawService {
}
// admin 1000
int adminSuperNum = userMetaMap.getOrDefault(Lucky25UserMetaService.ADMIN_1000_NUM_KEY, 0).intValue();
if (adminSuperNum > 0){
int trySuperNum = Math.min(adminSuperNum, receiverList.size());
int afterSuperNum = userMetaService.subAdminTicketNum(senderUid, trySuperNum);
for (int i = 0; i < afterSuperNum; i++) {
Long receiver = receiverList.remove(0);
//todo log
log.info("[lucky25] admin1000 uid {} trySuperNum {} afterSuperNum {} receiverUid {}",
senderUid, trySuperNum, afterSuperNum, receiver);
Lucky25Result adminSuperResult = new Lucky25Result(null, receiver, everyoneGoldNum, 1000L, true);
resultList.add(adminSuperResult);
}

View File

@@ -3,6 +3,7 @@ package com.accompany.business.service.gift;
import com.accompany.business.constant.Lucky25PoolTypeEnum;
import com.accompany.business.dto.lucky.Lucky25GiftConfig;
import com.accompany.business.service.lucky.*;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -30,47 +31,73 @@ public class Lucky25PoolJudgeService {
if (curPoolType == Lucky25PoolTypeEnum.NORMAL_POOL.getType()){
if (null != partitionConfig.getHighPoolEntreProductionRatio() && judgeProductionRatio.compareTo(partitionConfig.getHighPoolEntreProductionRatio()) < 0){
if (!userMetaService.casCurPoolType(senderUid, curPoolType, Lucky25PoolTypeEnum.HIGH_POOL.getType())){
//todo log failure
log.error("[lucky25] judge cas uid {} partitionId {} curPoolType NORMAL_POOL judgeProductionRatio {} highPoolEntreProductionRatio {} afterPoolType HIGH_POOL failure !!!",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getHighPoolEntreProductionRatio());
return;
}
poolService.delPoolAndGenPool(config, senderUid, Lucky25PoolTypeEnum.HIGH_POOL.getType());
log.info("[lucky25] judge delPoolAndGenPool uid {} partitionId {} curPoolType NORMAL_POOL " +
"judgeProductionRatio {} highPoolEntreProductionRatio {} afterPoolType HIGH_POOL",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getHighPoolEntreProductionRatio());
return;
} else if (null != partitionConfig.getLowPoolEntreProductionRatio() && judgeProductionRatio.compareTo(partitionConfig.getLowPoolEntreProductionRatio()) > 0) {
if (!userMetaService.casCurPoolType(senderUid, curPoolType, Lucky25PoolTypeEnum.LOW_POOL.getType())){
//todo log failure
log.error("[lucky25] judge uid {} partitionId {} curPoolType NORMAL_POOL judgeProductionRatio {} lowPoolEntreProductionRatio {} afterPoolType LOW_POOL failure !!!",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getLowPoolEntreProductionRatio());
return;
}
poolService.delPoolAndGenPool(config, senderUid, Lucky25PoolTypeEnum.LOW_POOL.getType());
log.info("[lucky25] judge yes delPoolAndGenPool uid {} partitionId {} curPoolType NORMAL_POOL " +
"judgeProductionRatio {} lowPoolEntreProductionRatio {} afterPoolType LOW_POOL",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getLowPoolEntreProductionRatio());
return;
}
//todo log
log.info("[lucky25] judge no uid {} partitionId {} curPoolType {} judgeProductionRatio {} highPoolEntreProductionRatio {} lowPoolEntreProductionRatio {}",
senderUid, partitionId, curPoolType, judgeProductionRatio, partitionConfig.getHighPoolEntreProductionRatio(), partitionConfig.getLowPoolEntreProductionRatio());
} else if (curPoolType == Lucky25PoolTypeEnum.HIGH_POOL.getType()) {
if (null != partitionConfig.getHighPoolQuitProductionRatio() && judgeProductionRatio.compareTo(partitionConfig.getHighPoolQuitProductionRatio()) > 0){
if (!userMetaService.casCurPoolType(senderUid, curPoolType, Lucky25PoolTypeEnum.NEW_USER_POOL.getType())){
//todo log failure
log.error("[lucky25] judge cas uid {} partitionId {} curPoolType HIGH_POOL judgeProductionRatio {} highPoolQuitProductionRatio {} afterPoolType NEW_USER_POOL failure !!!",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getHighPoolQuitProductionRatio());
return;
}
poolService.delPoolAndGenPool(config, senderUid, Lucky25PoolTypeEnum.NEW_USER_POOL.getType(), 4);
log.info("[lucky25] judge yes delPoolAndGenPool uid {} partitionId {} curPoolType HIGH_POOL " +
"judgeProductionRatio {} highPoolQuitProductionRatio {} afterPoolType NEW_USER_POOL",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getHighPoolQuitProductionRatio());
return;
}
//todo log
log.info("[lucky25] judge no uid {} partitionId {} curPoolType HIGH_POOL judgeProductionRatio {} highPoolQuitProductionRatio {}",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getHighPoolEntreProductionRatio());
} else if (curPoolType == Lucky25PoolTypeEnum.LOW_POOL.getType()) {
if (null != partitionConfig.getLowPoolQuitProductionRatio() && judgeProductionRatio.compareTo(partitionConfig.getLowPoolQuitProductionRatio()) < 0){
if (!userMetaService.casCurPoolType(senderUid, curPoolType, Lucky25PoolTypeEnum.HIGH_POOL.getType())){
//todo log failure
log.error("[lucky25] judge cas uid {} partitionId {} curPoolType LOW_POOL judgeProductionRatio {} lowPoolQuitProductionRatio {} afterPoolType NEW_USER_POOL failure !!!",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getLowPoolQuitProductionRatio());
return;
}
poolService.delPoolAndGenPool(config, senderUid, Lucky25PoolTypeEnum.NEW_USER_POOL.getType(), 4);
log.info("[lucky25] judge yes delPoolAndGenPool uid {} partitionId {} curPoolType LOW_POOL " +
"judgeProductionRatio {} lowPoolQuitProductionRatio {} afterPoolType NEW_USER_POOL",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getLowPoolQuitProductionRatio());
return;
}
//todo log
log.info("[lucky25] judge no uid {} partitionId {} curPoolType LOW_POOL judgeProductionRatio {} lowPoolQuitProductionRatio {}",
senderUid, partitionId, judgeProductionRatio, partitionConfig.getLowPoolEntreProductionRatio());
}
}