Browse Source

算数据接口

master
nili 4 months ago
parent
commit
636455685d
  1. 11
      game-service/src/main/java/awesome/group/game/service/AdminService.java
  2. 8
      game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java

11
game-service/src/main/java/awesome/group/game/service/AdminService.java

@ -156,6 +156,7 @@ public class AdminService {
List<MatrixApp> appList = appList(adminId); List<MatrixApp> appList = appList(adminId);
return appList.stream().map(MatrixAppBo::new).toList(); return appList.stream().map(MatrixAppBo::new).toList();
} }
public List<MatrixApp> appList(Integer adminId) { public List<MatrixApp> appList(Integer adminId) {
List<Integer> appIds = getAdminAppIds(adminId); List<Integer> appIds = getAdminAppIds(adminId);
if (CollectionUtils.isEmpty(appIds)) { if (CollectionUtils.isEmpty(appIds)) {
@ -438,6 +439,16 @@ public class AdminService {
calcAppIncome(); calcAppIncome();
} }
@Async
public void mock(int targetStartDate, int targetEndDate) {
int date = targetStartDate;
while (date <= targetEndDate) {
calcTargetDate(date);
date = DateUtil.datePlus(date, 1);
}
calcAppIncome();
}
public void calcTargetDate(int targetDate) { public void calcTargetDate(int targetDate) {
long dateBegin = DateUtil.getDayBeginTimestamp(DateUtil.date2Long(targetDate)); long dateBegin = DateUtil.getDayBeginTimestamp(DateUtil.date2Long(targetDate));
long dateEnd = dateBegin + 86400_000 - 1; long dateEnd = dateBegin + 86400_000 - 1;

8
game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java

@ -106,7 +106,7 @@ public class AdminController {
@PostMapping("/addWhiteList") @PostMapping("/addWhiteList")
@RestApi @RestApi
public R<Void> addWhiteList(@RequestParam String deviceId, @RequestParam String channel){ public R<Void> addWhiteList(@RequestParam String deviceId, @RequestParam String channel) {
adminService.addWhiteList(deviceId, channel); adminService.addWhiteList(deviceId, channel);
return new R<>(R.CODE_SUCCESS, "ok", null); return new R<>(R.CODE_SUCCESS, "ok", null);
} }
@ -145,6 +145,12 @@ public class AdminController {
@RestApi @RestApi
public R<STSInfo> getSTS() { public R<STSInfo> getSTS() {
return new R<>(ossService.getSTS(RequestContext.getAdminID())); return new R<>(ossService.getSTS(RequestContext.getAdminID()));
}
@GetMapping("/mock")
@RestApi
public R<Void> mock(@RequestParam Integer start, @RequestParam Integer end) {
adminService.mock(start, end);
return new R<>(R.CODE_SUCCESS, "ok", null);
} }
} }

Loading…
Cancel
Save