nili 1 week ago
parent
commit
e45630aa2f
  1. 21
      game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java

21
game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java

@ -27,7 +27,6 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static awesome.group.game.service.util.Constants.SUPER_ADMIN; import static awesome.group.game.service.util.Constants.SUPER_ADMIN;
import static java.util.concurrent.ThreadLocalRandom.current;
@Service @Service
public class SuperAdminService { public class SuperAdminService {
@ -182,8 +181,8 @@ public class SuperAdminService {
public void mockDay(int date, String appCode) { public void mockDay(int date, String appCode) {
MatrixApp app = appMapper.queryByCode(appCode); MatrixApp app = appMapper.queryByCode(appCode);
long beginTime = 32400_000L + current().nextInt(0, 7200000);//9点到11点之间随机 long beginTime = 32400_000L + ThreadLocalRandom.current().nextInt(0, 7200_000);//9点到11点之间随机
beginTime += DateUtil.date2Long(date) + beginTime; beginTime = DateUtil.date2Long(date) + beginTime;
int total = ThreadLocalRandom.current().nextInt(1000_000_00, 1500_000_00); int total = ThreadLocalRandom.current().nextInt(1000_000_00, 1500_000_00);
int current = 0; int current = 0;
List<Integer> userIds = innerUserMapper.queryByAppId(app.getId()); List<Integer> userIds = innerUserMapper.queryByAppId(app.getId());
@ -205,7 +204,17 @@ public class SuperAdminService {
return; return;
} }
while (current < total) { while (current < total) {
int ecpm = 3000_00 + ThreadLocalRandom.current().nextInt(3000_00); int random = ThreadLocalRandom.current().nextInt(0, 14);
int advType = Constants.BANNER;
long ecpm = ThreadLocalRandom.current().nextInt(300, 600);
if (random > 12) {
advType = Constants.VIDEO;
ecpm = ThreadLocalRandom.current().nextInt(3000_00, 6000_00);
} else if (random > 9) {
advType = Constants.POP_UP;
ecpm = ThreadLocalRandom.current().nextInt(800, 1200);
}
current += ecpm; current += ecpm;
MatrixUser u = users.get(ThreadLocalRandom.current().nextInt(0, users.size())); MatrixUser u = users.get(ThreadLocalRandom.current().nextInt(0, users.size()));
MatrixAdvRecord record = map.get(u.getId()); MatrixAdvRecord record = map.get(u.getId());
@ -214,8 +223,8 @@ public class SuperAdminService {
newRecord.setAppId(app.getId()); newRecord.setAppId(app.getId());
newRecord.setAdvId(null); newRecord.setAdvId(null);
newRecord.setPlatform(2); newRecord.setPlatform(2);
newRecord.setAdvType(Constants.VIDEO); newRecord.setAdvType(advType);
newRecord.setEcpm((long) ecpm); newRecord.setEcpm(ecpm);
AppNormalConfig config = AppNormalConfig.getConfig(app); AppNormalConfig config = AppNormalConfig.getConfig(app);
long ecpmReal = config.getEcpmReal(ecpm, u); long ecpmReal = config.getEcpmReal(ecpm, u);
newRecord.setEcpmReal(ecpmReal); newRecord.setEcpmReal(ecpmReal);

Loading…
Cancel
Save