From 565e8ac5039eb2c7c63695f9e3494ef00cb47185 Mon Sep 17 00:00:00 2001
From: guyue <1721849008@qq.com>
Date: 星期五, 18 七月 2025 15:15:23 +0800
Subject: [PATCH] 更改为传json

---
 src/main/java/com/linghu/utils/OpenCryptUtil.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/linghu/utils/OpenCryptUtil.java b/src/main/java/com/linghu/utils/OpenCryptUtil.java
index f99b583..8bef420 100644
--- a/src/main/java/com/linghu/utils/OpenCryptUtil.java
+++ b/src/main/java/com/linghu/utils/OpenCryptUtil.java
@@ -4,6 +4,7 @@
 import cn.afocus.crypt.sign.UserSign;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
@@ -36,7 +37,12 @@
             // 调用 open-crypt 的加密方法(根据实际API调整)
             //user转为 json
 //            String json = JSON.toJSONString(user);
-            return UserSign.gen(user, "fY9tX7vX7qH5bN2cD8eM4xD2fH7uL4xM".getBytes(StandardCharsets.UTF_8));
+            String secret ="fY9tX7vX7qH5bN2cD8eM4xD2fH7UL4xM";
+            JSONObject geoJSON = new JSONObject();
+            geoJSON.put("name",user);
+            String token = UserSign.gen(geoJSON.toJSONString(),secret.getBytes(StandardCharsets.UTF_8));
+            return token;
+//            return UserSign.gen(user, "fY9tX7vX7qH5bN2cD8eM4xD2fH7uL4xM".getBytes(StandardCharsets.UTF_8));
         } catch (Exception e) {
             throw new RuntimeException("加密失败:" + e.getMessage(), e);
         }

--
Gitblit v1.7.1