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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations