Search in sources :

Example 41 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameClubService method kickUser.

public int kickUser(KafkaMsgKey msgKey, long userId, String clubId, long kickUser) {
    Club club = ClubManager.getInstance().getClubById(clubId);
    if (club == null) {
        return ErrorCode.CLUB_NO_THIS;
    }
    if (club.getPresident() != userId) {
        return ErrorCode.CLUB_NOT_PRESIDENT;
    }
    clubRemoveMember(club, kickUser);
    sendMsg(msgKey, new ResponseVo("clubService", "kickUser", "ok"));
    return 0;
}
Also used : Club(com.code.server.db.model.Club) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 42 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameUserService method guessCarBindReferrer.

public int guessCarBindReferrer(KafkaMsgKey msgKey, int referrerId) {
    UserBean userBean = RedisManager.getUserRedisService().getUserBean(msgKey.getUserId());
    if (userBean == null) {
        return ErrorCode.YOU_HAVE_NOT_LOGIN;
    }
    if (referrerId <= 0 || userBean.getReferee() != 0) {
        return ErrorCode.CAN_NOT_BING_REFERRER;
    }
    if (referrerId == msgKey.getUserId()) {
        return ErrorCode.CAN_NOT_BING_REFERRER;
    }
    // boolean isExist = RpcManager.getInstance().referrerIsExist(referrerId);
    // if (!isExist) {
    // return ErrorCode.REFERRER_NOT_EXIST;
    // }
    UserBean referrUser = RedisManager.getUserRedisService().getUserBean(referrerId);
    if (referrUser != null) {
        if (referrUser.getVip() == 0) {
            return ErrorCode.REFERRER_NOT_EXIST;
        }
    } else {
        User user = userService.getUserByUserId(referrerId);
        if (user == null || user.getVip() == 0)
            return ErrorCode.REFERRER_NOT_EXIST;
    }
    userBean.setReferee(referrerId);
    RedisManager.getUserRedisService().updateUserBean(userBean.getId(), userBean);
    ResponseVo vo = new ResponseVo("userService", "guessCarBind", 0);
    sendMsg(msgKey, vo);
    return 0;
}
Also used : User(com.code.server.db.model.User) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 43 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameUserService method getRecordsByRoom.

public int getRecordsByRoom(KafkaMsgKey msgKey, long roomUid) {
    List<com.code.server.db.model.GameRecord> list = gameRecordService.gameRecordDao.getGameRecordByUuid(roomUid);
    Map<Object, Object> result = new HashMap<>();
    result.put("result", list);
    ResponseVo vo = new ResponseVo("userService", "getRecordsByRoom", result);
    sendMsg(msgKey, vo);
    return 0;
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 44 with ResponseVo

use of com.code.server.constant.response.ResponseVo 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 45 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameUserService method bindReferrer.

// 
// public int getRecord(Player player,int type) {
// User user = player.getUser();
// user.getRecord().getRoomRecords().get(type);
// 
// 
// return 0;
// }
// 
// 
public int bindReferrer(KafkaMsgKey msgKey, int referrerId) {
    UserBean userBean = RedisManager.getUserRedisService().getUserBean(msgKey.getUserId());
    if (userBean == null) {
        return ErrorCode.YOU_HAVE_NOT_LOGIN;
    }
    if (referrerId <= 0 || userBean.getReferee() != 0) {
        return ErrorCode.CAN_NOT_BING_REFERRER;
    }
    boolean isExist = RpcManager.getInstance().referrerIsExist(referrerId);
    if (!isExist) {
        return ErrorCode.REFERRER_NOT_EXIST;
    }
    double money = 100;
    userBean.setReferee(referrerId);
    RedisManager.getUserRedisService().updateUserBean(userBean.getId(), userBean);
    RedisManager.getUserRedisService().addUserMoney(msgKey.getUserId(), money);
    ResponseVo vo = new ResponseVo("userService", "bindReferrer", 0);
    sendMsg(msgKey, vo);
    // 充值记录
    Charge charge = new Charge();
    charge.setRecharge_source("" + IChargeType.BIND_REFERRER);
    charge.setUserid(userBean.getId());
    charge.setUsername(userBean.getUsername());
    charge.setStatus(1);
    charge.setCreatetime(new Date());
    charge.setMoney_point(money);
    charge.setMoney(money);
    charge.setOrderId("" + IdWorker.getDefaultInstance().nextId());
    SpringUtil.getBean(ChargeService.class).save(charge);
    return 0;
}
Also used : Charge(com.code.server.db.model.Charge) ResponseVo(com.code.server.constant.response.ResponseVo)

Aggregations

ResponseVo (com.code.server.constant.response.ResponseVo)125 Club (com.code.server.db.model.Club)17 HashMap (java.util.HashMap)15 UserBean (com.code.server.constant.game.UserBean)8 IdWorker (com.code.server.util.IdWorker)8 ServerConfig (com.code.server.game.poker.config.ServerConfig)7 ArrayList (java.util.ArrayList)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 ClubMember (com.code.server.constant.club.ClubMember)5 Charge (com.code.server.db.model.Charge)5 User (com.code.server.db.model.User)5 GameOfResult (com.code.server.constant.response.GameOfResult)4 UserOfResult (com.code.server.constant.response.UserOfResult)4 TimerNode (com.code.server.util.timer.TimerNode)4 RoomModel (com.code.server.constant.club.RoomModel)3 KafkaMsgKey (com.code.server.constant.kafka.KafkaMsgKey)3 com.code.server.game.mahjong.response (com.code.server.game.mahjong.response)3 MsgSender (com.code.server.game.room.kafka.MsgSender)3 MsgProducer (com.code.server.kafka.MsgProducer)3 Map (java.util.Map)3