Browse Source

小程序二维码

lyhzzz 2 năm trước cách đây
mục cha
commit
8f9427577b

BIN
images/leader/4.jpg


+ 1 - 1
src/main/java/com/fdkankan/tk/service/impl/RoomServiceImpl.java

@@ -160,7 +160,7 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
 
         String localPath = String.format(FilePath.LOCAL_QRCODE_PATH, type,roomId);
         String ossPath = String.format(FilePath.OSS_QRCODE_PATH,type, roomId);
-        String path = "roomId="+roomId+"&role=%s";
+        String path = "id="+roomId+"&role=%s";
         path = String.format(path,type);
         wxService.getWxQRCode(path,localPath,0);
         if(!new File(localPath).exists()){

+ 8 - 2
src/main/java/com/fdkankan/tk/service/impl/WxServiceImpl.java

@@ -43,11 +43,15 @@ public class WxServiceImpl implements IWxService {
     WxClient wxClient;
     @Autowired
     RedisUtil redisUtil;
+    @Value("${wx.env_version}")
+    String envVersion;
+    @Value("${wx.path}")
+    String wxPath;
 
     //二维码
     static String getWxQrCodeUrl ="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=%s";
     //太阳码
-    static String getWxSunCodeUrl ="https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s";
+    static String getWxSunCodeUrl ="https://api.weixin.qq.com/wxa/getwxacode?access_token=%s";
 
 
     public String getToken(){
@@ -82,6 +86,7 @@ public class WxServiceImpl implements IWxService {
                 log.info("微信生成二维码接口返回内容长度小于1000");
                 String result = IOUtils.toString(response.getEntity().getContent());
                 JSONObject jsonObject = JSONObject.parseObject(result);
+                System.out.println(jsonObject);
                 if(jsonObject.containsKey("errcode") && reCount < 2){
                     int errcode = jsonObject.getInteger("errcode");
                     if(errcode == 40001) {
@@ -124,7 +129,8 @@ public class WxServiceImpl implements IWxService {
         httpClient = HttpClients.createDefault();
         HttpPost httpPost = new HttpPost(urlStr);
         Map<String, Object> jsonMap = new HashMap<>();
-        jsonMap.put("scene", path);
+        jsonMap.put("path", wxPath+"?"+path);
+        jsonMap.put("env_version", envVersion);
         log.info("上送给微信生成二维码的内容为:{}", JSONObject.toJSONString(jsonMap));
         StringEntity requestEntity = new StringEntity(JSONObject.toJSONString(jsonMap), "utf-8");
         requestEntity.setContentEncoding("UTF-8");

+ 6 - 1
src/main/resources/application-local.yaml

@@ -34,4 +34,9 @@ spring:
    # basePath: http://test.4dkankan.com
     #port: 80
     basePath: http://192.168.0.38/4dkankan_v2
-    port: 8080
+    port: 8080
+
+wx:
+  #要打开的小程序版本。正式版为 release,体验版为 trial,开发版为 develop
+  env_version: trial
+  path: pages/sync/room/room

+ 6 - 1
src/main/resources/application-test.yaml

@@ -34,4 +34,9 @@ spring:
     basePath: http://test.4dkankan.com
     port: 80
     #basePath: http://192.168.0.38/4dkankan_v2
-    #port: 8080
+    #port: 8080
+
+wx:
+  #要打开的小程序版本。正式版为 release,体验版为 trial,开发版为 develop
+  env_version: trial
+  path: pages/sync/room/room