游戏打榜活动根据活动时间处理
This commit is contained in:
parent
d6c214422f
commit
5124df5438
@ -32,6 +32,8 @@ import com.red.circle.other.domain.ranking.RankingActivityType;
|
|||||||
import com.red.circle.other.domain.ranking.RankingCycleType;
|
import com.red.circle.other.domain.ranking.RankingCycleType;
|
||||||
import com.red.circle.other.domain.ranking.RankingDimension;
|
import com.red.circle.other.domain.ranking.RankingDimension;
|
||||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||||
|
import com.red.circle.other.infra.database.mongo.entity.sys.ActivityConfig;
|
||||||
|
import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
||||||
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
||||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||||
@ -75,8 +77,11 @@ public class GameBaishunServiceImpl implements GameBaishunService {
|
|||||||
private final GameListConfigService gameListConfigService;
|
private final GameListConfigService gameListConfigService;
|
||||||
private final ImGroupClient imGroupClient;
|
private final ImGroupClient imGroupClient;
|
||||||
private final RankingActivityService rankingActivityService;
|
private final RankingActivityService rankingActivityService;
|
||||||
|
private final ActivityConfigService activityConfigService;
|
||||||
@Value("${red-circle.game-rank.gameid}")
|
@Value("${red-circle.game-rank.gameid}")
|
||||||
private String gameId;
|
private String gameId;
|
||||||
|
@Value("${red-circle.game-rank.templateId}")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaishunResponse<BaishunTokenResponse> getToken(BaishunTokenRequest request) {
|
public BaishunResponse<BaishunTokenResponse> getToken(BaishunTokenRequest request) {
|
||||||
@ -211,8 +216,11 @@ public class GameBaishunServiceImpl implements GameBaishunService {
|
|||||||
|
|
||||||
//游戏是否参与打榜活动
|
//游戏是否参与打榜活动
|
||||||
if (gameId != null && gameId.equals(request.getGameId()) && request.getCurrencyDiff() > 0) {
|
if (gameId != null && gameId.equals(request.getGameId()) && request.getCurrencyDiff() > 0) {
|
||||||
incGameRankingActivity(DataTypeUtils.toLong(request.getUserId()), 1, request.getCurrencyDiff(),
|
ActivityConfig config = activityConfigService.getOngoingActivityConf(templateId, RankingActivityType.GREEDY_GAME.name());
|
||||||
request.getGameRoundId());
|
if (config != null) {
|
||||||
|
incGameRankingActivity(DataTypeUtils.toLong(request.getUserId()), 1, request.getCurrencyDiff(),
|
||||||
|
request.getGameRoundId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,8 @@ public interface ActivityConfigService {
|
|||||||
|
|
||||||
ActivityConfig getShowcaseActivityConf(Long templateId, String activityType);
|
ActivityConfig getShowcaseActivityConf(Long templateId, String activityType);
|
||||||
|
|
||||||
|
ActivityConfig getOngoingActivityConf(Long templateId, String activityType);
|
||||||
|
|
||||||
List<ActivityConfig> listRecentlyEndedActivities(String sysOrigin, Integer limit);
|
List<ActivityConfig> listRecentlyEndedActivities(String sysOrigin, Integer limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -250,6 +250,20 @@ public class ActivityConfigServiceImpl implements ActivityConfigService {
|
|||||||
, ActivityConfig.class);
|
, ActivityConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivityConfig getOngoingActivityConf(Long templateId, String activityType) {
|
||||||
|
Date now = TimestampUtils.now();
|
||||||
|
Criteria criteria = Criteria.where("showcase").is(true);
|
||||||
|
criteria.and("templateId").is(templateId);
|
||||||
|
criteria.and("activityType").is(activityType);
|
||||||
|
criteria.and("startTime").lte(now);
|
||||||
|
criteria.and("endTime").gte(now);
|
||||||
|
|
||||||
|
return mongoTemplate.findOne(Query.query(criteria)
|
||||||
|
.with(Sort.by(Sort.Order.desc("id")))
|
||||||
|
.limit(1)
|
||||||
|
, ActivityConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ActivityConfig> listRecentlyEndedActivities(String sysOrigin, Integer limit) {
|
public List<ActivityConfig> listRecentlyEndedActivities(String sysOrigin, Integer limit) {
|
||||||
Date now = TimestampUtils.now();
|
Date now = TimestampUtils.now();
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import com.red.circle.other.domain.ranking.RankingActivityType;
|
|||||||
import com.red.circle.other.domain.ranking.RankingCycleType;
|
import com.red.circle.other.domain.ranking.RankingCycleType;
|
||||||
import com.red.circle.other.domain.ranking.RankingDimension;
|
import com.red.circle.other.domain.ranking.RankingDimension;
|
||||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||||
|
import com.red.circle.other.infra.database.mongo.entity.sys.ActivityConfig;
|
||||||
|
import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
||||||
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
||||||
import com.red.circle.other.inner.model.cmd.user.ApprovalAccountCmd;
|
import com.red.circle.other.inner.model.cmd.user.ApprovalAccountCmd;
|
||||||
@ -61,6 +63,16 @@ public class SpringTest {
|
|||||||
private AppUserDataViolationService userDataViolationService;
|
private AppUserDataViolationService userDataViolationService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RankingActivityService rankingActivityService;
|
private RankingActivityService rankingActivityService;
|
||||||
|
@Autowired
|
||||||
|
private ActivityConfigService activityConfigService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
ActivityConfig ongoingActivityConf = activityConfigService.getOngoingActivityConf(1994334094730010626L, RankingActivityType.GREEDY_GAME.name());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGame() {
|
public void testGame() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user