From eff9f8dce083c7ef911cb8419c03baf3af176c68 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 23 四月 2025 15:49:28 +0800
Subject: [PATCH] 代码初始化

---
 server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java b/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
index 741dcb5..e965335 100644
--- a/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
+++ b/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
@@ -9,6 +9,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.PostConstruct;
@@ -24,15 +25,16 @@
     private static JSONObject json = new JSONObject();
 
 
-    @Autowired
-    private SystemDictDataBiz systemDictDataBiz;
 
     private static QywxUtil qyUtil;
+
+    @Value("${qiwei.serviceurl}")
+    private    String qiweiUrl;
 
     @PostConstruct
     private void init() {
         qyUtil = this;
-        systemDictDataBiz = qyUtil.systemDictDataBiz;
+//        QywxUtil.qiweiUrl =  serviceurl;
     }
 
 
@@ -86,6 +88,7 @@
             String url = interfaceUrl[0].replace("${accesstoken}",token);
             QywxSendMsgResponse response = sendHttpRequestSingle(url,interfaceUrl[1],JSONObject.toJSONString(param)
                     ,new TypeReference<QywxSendMsgResponse>(){});
+            log.error("鎺ㄩ�佹秷鎭粨鏋渰}",JSONObject.toJSONString(response));
             if(response.getErrcode()!=null && response.getErrcode() ==0){
                 return response;
             }
@@ -130,6 +133,19 @@
         return null;
     }
 
+
+    public static String getJsApiTicket(String token)  {
+        String[] interfaceUrl = QywxConstant.GET_JSAPI_TICKET;
+        String url = interfaceUrl[0].replace("${accesstoken}",token);
+        QywxBaseResponse<String> response = sendHttpRequest(url,interfaceUrl[1],""
+                ,new TypeReference<QywxBaseResponse<String>>(){});
+        if(response.getErrcode()!=null && response.getErrcode() ==0){
+            return response.getTicket();
+        }
+        return null;
+    }
+
+
     /**
      * 鍙戣捣wms鎺ュ彛璇锋眰
      * @param url
@@ -140,12 +156,12 @@
      * @param <T>
      */
     public static   <T> QywxBaseResponse<T> sendHttpRequest(String url, String name, String param, TypeReference<QywxBaseResponse<T>> typeReference){
-        log.info("銆�"+name+"銆�================寮�濮�===="+ JSONObject.toJSONString(param));
+        log.info("銆�"+name+"銆�================寮�濮�===="+url+"\nparam==========================:"+ JSONObject.toJSONString(param));
         if ( StringUtils.isNotBlank(url)) {
             String res = null;
             try {
                 Map<String,String> headers = new HashMap<>();
-                res = HttpsUtil.postJson(url,param);
+                res = HttpsUtil.postJson(qyUtil.qiweiUrl+url,param);
                 QywxBaseResponse result = JSONObject.parseObject(res, typeReference.getType());
                 logResult(result,name);
                 return  result;
@@ -162,7 +178,7 @@
             String res = null;
             try {
                 Map<String,String> headers = new HashMap<>();
-                res = HttpsUtil.postJson(url,param);
+                res = HttpsUtil.postJson(qyUtil.qiweiUrl+url,param);
                 T result = JSONObject.parseObject(res, typeReference.getType());
 //                logResult(result,name);
                 return  result;

--
Gitblit v1.9.3