liujie
3 天以前 dd556df997e268153bf1a74616f49b25db11ed3f
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -81,9 +81,6 @@
    private UserIntegralChangesClient userIntegralChangesClient;
    /**
     * 裁判获取世界杯列表数据
     * @return
@@ -131,18 +128,43 @@
            return ResultUtil.error("赛事已取消");
        }
        //1、通过扫码获取的sutuid查询t_game表中的红蓝方sutuid
        // 智慧需要判断code
        String code = startWorldCup.getCode();
        JSONObject object = JSON.parseObject(code);
        String sutu_id = object.getString("sutu_id");
        TGame tGame = gameClient.getTGameBySutuId(sutu_id);
        if (worldCup.getType() == null || worldCup.getType() == 1) {
        if(null == tGame){
            return ResultUtil.error("无效的游戏二维码");
            }
        }
        String people = startWorldCup.getPeople();
        JSONArray jsonArray = JSON.parseArray(people);
        if(jsonArray.size() != 6){
            return ResultUtil.error("参赛人数只能是6人");
        int red=0;
        int blue=0;
        for (Object o : jsonArray) {
            JSONObject jsonObject = JSONObject.parseObject(o.toString());
            String type = jsonObject.get("type").toString();
            if("red".equals( type)){
                red++;
            }
            if("blue".equals( type)){
                blue++;
            }
        }
        if(red==0){
            return ResultUtil.error("红方最少要1人参赛");
        }
        if(red>5){
            return ResultUtil.error("红方最多5人参赛");
        }
        if(blue==0){
            return ResultUtil.error("蓝方最少要1人参赛");
        }
        if(blue>5){
            return ResultUtil.error("蓝方最多5人参赛");
        }
        String timeStr = UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3);
        List<Long> ids = new ArrayList<>();
@@ -183,10 +205,13 @@
        worldCup.setMatchNumber(worldCup.getMatchNumber() + 1);
        this.updateById(worldCup);
        //2、调起开启游戏的接口。
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("gameType", 1);
        jsonObject.put("ids", ids);
        //2、调起开启游戏的接口。
        if (worldCup.getType() == null || worldCup.getType() == 1) {
        HashMap<String, String> map = new HashMap<>();
        map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B");
        map.put("space_id", tGame.getSiteId() + "");
@@ -200,9 +225,12 @@
        Integer code1 = jsonObject1.getInteger("code");
        String message = jsonObject1.getString("message");
        if (200 == code1) {
            return ResultUtil.success();
                return ResultUtil.success(jsonObject.toJSONString());
        } else {
            return ResultUtil.error(message);
            }
        }else {
            return ResultUtil.success(jsonObject.toJSONString());
        }
    }
@@ -415,9 +443,6 @@
    }
    /**
     * 报名世界杯
     * @param paymentWorldCup
@@ -564,7 +589,6 @@
                                ,"/base/worldCup/wxPayWorldCupCallback1",worldCupPayment.getAmount().toString());
                    }
                }
            }