瀏覽代碼

公众号功能

Althars123 2 年之前
父節點
當前提交
85b03e28c1

+ 10 - 6
sdjk-admin/src/test/java/com/miaxis/test/NormalTest.java

@@ -4,13 +4,17 @@ import com.miaxis.SdjkApplication;
 import com.miaxis.score.service.IScoreInfoService;
 import com.miaxis.feign.dto.DyUserInfoDTO;
 import com.miaxis.feign.service.DyService;
+import com.miaxis.wx.service.IWxGzhService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
-//@ActiveProfiles("prod")
+import javax.servlet.http.HttpServletRequest;
+
+@ActiveProfiles("prodtest")
 @SpringBootTest(classes = SdjkApplication.class)
 @RunWith(SpringRunner.class)
 public class NormalTest {
@@ -22,13 +26,13 @@ public class NormalTest {
     @Autowired
     private DyService dyService;
 
+    @Autowired
+    private IWxGzhService wxGzhService;
+
+
     @Test
     public void test1() throws Exception {
-        DyUserInfoDTO dyUserInfoDTO= new DyUserInfoDTO();
-        dyUserInfoDTO.setOpen_id("17788008-db1e-407a-b870-7a8e6ad034e0");
-        dyUserInfoDTO.setAccess_token("eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImU2ZTg2ZWRiLTE1ZjctNDJkOC1iNjIzLTgxOTliNGYxNGFjNSJ9.7rsiOFTy3Bv2eS3iopEIGaU6RktDqviVZC0lNw4_mDm6h5AEeSbXFy8rlIUjFTEQJUd07CMnISbHIrzIkUaVDg");
-        String userInfoStr = dyService.getUserInfo(dyUserInfoDTO);
-        System.out.println(userInfoStr);
+        wxGzhService.handlePublicMsg(null);
 
 
     }

+ 2 - 2
sdjk-service/src/main/java/com/miaxis/wx/service/impl/WxGzhServiceImpl.java

@@ -114,7 +114,7 @@ public class WxGzhServiceImpl implements IWxGzhService {
             cn.hutool.json.JSONObject jsonObjectData = decryptMap.getJSONObject("xml");
 
 
-            //cn.hutool.json.JSONObject jsonObjectData = new cn.hutool.json.JSONObject("{\"CreateTime\":1639474955,\"EventKey\":\"https://jpcj-h5.zzxcx.net\",\"ToUserName\":\"gh_628da25a95e5\",\"MsgType\":\"event\",\"MenuId\":442656773,\"Event\":\"VIEW\",\"FromUserName\":\"ovKTX50v7OAEPI_ERofpUvrNQCJU\"}");
+//            cn.hutool.json.JSONObject jsonObjectData = new cn.hutool.json.JSONObject("{\"CreateTime\":1666169539,\"ToUserName\":\"gh_8e0c71ce615b\",\"MsgType\":\"text\",\"MsgId\":23853813438069304,\"Content\":\"a12345\",\"FromUserName\":\"o_DwY68a6UHmFhmovdFB0gANaC_U\"}");
             log.info("2-----jsonObjectData------"+jsonObjectData);
 
 
@@ -137,7 +137,7 @@ public class WxGzhServiceImpl implements IWxGzhService {
                     String dictValue = sysDictData.getDictValue();
                     String[] values = dictValue.split(",");
                     String password = values[0];
-                    if (msgType.equals(password)){
+                    if (jsonObjectData.getStr("Content").equals(password)){
                         parentUnionId = sysDictData.getDictLabel();
                         break;
                     }