yujian
2019-01-29 591b4fc369befea2b0a290cb848d48c71064573c
已存在邀请码验证
2个文件已修改
83 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -1889,43 +1889,42 @@
     */
    @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
    public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
        try {
            long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
            long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
        long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
        long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
            long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
            long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
            JSONObject bossData = new JSONObject();
            ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
            if (threeSale != null) {
                UserInfo boss = threeSale.getBoss();
                if (boss != null) {
                    bossData.put("nickName", boss.getNickName());
                    bossData.put("portrait", boss.getPortrait());
                }
        long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
        long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
        JSONObject bossData = new JSONObject();
        ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
        if (threeSale != null) {
            UserInfo boss = threeSale.getBoss();
            if (boss != null) {
                bossData.put("nickName", boss.getNickName());
                bossData.put("portrait", boss.getPortrait());
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
                Long createTime = threeSale.getCreateTime();
                Date inviteTime = new Date(createTime);
                bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
            }
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
            Long createTime = threeSale.getCreateTime();
            Date inviteTime = new Date(createTime);
            bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime));
        }
            JSONObject resultData = new JSONObject();
        JSONObject resultData = new JSONObject();
        String helpLink = configService.get("team_help_url");
        if (helpLink == null) {
            helpLink = "";
        }
        resultData.put("helpLink", helpLink);
        resultData.put("firstTeam", firstTeam);
        resultData.put("firstTeamTotal", firstTeamTotal);
        resultData.put("secondTeam", secondTeam);
        resultData.put("secondTeamTotal", secondTeamTotal);
        resultData.put("boss", bossData);
        boolean hasCode = false;
        try {
            String helpLink = configService.get("team_help_url");
            if (helpLink == null) {
                helpLink = "";
            }
            resultData.put("helpLink", helpLink);
            resultData.put("firstTeam", firstTeam);
            resultData.put("firstTeamTotal", firstTeamTotal);
            resultData.put("secondTeam", secondTeam);
            resultData.put("secondTeamTotal", secondTeamTotal);
            resultData.put("boss", bossData);
            boolean hasCode = false;
            String inviteCode = userInfoExtraService.getUserInviteCode(uid);
            if (inviteCode != null && inviteCode.trim().length() > 0) {
                hasCode = true;    // 已有邀请码
@@ -1933,12 +1932,17 @@
                // 邀请激活链接
                resultData.put("activationlink", configService.get("invite_activation_url"));
            }
            resultData.put("hasCode", hasCode);
            out.print(JsonUtil.loadTrueResult(resultData));
        } catch (UserInfoExtraException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
        }
        resultData.put("hasCode", hasCode);
        out.print(JsonUtil.loadTrueResult(resultData));
    }
    /**
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -11,7 +11,6 @@
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper;
import com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper;
@@ -294,6 +293,14 @@
            throw new UserInfoExtraException(1, "用户id、邀请码不能为空");
        }
        
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
            String inviteCodeHas = extra.getInviteCode();
            if (inviteCodeHas != null && inviteCodeHas.trim().length() > 0) {
                throw new UserInfoExtraException(1, "已存在邀请码,请刷新页面");
            }
        }
        // 被邀请人信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {