Search in sources :

Example 6 with RoomModel

use of com.code.server.constant.club.RoomModel in project summer by foxsugar.

the class CenterMsgService method genRoomRecord.

private static void genRoomRecord(String msg) {
    RoomRecord roomRecord = JsonUtil.readValue(msg, RoomRecord.class);
    List<com.code.server.constant.game.UserRecord> lists = roomRecord.getRecords();
    for (com.code.server.constant.game.UserRecord userRecord : lists) {
        UserRecord addRecord = userRecordService.getUserRecordByUserId(userRecord.getUserId());
        if (addRecord != null) {
            userRecordService.addRecord(userRecord.getUserId(), roomRecord);
        } else {
            Record record = new Record();
            record.addRoomRecord(roomRecord);
            UserRecord newRecord = new UserRecord();
            newRecord.setId(userRecord.getUserId());
            newRecord.setRecord(record);
            userRecordService.save(newRecord);
        }
    }
    // 俱乐部战绩
    String clubId = roomRecord.getClubId();
    if (clubId != null && !"".equals(clubId)) {
        Club club = ClubManager.getInstance().getClubById(clubId);
        if (club != null) {
            String roomModel = roomRecord.getClubRoomModel();
            RoomModel rm = GameClubService.getRoomModel(club, roomModel);
            roomRecord.setName(rm.getDesc());
        }
        clubRecordService.addRecord(clubId, roomRecord);
    }
}
Also used : RoomRecord(com.code.server.constant.game.RoomRecord) RoomRecord(com.code.server.constant.game.RoomRecord) Record(com.code.server.constant.game.Record) RoomModel(com.code.server.constant.club.RoomModel)

Example 7 with RoomModel

use of com.code.server.constant.club.RoomModel in project summer by foxsugar.

the class GameClubService method removeRoomModel.

/**
 * 删除房间模式
 *
 * @param msgKey
 * @param userId
 * @param clubId
 * @param roomModelId
 * @return
 */
public int removeRoomModel(KafkaMsgKey msgKey, long userId, String clubId, String roomModelId) {
    Club club = ClubManager.getInstance().getClubById(clubId);
    if (club == null) {
        return ErrorCode.CLUB_NO_THIS;
    }
    if (club.getPresident() != userId) {
        return ErrorCode.CLUB_NOT_PRESIDENT;
    }
    RoomModel roomModel = getRoomModel(club, roomModelId);
    if (roomModel != null) {
        club.getClubInfo().getRoomModels().remove(roomModel);
    }
    // todo 退钱
    sendMsg(msgKey, new ResponseVo("clubService", "removeRoomModel", "ok"));
    return 0;
}
Also used : Club(com.code.server.db.model.Club) RoomModel(com.code.server.constant.club.RoomModel) ResponseVo(com.code.server.constant.response.ResponseVo)

Aggregations

RoomModel (com.code.server.constant.club.RoomModel)7 Club (com.code.server.db.model.Club)5 ResponseVo (com.code.server.constant.response.ResponseVo)3 ClubStatistics (com.code.server.constant.club.ClubStatistics)2 StaticDataProto (com.code.server.constant.data.StaticDataProto)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 RoomInstance (com.code.server.constant.club.RoomInstance)1 Record (com.code.server.constant.game.Record)1 RoomRecord (com.code.server.constant.game.RoomRecord)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1