1
zj
2025-05-20 f1f519b5d186f786f25a987fc870fe9f568ecfcc
src/main/java/project/web/api/UserController.java
@@ -135,30 +135,30 @@
         log.setUsername(username);
         logService.saveAsyn(log);
         JdbcTemplate jdbcTemplate=ApplicationUtil.getBean(JdbcTemplate.class);
         Integer countusdt = jdbcTemplate.queryForObject("SELECT count(USER_NAME) FROM T_PARTY_BLOCKCHAIN WHERE USER_NAME=? AND COIN_SYMBOL='USDT'", Integer.class,party.getUsername());
         logger.info("----------注册地址T_PARTY_BLOCKCHAIN-------"+countusdt);
         if(countusdt == 0){
            logger.info("----------注册地址进来了-------");
            //注册地址trc
            String addresstrc = registerAddress(party.getUsercode(),"trc","1");
            logger.info("----------地址注册方法返回参数------"+addresstrc);
            if (addresstrc == null || "" == addresstrc) {
               logger.info("地址注册失败");
               logger.info("----------地址注册失败-------");
            }else {
               jdbcTemplate.update("INSERT INTO T_PARTY_BLOCKCHAIN(USER_NAME,CHAIN_NAME,COIN_SYMBOL,QR_IMAGE,ADDRESS,AUTO) VALUES(?,?,?,?,?,?)"
                     ,party.getUsername(),"TRC20","USDT","/trc01.png",addresstrc,"Y");
            }
            //          //注册地址erc
            //          String addresserc = registerAddress(party.getUsercode(),"erc","1");
            //          if (addresserc == null || "" == addresserc) {
            //             logger.info("地址注册失败");
            //          }else {
            //             jdbcTemplate.update("INSERT INTO T_PARTY_BLOCKCHAIN(USER_NAME,CHAIN_NAME,COIN_SYMBOL,QR_IMAGE,ADDRESS,AUTO) VALUES(?,?,?,?,?,?)"
            //                   ,party.getUsername(),"ERC20","USDT","/e102.png",addresserc,"Y");
            //          }
         }
//         JdbcTemplate jdbcTemplate=ApplicationUtil.getBean(JdbcTemplate.class);
//         Integer countusdt = jdbcTemplate.queryForObject("SELECT count(USER_NAME) FROM T_PARTY_BLOCKCHAIN WHERE USER_NAME=? AND COIN_SYMBOL='USDT'", Integer.class,party.getUsername());
//         logger.info("----------注册地址T_PARTY_BLOCKCHAIN-------"+countusdt);
//         if(countusdt == 0){
//            logger.info("----------注册地址进来了-------");
//            //注册地址trc
//            String addresstrc = registerAddress(party.getUsercode(),"trc","1");
//            logger.info("----------地址注册方法返回参数------"+addresstrc);
//            if (addresstrc == null || "" == addresstrc) {
//               logger.info("地址注册失败");
//               logger.info("----------地址注册失败-------");
//            }else {
//               jdbcTemplate.update("INSERT INTO T_PARTY_BLOCKCHAIN(USER_NAME,CHAIN_NAME,COIN_SYMBOL,QR_IMAGE,ADDRESS,AUTO) VALUES(?,?,?,?,?,?)"
//                     ,party.getUsername(),"TRC20","USDT","/trc01.png",addresstrc,"Y");
//            }
//            //          //注册地址erc
//            //          String addresserc = registerAddress(party.getUsercode(),"erc","1");
//            //          if (addresserc == null || "" == addresserc) {
//            //             logger.info("地址注册失败");
//            //          }else {
//            //             jdbcTemplate.update("INSERT INTO T_PARTY_BLOCKCHAIN(USER_NAME,CHAIN_NAME,COIN_SYMBOL,QR_IMAGE,ADDRESS,AUTO) VALUES(?,?,?,?,?,?)"
//            //                   ,party.getUsername(),"ERC20","USDT","/e102.png",addresserc,"Y");
//            //          }
//         }
//          Integer counteth = jdbcTemplate.queryForObject("SELECT count(USER_NAME) FROM T_PARTY_BLOCKCHAIN WHERE USER_NAME=? AND COIN_SYMBOL='ETH'", Integer.class,party.getUsername());
//          if(counteth == 0){
//              //注册地址trc
@@ -181,12 +181,10 @@
//                       ,party.getUsername(),"BTC","BTC","/b103.png",addressbtc,"Y");
//              }
//          }
         logger.info("----------地址注册111111-------");
         party.setLogin_ip(this.getIp(getRequest()));
         this.partyService.update(party);
         resultObject.setData(data);
         logger.info("----------地址注册2222222-------");
      } catch (BusinessException e) {
         resultObject.setCode("1");
         resultObject.setMsg(e.getMessage());
@@ -709,51 +707,51 @@
         if (StringUtils.isEmptyString(verifcode_type)) {
            throw new BusinessException("验证类型不能为空");
         }
         if (StringUtils.isEmptyString(verifcode)) {
            throw new BusinessException("验证码不能为空");
         }
//         if (StringUtils.isEmptyString(verifcode)) {
//            throw new BusinessException("验证码不能为空");
//         }
         String loginPartyId = this.getLoginPartyId();
         Party party = this.partyService.cachePartyBy(loginPartyId, false);
         SecUser secUser = this.secUserService.findUserByPartyId(loginPartyId);
         // 根据验证类型获取验证key verifcode_type: 1/手机;2/邮箱;3/谷歌验证器;
         String key = "";
         String errMsg = "";
         if ("1".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone();
            errMsg = "未绑定手机号";
         } else if ("2".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail();
            errMsg = "未绑定邮箱";
         } else if ("3".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret();
            errMsg = "未绑定谷歌验证器";
         }
         if (StringUtils.isEmptyString(key)) {
            throw new BusinessException(errMsg);
         }
//         String key = "";
//         String errMsg = "";
//         if ("1".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone();
//            errMsg = "未绑定手机号";
//         } else if ("2".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail();
//            errMsg = "未绑定邮箱";
//         } else if ("3".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret();
//            errMsg = "未绑定谷歌验证器";
//         }
//         if (StringUtils.isEmptyString(key)) {
//            throw new BusinessException(errMsg);
//         }
         // 验证
         boolean passed = false;
         if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
            String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
            if ((null != authcode) && (authcode.equals(verifcode))) {
               passed = true;
               this.identifyingCodeTimeWindowService.delAuthCode(key);
            }
         } else if ("3".equals(verifcode_type)) {
            if (this.googleAuthService.checkCode(key, verifcode)) {
               passed = true;
            }
         }
         // 如果是演示用户,则不判断验证码
         if (!"GUEST".contentEquals(party.getRolename())) {
            if (!passed) {
               throw new BusinessException("验证码不正确");
            }
         }
//         boolean passed = false;
//         if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
//            String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
//            if ((null != authcode) && (authcode.equals(verifcode))) {
//               passed = true;
//               this.identifyingCodeTimeWindowService.delAuthCode(key);
//            }
//         } else if ("3".equals(verifcode_type)) {
//            if (this.googleAuthService.checkCode(key, verifcode)) {
//               passed = true;
//            }
//         }
//
//         // 如果是演示用户,则不判断验证码
//         if (!"GUEST".contentEquals(party.getRolename())) {
//            if (!passed) {
//               throw new BusinessException("验证码不正确");
//            }
//         }
         // 更新密码
         this.partyService.updateSafeword(party, safeword);
@@ -1000,9 +998,9 @@
            data.put("phone", StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone());
            data.put("phone_filled", StringUtils.isEmptyString(party.getPhone()) ? "" : party.getPhone());
            data.put("phone_authority", party.getPhone_authority());
            data.put("email", StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail());
            data.put("email", party.getEmail());
            data.put("email_filled", StringUtils.isEmptyString(party.getEmail()) ? "" : party.getEmail());
            data.put("email_authority", party.getEmail_authority());
            data.put("email_authority", true);
            data.put("google_auth_secret", StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret());
            data.put("google_auth_secret_filled", StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) ? "" : secUser.getGoogle_auth_secret());
            data.put("google_auth_bind", secUser.isGoogle_auth_bind());