Search in sources :

Example 1 with UserRecord

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

the class GameUserService method getUserRecodeByUserId.

/**
 * 查询战绩
 *
 * @param msgKey
 * @return
 */
public int getUserRecodeByUserId(KafkaMsgKey msgKey, String roomType) {
    UserRecord userRecord = userRecordService.getUserRecordByUserId(msgKey.getUserId());
    List<RoomRecord> roomRecordList = new ArrayList<>();
    if (userRecord != null && userRecord.getRecord() != null && userRecord.getRecord().getRoomRecords().containsKey(roomType)) {
        roomRecordList.addAll(userRecord.getRecord().getRoomRecords().get(roomType));
    }
    ResponseVo vo = new ResponseVo("userService", "getUserRecodeByUserId", roomRecordList);
    sendMsg(msgKey, vo);
    return 0;
}
Also used : UserRecord(com.code.server.db.model.UserRecord) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 2 with UserRecord

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

the class UserRecordService method addRecord.

/**
 * 添加一条战绩 超过指定条数后删除第一条
 * @param userid
 * @param roomRecord
 * @return
 */
public UserRecord addRecord(long userid, RoomRecord roomRecord) {
    UserRecord userRecords = userRecordDao.findOne(userid);
    RoomRecord rc = userRecords.getRecord().addRoomRecord(roomRecord);
    // 有删除的战绩
    if (rc != null) {
        long roomUid = rc.getId();
        gameRecordService.decGameRecordCount(roomUid);
    }
    return userRecordDao.save(userRecords);
}
Also used : UserRecord(com.code.server.db.model.UserRecord) RoomRecord(com.code.server.constant.game.RoomRecord)

Aggregations

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