use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameInfoHasChi method pushAllPass.
private void pushAllPass() {
Map map = new HashMap();
map.put("isAllPass", true);
map.put("lastPlayUser", lastPlayUserId);
ResponseVo responseVo = new ResponseVo(ResponseType.SERVICE_TYPE_GAMELOGIC, ResponseType.METHOD_TYPE_ALL_PASS, map);
MsgSender.sendMsg2Player(responseVo, users);
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameInfoHasChi method ting.
/**
* 听
*
* @param userId
* @param card
* @return
*/
public int ting(long userId, String card) {
if (isAlreadyHu) {
return ErrorCode.CAN_NOT_TING;
}
PlayerCardsInfoMj playerCardsInfo = playerCardsInfos.get(userId);
if (playerCardsInfo == null) {
return ErrorCode.USER_ERROR;
}
OperateReqResp operateReqResp = new OperateReqResp();
operateReqResp.setOperateType(OperateReqResp.type_ting);
operateReqResp.setUserId(userId);
ResponseVo vo = new ResponseVo(ResponseType.SERVICE_TYPE_GAMELOGIC, ResponseType.METHOD_TYPE_OTHER_OPERATE, operateReqResp);
List<String> temp = new ArrayList<>();
temp.addAll(playerCardsInfo.getCards());
temp.remove(card);
// 不多一张
boolean isCan = playerCardsInfo.isCanTing(temp);
if (isCan) {
// 听
playerCardsInfo.ting(card);
// 通知其他玩家听
MsgSender.sendMsg2Player(vo, users);
// 通知其他玩家出牌信息
// PlayCardResp playCardResp = new PlayCardResp();
// playCardResp.setUserId(userId);
// playCardResp.setCard(card);
//
// ResponseVo chupaiVo = new ResponseVo(ResponseType.SERVICE_TYPE_GAMELOGIC, ResponseType.METHOD_TYPE_PLAY_CARD, playCardResp);
// MsgSender.sendMsg2Player(chupaiVo.toJsonObject(), users);
// 出牌
chuPai_ting(playerCardsInfo.getUserId(), card);
} else {
return ErrorCode.CAN_NOT_TING;
}
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameInfoHasChi method doPeng.
protected void doPeng(PlayerCardsInfoMj playerCardsInfo, long userId) {
playerCardsInfo.peng(disCard, lastPlayUserId);
lastOperateUserId = userId;
// 删除弃牌
deleteDisCard(lastPlayUserId, disCard);
// 通知其他玩家
OperateReqResp operateReqResp = new OperateReqResp();
operateReqResp.setOperateType(OperateReqResp.type_peng);
operateReqResp.setCard(disCard);
operateReqResp.setFromUserId(lastPlayUserId);
operateReqResp.setUserId(userId);
// 通知其他人
ResponseVo vo = new ResponseVo(ResponseType.SERVICE_TYPE_GAMELOGIC, ResponseType.METHOD_TYPE_OTHER_OPERATE, operateReqResp);
MsgSender.sendMsg2Player(vo, users);
// 碰完能听,杠,不能胡
// 多一张牌
boolean isCanTing = playerCardsInfo.isCanTing(playerCardsInfo.cards);
boolean isCanGang = playerCardsInfo.isHasGang();
turnId = userId;
// 通知客户端 操作
OperateResp operateResp = new OperateResp();
operateResp.setIsCanTing(isCanTing);
operateResp.setIsCanGang(isCanGang);
ResponseVo operateVo = new ResponseVo(ResponseType.SERVICE_TYPE_GAMELOGIC, ResponseType.METHOD_TYPE_OPERATE, operateResp);
MsgSender.sendMsg2Player(operateVo, userId);
this.disCard = null;
// 自己将能做的处理
playerCardsInfo.canBePeng = false;
playerCardsInfo.canBeTing = isCanTing;
playerCardsInfo.canBeGang = isCanGang;
playerCardsInfo.canBeHu = false;
resetOtherOperate(userId);
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class TestAction method noti.
@RequestMapping("/Pay/notify")
public String noti(HttpServletRequest request) {
String memberid = request.getParameter("memberid");
String orderid = request.getParameter("orderid");
String amount = request.getParameter("amount");
String datetime = request.getParameter("datetime");
String returncode = request.getParameter("returncode");
String reserved1 = request.getParameter("reserved1");
String reserved2 = request.getParameter("reserved2");
String sign = request.getParameter("sign");
String transaction_id = request.getParameter("transaction_id");
String SignTemp = "amount=" + amount + "&datetime=" + datetime + "&memberid=" + memberid + "&orderid=" + orderid + "&transaction_id=" + transaction_id + "&returncode=" + returncode + "&key=" + keyValue + "";
String md5sign = null;
try {
md5sign = md5(SignTemp);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
logger.info("-------------------------------");
logger.info("memberid{}, orderid{}, amount{}, datetime{}, requestcode{}, returncode{}, reserved1{}, reserverd2{}, sign{}, tempSign{}", memberid, orderid, amount, datetime, returncode, sign, SignTemp);
logger.info("-------------------------------");
logger.info("local sign:{}", md5sign);
logger.info("sign:{}", sign);
if (true) {
if (returncode.equals("00")) {
Charge charge = chargeService.getChargeByOrderid(orderid);
if (charge.getStatus() == 1) {
return "success";
}
charge.setStatus(1);
chargeService.save(charge);
logger.info("支付成功!");
UserBean UserBeanRedis = userRedisService.getUserBean(charge.getUserid());
double addMoney = charge.getMoney() * 10;
if (UserBeanRedis != null) {
userRedisService.addUserMoney(charge.getUserid(), addMoney);
} else {
User user = userService.getUserByUserId(charge.getUserid());
System.out.println("修改玩家豆豆");
user.setMoney(user.getMoney() + addMoney);
userService.save(user);
}
System.out.println("通知客户端刷新充值");
Map<String, String> rs = new HashMap<>();
MsgSender.sendMsg2Player(new ResponseVo("userService", "refresh", rs), charge.getUserid());
} else {
logger.info("支付失败");
return "failed";
}
} else {
logger.info("支付失败");
return "failed";
}
return "success";
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class TestAction method callback.
@RequestMapping("/Pay/callback")
public String callback(HttpServletRequest request) {
String memberid = request.getParameter("memberid");
String orderid = request.getParameter("orderid");
String amount = request.getParameter("amount");
String datetime = request.getParameter("datetime");
String returncode = request.getParameter("returncode");
String sign = request.getParameter("sign");
String transaction_id = request.getParameter("transaction_id");
logger.info("{}", transaction_id);
String SignTemp = "amount=" + amount + "&datetime=" + datetime + "&memberid=" + memberid + "&orderid=" + orderid + "&transaction_id=" + transaction_id + "&returncode=" + returncode + "&key=" + keyValue + "";
String md5sign = null;
try {
md5sign = md5(SignTemp);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
logger.info("-------------------------------");
logger.info("memberid{}, orderid{}, amount{}, datetime{}, requestcode{}, returncode{}, reserved1{}, reserverd2{}, sign{}, tempSign{}", memberid, orderid, amount, datetime, returncode, sign, SignTemp);
logger.info("-------------------------------");
logger.info("-local sign:{}", md5sign);
logger.info("-sign:{}", sign);
if (true) {
if (returncode.equals("00")) {
Charge charge = chargeService.getChargeByOrderid(orderid);
if (charge.getStatus() == 1) {
return "success";
}
charge.setStatus(1);
chargeService.save(charge);
logger.info("支付成功!");
UserBean UserBeanRedis = userRedisService.getUserBean(charge.getUserid());
double addMoney = charge.getMoney();
if (UserBeanRedis != null) {
userRedisService.addUserMoney(charge.getUserid(), addMoney);
} else {
User user = userService.getUserByUserId(charge.getUserid());
System.out.println("修改玩家豆豆");
user.setMoney(user.getMoney() + addMoney);
userService.save(user);
}
System.out.println("通知客户端刷新充值");
Map<String, String> rs = new HashMap<>();
MsgSender.sendMsg2Player(new ResponseVo("userService", "refresh", rs), charge.getUserid());
} else {
logger.info("支付失败");
return "failed";
}
} else {
logger.info("支付失败");
return "failed";
}
return "success";
}
Aggregations