use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameClubService method isHasClub.
/**
* 是否有此俱乐部
*
* @param msgKey
* @param userId
* @param clubId
* @return
*/
public int isHasClub(KafkaMsgKey msgKey, long userId, String clubId) {
Map<String, Object> result = new HashMap<>();
result.put("isHas", ClubManager.getInstance().getClubMap().containsKey(clubId));
sendMsg(msgKey, new ResponseVo("clubService", "isHasClub", result));
return 0;
}
use of com.code.server.constant.response.ResponseVo 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;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameClubService method agree.
/**
* 同意加入俱乐部
*
* @param msgKey
* @param userId
* @param clubId
* @param agreeId
* @param isAgree
* @return
*/
public int agree(KafkaMsgKey msgKey, long userId, String clubId, long agreeId, boolean isAgree) {
Club club = ClubManager.getInstance().getClubById(clubId);
if (club == null) {
return ErrorCode.CLUB_NO_THIS;
}
if (club.getPresident() != userId) {
return ErrorCode.CLUB_NOT_PRESIDENT;
}
if (ClubManager.getInstance().getUserClubNum(agreeId) >= JOIN_LIMIT) {
return ErrorCode.CLUB_CANNOT_JOIN;
}
// 加入俱乐部
ClubMember apply = getApply(club, agreeId);
if (isAgree) {
if (apply != null) {
clubAddMember(club, apply);
}
String name = apply == null ? "" : apply.getName();
}
// 删除申请列表
// removeUserFromApplyList(club, agreeId);
club.getClubInfo().getApplyList().remove(apply);
sendMsg(msgKey, new ResponseVo("clubService", "agree", "ok"));
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method giveOtherMoney.
/**
* 给人充钱
*
* @param msgKey
* @param rechargeUserId 充值玩家ID
* @param money 充值数量
* @return
*/
public int giveOtherMoney(KafkaMsgKey msgKey, Long rechargeUserId, double money) {
// 充值玩家id
Long userid = msgKey.getUserId();
UserBean userBeanOwn = userRedisService.getUserBean(userid);
if (userBeanOwn == null) {
return ErrorCode.YOU_HAVE_NOT_LOGIN;
}
// 充值玩家钱数
double userMoney = userRedisService.getUserMoney(userid);
// 被充值玩家余额
double rechargeUserMoney = userRedisService.getUserMoney(rechargeUserId);
// 被充值玩家对象
UserBean userBean = userRedisService.getUserBean(rechargeUserId);
if (userMoney - money >= 0 && money > 0) {
if (userBean != null) {
userRedisService.addUserMoney(rechargeUserId, money);
// 减掉充值玩家相应的钱数
userRedisService.addUserMoney(userid, -money);
Map<String, Object> results = new HashMap<String, Object>();
results.put("result", "success");
ResponseVo vo = new ResponseVo("userService", "giveOtherMoney", results);
sendMsg(msgKey, vo);
} else {
User accepter = userService.getUserByUserId(rechargeUserId);
if (accepter == null) {
ResponseVo vo = new ResponseVo("userService", "giveOtherMoney", ErrorCode.NOT_HAVE_THIS_ACCEPTER);
sendMsg(msgKey, vo);
} else {
accepter.setMoney(accepter.getMoney() + money);
userService.save(accepter);
// 减掉充值玩家相应的钱数
userRedisService.setUserMoney(userid, userMoney - money);
Map<String, Object> results = new HashMap<String, Object>();
results.put("result", "success");
ResponseVo vo = new ResponseVo("userService", "giveOtherMoney", results);
sendMsg(msgKey, vo);
}
}
} else {
return ErrorCode.NOT_HAVE_MORE_MONEY;
}
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method reportingCoord.
public int reportingCoord(KafkaMsgKey msgKey, String coord) {
long userId = msgKey.getUserId();
UserBean userBean = RedisManager.getUserRedisService().getUserBean(userId);
if (userBean != null) {
userBean.setCoord(coord);
RedisManager.getUserRedisService().setUserBean(userBean);
}
sendMsg(msgKey, new ResponseVo("userService", "reportingCoord", 0));
return 0;
}
Aggregations