Search in sources :

Example 61 with ResponseVo

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);
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 62 with ResponseVo

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;
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 63 with ResponseVo

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);
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 64 with ResponseVo

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";
}
Also used : User(com.code.server.db.model.User) UserBean(com.code.server.constant.game.UserBean) HashMap(java.util.HashMap) Charge(com.code.server.db.model.Charge) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ResponseVo(com.code.server.constant.response.ResponseVo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 65 with ResponseVo

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";
}
Also used : User(com.code.server.db.model.User) UserBean(com.code.server.constant.game.UserBean) HashMap(java.util.HashMap) Charge(com.code.server.db.model.Charge) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ResponseVo(com.code.server.constant.response.ResponseVo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

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