Browse Source

消息接口

pzc 4 years ago
parent
commit
73b1769e73

+ 88 - 0
mpwechatApp/publish/application_mpprod.yml

@@ -0,0 +1,88 @@
+server:
+    port: 7001
+
+logging:
+  level:
+    org.springframework.web: INFO
+    com.liangjian11.wx.mp: DEBUG
+    com.github.binarywang.demo.wx.mp: DEBUG
+    me.chanjar.weixin: DEBUG
+wx:
+  mp:
+    configs:
+      - appId: wx4f8c9fef3896ad71 #(一个公众号的appid)
+        secret: ea186d9f2941b5cd88004e339a4ec479 #(公众号的appsecret)
+        token: lj123456com #(接口配置里的Token值)
+        aesKey: 3RtoZxD0Us4ZcjeWw7OCi5xjFLOTGPYAODiVvDkDUpK #(接口配置里的EncodingAESKey值)
+      - appId: 2222 #(另一个公众号的appid,以下同上)
+        secret: 1111
+        token: 111
+        aesKey: 111
+
+wechat:
+    open:
+        componentAppId: "wxdf1147a020c2d975"
+        componentSecret: "5dd95e893c35b3fc9c1fdf3cb8dc5004"
+        componentToken: "90fa4bd02583d23c75d2fb76aaacd18e"
+        componentAesKey: "990fa4bd02583d23c75d2fb76aaacd183d23c75d2fb"
+    redis:
+        host: "119.130.113.245"
+
+
+#spring cloud
+spring:
+    datasource:
+        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+        url: jdbc:sqlserver://127.0.0.1:1433; DatabaseName=qywechat
+        username: appauth
+        password: 360lj.comAppauth#2020
+    application:
+        name: mpwechat
+        #配置面向服务调用
+    cloud:
+        config:
+            discovery:
+                enabled: true
+                service-id: CONFIG
+        profile: prod
+        label: master
+    servlet:
+        multipart:
+            max-file-size : 10MB
+            max-request-size : 20MB
+management:
+    endpoints:
+        web:
+            exposure:
+                include: false
+
+eureka:
+    client:
+        service-url:
+            defaultZone: http://liangjian:360lj.comOauth2passwd@119.130.113.245:11000/eureka/
+    # 使用ip地址注册到eureka server
+    instance:
+        ip-address: true
+        instance-id: ${spring.cloud.client.ipAddress}:${server.port}
+
+mybatis-plus:
+    mapper-locations: classpath*:mapper/*Mapper.xml
+    type-aliases-package: com.liangjian11.wx.mp.modle
+    global-config:
+        refresh-mapper: true
+    configuration:
+        # 是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN(下划线命名) 到经典 Java 属性名 aColumn(驼峰命名) 的类似映射
+        map-underscore-to-camel-case: false
+
+clientMember:
+    port: 8090
+    service:
+        id: memb
+clientQiyewechat:
+    port: 7000
+    service:
+        id: qiyewechat
+clientZuul:
+    port: 13000
+    service:
+        id: 119.130.113.245

+ 9 - 3
mpwechatApp/publish/config.properties

@@ -1,6 +1,12 @@
-resource.Locations = /home/appCenterTest.360lj.com/public
+#resource.Locations = D:\\public\\
+#resource.href = /public/
+#project.weburl = http://219.128.77.86:7001
+#material.Locations = D:\\public\\material
+#material.href= /public/material
+
+
+resource.Locations = /home/www/appCenterTest/public/
 resource.href = /public/
 project.weburl = http://192.168.50.39:8081
-
-material.Locations = /home/appCenterTest.360lj.com/public/material
+material.Locations = /home/www/appCenterTest/public/material
 material.href= /public/material

BIN
mpwechatApp/publish/mpwechatApp-1.0.0-SNAPSHOT.jar


+ 9 - 6
mpwechatApp/src/main/java/com/liangjian11/wx/mp/controller/WxApiFansController.java

@@ -1,21 +1,21 @@
 package com.liangjian11.wx.mp.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.reflect.TypeToken;
 import com.liangjian11.wx.mp.modle.*;
 import com.liangjian11.wx.mp.service.*;
-import com.liangjian11.wx.mp.utils.ResultInfo;
-import com.liangjian11.wx.mp.utils.ResultUtil;
-import com.liangjian11.wx.mp.utils.SnowflakeIdWorker;
-import com.liangjian11.wx.mp.utils.SnowflakeUtil;
+import com.liangjian11.wx.mp.utils.*;
 import com.liangjian11.wx.mp.utils.dto.ResultObject;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.client.RestTemplate;
 
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -57,9 +57,12 @@ public class WxApiFansController {
      * @return
      */
     @PutMapping("/addFans")
-    public ResultInfo addFans(@RequestParam String appId, @RequestParam List<Fans> fans){
+    public ResultInfo addFans(@RequestParam String appId, @RequestParam String fans){
+        Type datatype1 = new TypeToken<List<Fans>>() { }.getType();
+
+        List<Fans> fansList = (List<Fans>)JsonUtils.fromJson(fans,datatype1);
         if(fans != null ) {
-            boolean result = fansService.addFans(appId,fans);
+            boolean result = fansService.addFans(appId,fansList);
             return new ResultInfo(1,200,"成功",result);
         }else{
             return new ResultInfo(1,500,"参数错误请传入粉丝数组列表","");