Search in sources :

Example 1 with ClubRecord

use of com.code.server.db.model.ClubRecord in project summer by foxsugar.

the class ClubRecordService method addRecord.

public void addRecord(String clubId, RoomRecord roomRecord) {
    ClubRecord clubRecord = clubRecordDao.getClubRecordById(clubId);
    if (clubRecord == null) {
        clubRecord = new ClubRecord();
        clubRecord.setId(clubId);
    }
    List<RoomRecord> rc = clubRecord.getRecords();
    // 有删除的战绩
    if (rc == null) {
        rc = new ArrayList<>();
    // gameRecordService.decGameRecordCount(roomUid);
    } else {
        rc.add(roomRecord);
    }
    // 过长 删除第一个
    if (rc.size() >= 20) {
        rc.remove(0);
    }
    clubRecordDao.save(clubRecord);
// return userRecordDao.save(userRecords);
}
Also used : ClubRecord(com.code.server.db.model.ClubRecord) RoomRecord(com.code.server.constant.game.RoomRecord)

Example 2 with ClubRecord

use of com.code.server.db.model.ClubRecord in project summer by foxsugar.

the class GameClubService method getClubRecord.

/**
 * 获得俱乐部战绩
 *
 * @param msgKey
 * @param userId
 * @param clubId
 * @return
 */
public int getClubRecord(KafkaMsgKey msgKey, long userId, String clubId) {
    Club club = ClubManager.getInstance().getClubById(clubId);
    if (club == null) {
        return ErrorCode.CLUB_NO_THIS;
    }
    if (club.getPresident() != userId) {
        return ErrorCode.CLUB_NOT_PRESIDENT;
    }
    ClubRecord clubRecord = clubRecordService.getClubRecordDao().getClubRecordById(clubId);
    sendMsg(msgKey, new ResponseVo("clubService", "getClubRecord", clubRecord));
    return 0;
}
Also used : Club(com.code.server.db.model.Club) ClubRecord(com.code.server.db.model.ClubRecord) ResponseVo(com.code.server.constant.response.ResponseVo)

Aggregations

ClubRecord (com.code.server.db.model.ClubRecord)2 RoomRecord (com.code.server.constant.game.RoomRecord)1 ResponseVo (com.code.server.constant.response.ResponseVo)1 Club (com.code.server.db.model.Club)1