| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.td.boss;
- import cn.hutool.core.date.DateField;
- import cn.hutool.core.date.DateUtil;
- import cn.hutool.json.JSONUtil;
- import com.td.boss.common.pojo.Result;
- import com.td.boss.game.comcnttosnb.service.ComCntToSnbService;
- import com.td.boss.game.complayerland.pojo.ComPlayerDisasterLog;
- import com.td.boss.game.complayerland.service.ComPlayerDisasterLogService;
- import com.td.boss.game.complayerland.service.ComPlayerDisasterProtectedService;
- import com.td.boss.game.complayerland.vo.ComPlayerDisasterEnum;
- import com.td.boss.game.complayerland.vo.ComPlayerDisasterProtectedVo;
- import org.junit.jupiter.api.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.junit4.SpringRunner;
- import java.util.Date;
- import java.util.List;
- @RunWith(SpringRunner.class)
- @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
- class ComPlayerDisasterLogTests {
- @Autowired
- private ComPlayerDisasterLogService comPlayerDisasterLogService;
- @Autowired
- private ComPlayerDisasterProtectedService comPlayerDisasterProtectedService;
- @Autowired
- private ComCntToSnbService comCntToSnbService;
- private String userId = "4";
- /**
- * 防护灾难
- */
- @Test
- void playerAddProtected() {
- comPlayerDisasterProtectedService.append(userId,ComPlayerDisasterEnum.ziran,30);
- comPlayerDisasterProtectedService.append(userId,ComPlayerDisasterEnum.yeshou,30);
- comPlayerDisasterProtectedService.append("1003",ComPlayerDisasterEnum.ziran,30);
- comPlayerDisasterProtectedService.append("1003",ComPlayerDisasterEnum.yeshou,30);
- }
- /**
- * 获取灾难经历
- */
- @Test
- void getHistory() {
- List<ComPlayerDisasterLog> history = comPlayerDisasterLogService.getHistory(userId);
- System.out.println(history);
- }
- /**
- * 测试灾难模式
- */
- @Test
- void ComPlayerDisasterWeekTask() {
- comPlayerDisasterLogService.asyncDisaster(userId);
- }
- @Test
- void ComPlayerDisasterDayTask() {
- for (ComPlayerDisasterLog disasterLog : comPlayerDisasterLogService.getTodayDisasterUnEnabledList()) {
- comPlayerDisasterLogService.ComPlayerDisasterDayTask(disasterLog);
- }
- }
- /**
- * 获取userid snb领取情况,如果不在特定的列表,data为null
- */
- @Test
- void getCntToSnb() {
- // 情况一,在名单中
- String json = JSONUtil.toJsonStr(Result.of(comCntToSnbService.findByUserId("952")));
- System.out.println(json);
- // 情况二,不在名单中
- String json2 = JSONUtil.toJsonStr(Result.of(comCntToSnbService.findByUserId("13")));
- System.out.println(json2);
- }
- /**
- * userid领取snb
- */
- @Test
- void receiveCntToSnb() {
- // Date begin = DateUtil.parse("2022-03-01");
- // Date end = DateUtil.parse("2022-03-05");
- //
- // Integer day = Convert.toInt(DateUtil.betweenDay(begin, end, true));
- // System.out.println(DateUtil.format(begin, "yyyy-MM-dd") + " 至 " + DateUtil.format(end, "yyyy-MM-dd") + "相差:" + day + "天");
- String json = JSONUtil.toJsonStr(comCntToSnbService.receiveByUserId("13"));
- System.out.println(json);
- }
- }
|