From 6b479c5774ed3d6e2dc92693ddeda3e7ad1494db Mon Sep 17 00:00:00 2001
From: Andru <769883346@qq.com>
Date: 星期一, 23 十月 2023 17:34:08 +0800
Subject: [PATCH] 添加获客方法

---
 src/main/java/com/hx/util/SimpleEncrypt.java |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/hx/util/SimpleEncrypt.java b/src/main/java/com/hx/util/SimpleEncrypt.java
index 69909b0..88f48a2 100644
--- a/src/main/java/com/hx/util/SimpleEncrypt.java
+++ b/src/main/java/com/hx/util/SimpleEncrypt.java
@@ -1,12 +1,6 @@
 package com.hx.util;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
+import java.util.*;
 
 /***
  * 锟�?鍗曠殑鍔犲瘑绋嬪簭锛屽拰瑙e瘑绋嬪簭
@@ -54,11 +48,7 @@
     public static String simpleEnCode(String dataString) {
         // 缁勬嫾闅忔満鍊�
         String ranString = generateCheckCode(13).toString() + dataString + generateCheckCode(9).toString();
-
-        System.out.println(ranString);
-        // 杩涜鍔犲瘑 sun.misc.BASE64Encoder.BASE64Encoder()
-        String enCode = new BASE64Encoder().encodeBuffer(ranString.getBytes());
-
+        String enCode = new String(Base64.getEncoder().encode(ranString.getBytes()));
         return enCode;
     }
 
@@ -73,7 +63,8 @@
      */
     public static String simpleDeCode(String dataString) throws Exception {
         // 杩涜瑙e瘑sun.misc.BASE64Decoder.BASE64Decoder()
-        byte[] enCode = new BASE64Decoder().decodeBuffer(dataString);
+
+        byte[] enCode = Base64.getDecoder().decode(dataString);
         // 瑙e緱闅忔満鍊�
         String ranString = new String(enCode);
 

--
Gitblit v1.8.0