use of com.code.server.constant.club.ClubStatistics in project summer by foxsugar.
the class GameClubService method clubDrawBack.
/**
* 俱乐部房间退钱
*
* @param clubId
* @param clubModelId
*/
public int clubDrawBack(String clubId, String clubModelId) {
Club club = ClubManager.getInstance().getClubById(clubId);
if (club != null) {
RoomModel roomModel = getRoomModel(club, clubModelId);
if (roomModel != null) {
int money = roomModel.getMoney();
synchronized (club.lock) {
club.setMoney(club.getMoney() + money);
// 统计减去消耗
String today = LocalDate.now().toString();
ClubStatistics clubStatistics = roomModel.getStatisticsMap().get(today);
if (clubStatistics != null) {
clubStatistics.setConsumeNum(clubStatistics.getConsumeNum() - roomModel.getMoney());
}
}
}
}
return 0;
}
use of com.code.server.constant.club.ClubStatistics in project summer by foxsugar.
the class GameClubService method cludGameStart.
/**
* 俱乐部游戏开始
*
* @param clubId
* @param clubModelId
* @return
*/
public int cludGameStart(String clubId, String clubModelId) {
Club club = ClubManager.getInstance().getClubById(clubId);
if (club != null) {
synchronized (club.lock) {
// 删除一个房间
club.getClubInfo().getRoomInstance().remove(clubModelId);
// 统计
RoomModel roomModel = getRoomModel(club, clubModelId);
if (roomModel != null) {
String today = LocalDate.now().toString();
ClubStatistics clubStatistics = roomModel.getStatisticsMap().get(today);
if (clubStatistics == null) {
clubStatistics = new ClubStatistics();
}
clubStatistics.setOpenNum(clubStatistics.getOpenNum() + 1);
clubStatistics.setConsumeNum(clubStatistics.getConsumeNum() + roomModel.getMoney());
roomModel.getStatisticsMap().put(today, clubStatistics);
// 删除七天前的
roomModel.getStatisticsMap().remove(LocalDate.now().minusDays(7).toString());
}
}
initRoomInstance(club);
}
return 0;
}
Aggregations