浏览代码

微信公众号-配置文件

chao 3 年之前
父节点
当前提交
a7ca5e1829

+ 87 - 69
db.sql

@@ -1,4 +1,5 @@
 -- ============================================== 系统表 start ===============================
+USE `caimei`;
 -- 系统用户表system_user
 DROP TABLE IF EXISTS `system_user`;
 CREATE TABLE `system_user` (
@@ -13,7 +14,8 @@ CREATE TABLE `system_user` (
   `update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
   `del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标记:0未删,其他删除',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户表';
+) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统用户表';
+
 -- 系统角色表
 DROP TABLE IF EXISTS `system_role`;
 CREATE TABLE `system_role` (
@@ -24,7 +26,8 @@ CREATE TABLE `system_role` (
   `update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
   `del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标记:0未删,其他删除',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统角色表';
+) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统角色表';
+
 -- 系统菜单表
 DROP TABLE IF EXISTS `system_menu`;
 CREATE TABLE `system_menu` (
@@ -35,20 +38,21 @@ CREATE TABLE `system_menu` (
   `parent_id` BIGINT NOT NULL DEFAULT '0' COMMENT '父级菜单Id',
   `hidden` CHAR(1) NOT NULL DEFAULT '0' COMMENT '隐藏状态:0显示,1隐藏',
   `status` CHAR(1) NOT NULL DEFAULT '0' COMMENT '状态:0启用,1停用',
-  `sort` INT(10) NOT NULL DEFAULT 0 COMMENT '排序',
+  `sort` INT NOT NULL DEFAULT 0 COMMENT '排序',
   `create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
   `update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
   `del_flag` CHAR(1) NOT NULL DEFAULT '0' COMMENT '删除标记:0未删,其他删除',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统菜单表';
+) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统菜单表';
+
 -- 系统权限表
---DROP TABLE IF EXISTS `system_permission`;
---CREATE TABLE `system_permission` (
+-- DROP TABLE IF EXISTS `system_permission`;
+-- CREATE TABLE `system_permission` (
 --  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '权限ID',
 --  `permission` VARCHAR(100) DEFAULT NULL COMMENT '权限标识',
 --  PRIMARY KEY (`id`)
---) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统权限表';
---
+-- ) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统权限表';
+
 -- 用户&角色 关联表
 DROP TABLE IF EXISTS `system_role_user`;
 CREATE TABLE `system_role_user` (
@@ -56,7 +60,8 @@ CREATE TABLE `system_role_user` (
   `role_id` VARCHAR(50) DEFAULT NULL COMMENT '角色ID',
   `user_id` VARCHAR(255) DEFAULT NULL COMMENT '用户ID',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户角色关联表';
+) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统用户角色关联表';
+
 -- 菜单&角色 关联表
 DROP TABLE IF EXISTS `system_role_menu`;
 CREATE TABLE `system_role_menu` (
@@ -64,111 +69,124 @@ CREATE TABLE `system_role_menu` (
   `role_id` VARCHAR(50) DEFAULT NULL COMMENT '角色ID',
   `menu_id` VARCHAR(255) DEFAULT NULL COMMENT '菜单ID',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='系统用户角色关联表';
+) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COMMENT='系统用户角色关联表';
 
 -- ============================================== 系统表 end ===============================
 
 -- ============================================== 微信表 start =============================
-
+USE `caimei`;
 -- 微信公众号菜单表(原表:caimei_weixin.menu_tree)
 DROP TABLE IF EXISTS `wechat_menu`;
 CREATE TABLE `wechat_menu` (
-  `id` bigint(11) NOT NULL AUTO_INCREMENT,
-  `parentId` bigint(11) DEFAULT NULL COMMENT '父级编号',
-  `parentIds` varchar(2000) DEFAULT NULL COMMENT '所有父级编号',
+  `id` bigint NOT NULL AUTO_INCREMENT,
+  `parent_id` bigint DEFAULT NULL COMMENT '父级编号',
+  `parent_ids` varchar(2000) DEFAULT NULL COMMENT '所有父级编号',
   `name` varchar(30) DEFAULT '' COMMENT '菜单标题',
-  `sort` int(11) DEFAULT '0' COMMENT '排序',
+  `sort` int DEFAULT '0' COMMENT '排序',
   `type` varchar(30) DEFAULT '' COMMENT '菜单的响应动作类型',
   `key` varchar(64) DEFAULT '' COMMENT '菜单KEY值,用于消息接口推送(click等点击类型必须)',
   `url` text COMMENT '网页链接,用户点击菜单可打开链接(view类型必须)',
-  `mediaId` varchar(64) DEFAULT '' COMMENT '调用新增永久素材接口返回的合法media_id(media_id类型和view_limited类型必须)',
+  `media_id` varchar(64) DEFAULT '' COMMENT '调用新增永久素材接口返回的合法media_id(media_id类型和view_limited类型必须)',
   `appid` varchar(64) DEFAULT '' COMMENT '小程序appId,公众号跳转小程序时使用',
-  `pagePath` varchar(100) DEFAULT '' COMMENT '小程序页面路径,公众号跳转小程序时使用',
-  `wxType` varchar(20) DEFAULT '' COMMENT '微信公众号类型',
-  `createBy` bigint(11) DEFAULT NULL COMMENT '创建人',
-  `createDate` datetime DEFAULT NULL COMMENT '创建时间',
-  `updateBy` bigint(11) DEFAULT NULL COMMENT '最后更新人',
-  `updateDate` datetime DEFAULT NULL COMMENT '最后更新时间',
+  `page_path` varchar(100) DEFAULT '' COMMENT '小程序页面路径,公众号跳转小程序时使用',
+  `wx_type` varchar(20) DEFAULT '' COMMENT '微信公众号类型',
+  `create_by` bigint DEFAULT NULL COMMENT '创建人',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` bigint DEFAULT NULL COMMENT '最后更新人',
+  `update_date` datetime DEFAULT NULL COMMENT '最后更新时间',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信菜单tree';
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='微信菜单tree';
 
-INSERT INTO caimei.wechat_menu (id,parentId,parentIds,name,sort,type,key,url,mediaId,appid,pagePath,wxType,createBy,createDate,updateBy,updateDate)
-SELECT id,parentId,parentIds,name,sort,type,key,url,mediaId,appid,pagepath,wxType,createBy,createDate,updateBy,updateDate FROM caimei_weixin.menu_tree;
+INSERT INTO caimei.wechat_menu (id,parent_id,parent_ids,`name`,sort,`type`,`key`,url,media_id,appid,page_path,wx_type,create_by,create_date,update_by,update_date)
+SELECT id,parentId,parentIds,`name`,sort,`type`,`key`,url,mediaId,appid,pagepath,wxType,createBy,createDate,updateBy,updateDate FROM caimei_weixin.menu_tree;
 
 -- 微信公众号自动回复表(原表:caimei_weixin.cm_wxparam)
 DROP TABLE IF EXISTS `wechat_reply`;
 CREATE TABLE `wechat_reply` (
-  `id` bigint(11) NOT NULL AUTO_INCREMENT,
+  `id` bigint NOT NULL AUTO_INCREMENT,
   `keyword` varchar(128) DEFAULT NULL COMMENT '关键字',
-  `responseType` varchar(16) DEFAULT NULL COMMENT '事件类型',
-  `msgType` varchar(16) DEFAULT NULL COMMENT '回复类型',
-  `relateId` bigint(11) DEFAULT NULL COMMENT '素材id',
+  `response_type` varchar(16) DEFAULT NULL COMMENT '事件类型',
+  `msg_type` varchar(16) DEFAULT NULL COMMENT '回复类型',
+  `relate_id` bigint DEFAULT NULL COMMENT '素材id',
   `title` varchar(128) DEFAULT NULL COMMENT '回复素材标题',
-  `wxType` varchar(255) DEFAULT NULL COMMENT '公众号类型',
-  `createBy` bigint(11) DEFAULT NULL COMMENT '创建人',
-  `createDate` datetime DEFAULT NULL COMMENT '创建时间',
-  `updateBy` bigint(11) DEFAULT NULL COMMENT '最后更新人',
-  `updateDate` datetime DEFAULT NULL COMMENT '最后更新时间',
+  `wx_type` varchar(255) DEFAULT NULL COMMENT '公众号类型',
+  `create_by` bigint DEFAULT NULL COMMENT '创建人',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` bigint DEFAULT NULL COMMENT '最后更新人',
+  `update_date` datetime DEFAULT NULL COMMENT '最后更新时间',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='回复配置表';
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='回复配置表';
 
-INSERT INTO caimei.wechat_reply (id,keyword,responseType,msgType,relateId,title,wxType,createBy,createDate,updateBy,updateDate)
+INSERT INTO caimei.wechat_reply (id,keyword,response_type,msg_type,relate_id,title,wx_type,create_by,create_date,update_by,update_date)
 SELECT cm_wxparamID,keyword,responseType,msgType,relateID,title,wx_type,create_by,create_date,update_by,update_date FROM caimei_weixin.cm_wxparam;
 
 -- 微信公众号-文本素材(原表:caimei_weixin.cm_wxtext)
 DROP TABLE IF EXISTS `wechat_text`;
 CREATE TABLE `wechat_text` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `id` bigint NOT NULL AUTO_INCREMENT,
   `title` varchar(128) DEFAULT NULL COMMENT '标题',
   `content` text COMMENT '内容',
-  `wxType` varchar(20) DEFAULT NULL COMMENT '微信公众号类型',
-  `createBy` bigint(11) DEFAULT NULL COMMENT '创建人',
-  `createDate` datetime DEFAULT NULL COMMENT '创建时间',
-  `updateBy` bigint(11) DEFAULT NULL COMMENT '最后更新人',
-  `updateDate` datetime DEFAULT NULL COMMENT '最后更新时间',
+  `wx_type` varchar(20) DEFAULT NULL COMMENT '微信公众号类型',
+  `create_by` bigint DEFAULT NULL COMMENT '创建人',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` bigint DEFAULT NULL COMMENT '最后更新人',
+  `update_date` datetime DEFAULT NULL COMMENT '最后更新时间',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信文本素材表';
-INSERT INTO security.wechat_text
-SELECT * FROM caimei_weixin.cm_wxtext;
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='微信文本素材表';
 
-INSERT INTO caimei.wechat_text (id,title,content,wxType,createBy,createDate,updateBy,updateDate)
+INSERT INTO caimei.wechat_text (id,title,content,wx_type,create_by,create_date,update_by,update_date)
 SELECT cm_wxtextID,title,content,wx_type,create_by,create_date,update_by,update_date FROM caimei_weixin.cm_wxtext;
 
 -- 微信公众号-文本素材(原表:caimei_weixin.cm_wxarticle)
 DROP TABLE IF EXISTS `wechat_article`;
 CREATE TABLE `wechat_article` (
-  `id` bigint(11) NOT NULL AUTO_INCREMENT,
+  `id` bigint NOT NULL AUTO_INCREMENT,
   `title` varchar(128) DEFAULT NULL COMMENT '标题',
-  `wxType` varchar(20) DEFAULT NULL COMMENT '微信公众号类型',
-  `createBy` bigint(11) DEFAULT NULL COMMENT '创建人',
-  `createDate` datetime DEFAULT NULL COMMENT '创建时间',
-  `updateBy` bigint(11) DEFAULT NULL COMMENT '最后更新人',
-  `updateDate` datetime DEFAULT NULL COMMENT '最后更新时间',
-  PRIMARY KEY (`articleId`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信图文素材表';
-
-INSERT INTO caimei.wechat_article (id,title,wxType,createBy,createDate,updateBy,updateDate)
+  `wx_type` varchar(20) DEFAULT NULL COMMENT '微信公众号类型',
+  `create_by` bigint DEFAULT NULL COMMENT '创建人',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` bigint DEFAULT NULL COMMENT '最后更新人',
+  `update_date` datetime DEFAULT NULL COMMENT '最后更新时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='微信图文素材表';
+
+INSERT INTO caimei.wechat_article (id,title,wx_type,create_by,create_date,update_by,update_date)
 SELECT cm_wxarticleID,title,wx_type,create_by,create_date,update_by,update_date FROM caimei_weixin.cm_wxarticle;
 
 -- 微信公众号-文本素材(原表:caimei_weixin.cm_wxarticledtl)
 DROP TABLE IF EXISTS `wechat_article_detail`;
 CREATE TABLE `wechat_article_detail` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `articleId` int(11) DEFAULT NULL COMMENT '图文素材id',
+  `id` bigint NOT NULL AUTO_INCREMENT,
+  `article_id` int DEFAULT NULL COMMENT '图文素材id',
   `title` varchar(128) DEFAULT NULL COMMENT '标题',
-  `linkurl` varchar(255) DEFAULT NULL COMMENT '跳转链接',
-  `picurl` varchar(255) DEFAULT NULL COMMENT '图片链接',
-  `createBy` bigint(11) DEFAULT NULL COMMENT '创建人',
-  `createDate` datetime DEFAULT NULL COMMENT '创建时间',
-  `updateBy` bigint(11) DEFAULT NULL COMMENT '最后更新人',
-  `updateDate` datetime DEFAULT NULL COMMENT '最后更新时间',
+  `url` varchar(255) DEFAULT NULL COMMENT '跳转链接',
+  `pic_url` varchar(255) DEFAULT NULL COMMENT '图片链接',
+  `create_by` bigint DEFAULT NULL COMMENT '创建人',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` bigint DEFAULT NULL COMMENT '最后更新人',
+  `update_date` datetime DEFAULT NULL COMMENT '最后更新时间',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信图文素材详细表';
-INSERT INTO security.wechat_article_detail
-SELECT * FROM caimei_weixin.cm_wxarticledtl;
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='微信图文素材详细表';
 
-INSERT INTO caimei.wechat_article_detail (id,articleId,title,linkurl,picurl,createBy,createDate,updateBy,updateDate)
-SELECT cm_wxarticledtlID,cm_wxarticleID,title,linkurl,picurl,wx_type,create_by,create_date,update_by,update_date FROM caimei_weixin.cm_wxarticledtl;
+INSERT INTO caimei.wechat_article_detail (id,article_id,title,url,pic_url,create_by,create_date,update_by,update_date)
+SELECT cm_wxarticledtlID,cm_wxarticleID,title,linkurl,picurl,create_by,create_date,update_by,update_date FROM caimei_weixin.cm_wxarticledtl;
 
 -- ============================================== 微信表 end ===============================
 
+UPDATE `wechat_menu` SET wx_type='gh_123456' WHERE wx_type='gh_ef75b1b89b74';
+UPDATE `wechat_menu` SET wx_type='gh_123456' WHERE wx_type='gh_7de98a37fb6a';
+UPDATE `wechat_menu` SET wx_type='gh_7890123' WHERE wx_type='gh_eecada09617d';
+
+UPDATE `wechat_reply` SET wx_type='gh_123456' WHERE wx_type='gh_ef75b1b89b74';
+UPDATE `wechat_reply` SET wx_type='gh_123456' WHERE wx_type='gh_7de98a37fb6a';
+UPDATE `wechat_reply` SET wx_type='gh_7890123' WHERE wx_type='gh_eecada09617d';
+
+UPDATE `wechat_text` SET wx_type='gh_123456' WHERE wx_type='gh_ef75b1b89b74';
+UPDATE `wechat_text` SET wx_type='gh_123456' WHERE wx_type='gh_7de98a37fb6a';
+UPDATE `wechat_text` SET wx_type='gh_7890123' WHERE wx_type='gh_eecada09617d';
+
+UPDATE `wechat_article` SET wx_type='gh_123456' WHERE wx_type='gh_ef75b1b89b74';
+UPDATE `wechat_article` SET wx_type='gh_123456' WHERE wx_type='gh_7de98a37fb6a';
+UPDATE `wechat_article` SET wx_type='gh_7890123' WHERE wx_type='gh_eecada09617d';
+
+COMMIT;

+ 38 - 8
pom.xml

@@ -79,19 +79,49 @@
         </dependency>
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <!-- 环境标识,需要与配置文件的名称相对应 -->
+                <activatedProperties>dev</activatedProperties>
+            </properties>
+            <activation>
+                <!-- 默认环境 -->
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>beta</id>
+            <properties>
+                <activatedProperties>beta</activatedProperties>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <activatedProperties>prod</activatedProperties>
+            </properties>
+        </profile>
+    </profiles>
+
     <build>
+        <finalName>${project.artifactId}</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <!--开启filtering功能  -->
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources/config/${activatedProperties}</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok</artifactId>
-                        </exclude>
-                    </excludes>
-                </configuration>
             </plugin>
         </plugins>
     </build>

+ 1 - 1
src/main/java/com/caimei365/manager/entity/wechat/WechatArticle.java

@@ -48,7 +48,7 @@ public class WechatArticle {
      * 文章列表JSON数据:[
      *            { "id":         "文章ID"
      *              "title":      "文章标题",
-     *              "linkUrl":    "跳转链接",
+     *              "url":    "跳转链接",
      *              "picurl": "图片链接",
      *            },
      *            {多条数据结构同上}

+ 1 - 1
src/main/java/com/caimei365/manager/entity/wechat/WechatArticleDetail.java

@@ -26,7 +26,7 @@ public class WechatArticleDetail {
     /**
      * 跳转链接
      */
-    private String linkUrl;
+    private String url;
     /**
      * 图片链接
      */

+ 3 - 3
src/main/java/com/caimei365/manager/service/wechat/impl/WechatArticleServiceImpl.java

@@ -121,7 +121,7 @@ public class WechatArticleServiceImpl implements WechatArticleService {
                 JSONObject detail = (JSONObject) articleObject;
                 Integer articleId = (Integer) detail.get("id");
                 String articleTitle = (String) detail.get("title");
-                String linkUrl = (String) detail.get("linkUrl");
+                String url = (String) detail.get("url");
                 String picurl = (String) detail.get("picurl");
                 WechatArticleDetail dbDetail = null;
                 if (null != articleId && articleId > 0) {
@@ -132,8 +132,8 @@ public class WechatArticleServiceImpl implements WechatArticleService {
                 if (StringUtils.hasLength(articleTitle)){
                     dbDetail.setTitle(articleTitle);
                 }
-                if (StringUtils.hasLength(linkUrl)){
-                    dbDetail.setLinkUrl(linkUrl);
+                if (StringUtils.hasLength(url)){
+                    dbDetail.setUrl(url);
                 }
                 if (StringUtils.hasLength(picurl)){
                     dbDetail.setPicurl(picurl);

+ 4 - 41
src/main/resources/application.yml

@@ -5,48 +5,11 @@ server:
       charset: UTF-8
 
 spring:
-  datasource:
-    url: jdbc:mysql://192.168.2.100:3306/security?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
-    username: developer
-    password: 05bZ/OxTB:X+yd%1
-  redis:
-    host: 192.168.2.100
-    port: 6379
-    #password: 123456
-    database: 0
-    timeout: 5000
+  application:
+    name: @artifactId@
+  profiles:
+    active: @activatedProperties@
 
 mybatis:
   mapper-locations: classpath:mapper/*.xml
 
-
-# 微信公众号
-wechat:
-  apiUrl: https://api.weixin.qq.com
-  publicUrl: http://mp.weixin.qq.com
-#  caimei:
-#    id: gh_ef75b1b89b74
-#    appid: wx91c4152b60ca91a3
-#    secret: a563dd2c07c9c815a4e697c8b6cb73dc
-#  hehe:
-#    id: gh_eecada09617d
-#    appid: wxd81864ddacc0ed25
-#    secret: 7873323db2984c75556f8d04e76d1f02
-#  caimei-old:
-#    id: gh_7de98a37fb6a
-#    appid: wxea43a0f9ebce9e66
-#    secret: 1c3cd60908e72dd280840bee9e15f7f6
-  caimei:
-    id: gh_123456
-    appid: wx123456
-    secret: abc123456
-  hehe:
-    id: gh_7890123
-    appid: wx7890123
-    secret: abc7890123
-  caimei-old:
-    id: gh_123456
-    appid: wx123456
-    secret: abc123456
-
-

+ 49 - 0
src/main/resources/config/beta/application-beta.yml

@@ -0,0 +1,49 @@
+spring:
+  #数据源连接--start
+  datasource:
+    url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: J5p3tgOVazNl4ydf
+    # Hikari will use the above plus the following to setup connection pooling
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+#日志配置
+logging:
+  file:
+    path: /mnt/newdatadrive/data/runtime/jar-instance/manager/logs
+  level:
+    root: info
+
+# 服务域名
+caimei:
+  wwwDomain: https://www-b.caimei365.com
+  coreDomain: https://core-b.caimei365.com
+  imageDomain: https://img-b.caimei365.com
+
+# 微信公众号
+wechat:
+  apiUrl: https://api.weixin.qq.com
+  publicUrl: http://mp.weixin.qq.com
+  caimei:
+    id: gh_123456
+    appid: wx123456
+    secret: abc123456
+  hehe:
+    id: gh_7890123
+    appid: wx7890123
+    secret: abc7890123
+  caimei-old:
+    id: gh_123456
+    appid: wx123456
+    secret: abc123456
+

+ 48 - 0
src/main/resources/config/dev/application-dev.yml

@@ -0,0 +1,48 @@
+spring:
+  #数据源连接--start
+  datasource:
+    #本地连接数据库
+    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: 05bZ/OxTB:X+yd%1
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+
+#日志配置
+logging:
+  level:
+    root: info
+    com.caimei365.manager.dao: debug
+
+# 服务域名
+caimei:
+  wwwDomain: https://www-b.caimei365.com
+  coreDomain: https://core-b.caimei365.com
+  imageDomain: https://img-b.caimei365.com
+
+# 微信公众号
+wechat:
+  apiUrl: https://api.weixin.qq.com
+  publicUrl: http://mp.weixin.qq.com
+  caimei:
+    id: gh_123456
+    appid: wx123456
+    secret: abc123456
+  hehe:
+    id: gh_7890123
+    appid: wx7890123
+    secret: abc7890123
+  caimei-old:
+    id: gh_123456
+    appid: wx123456
+    secret: abc123456

+ 48 - 0
src/main/resources/config/prod/application-prod.yml

@@ -0,0 +1,48 @@
+spring:
+  #数据源连接--start
+  datasource:
+    url: jdbc:mysql://rm-wz928s8btl7kxil44.mysql.rds.aliyuncs.com:3306/caimei?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
+    username: coder
+    password: diKtPYZ%wToI&9#L
+    # Hikari will use the above plus the following to setup connection pooling
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 15
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: DatebookHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+  #数据源连接--end
+
+#日志配置
+logging:
+  file:
+    path: /mnt/newdatadrive/data/runtime/jar-instance/manager/logs
+  level:
+    root: info
+
+# 服务域名
+caimei:
+  wwwDomain: https://www.caimei365.com
+  coreDomain: https://core.caimei365.com
+  imageDomain: https://img.caimei365.com
+
+# 微信公众号
+wechat:
+  apiUrl: https://api.weixin.qq.com
+  publicUrl: http://mp.weixin.qq.com
+  caimei:
+    id: gh_ef75b1b89b74
+    appid: wx91c4152b60ca91a3
+    secret: a563dd2c07c9c815a4e697c8b6cb73dc
+  hehe:
+    id: gh_eecada09617d
+    appid: wxd81864ddacc0ed25
+    secret: 7873323db2984c75556f8d04e76d1f02
+  caimei-old: # 旧公众号,openid迁移用
+    id: gh_7de98a37fb6a
+    appid: wxea43a0f9ebce9e66
+    secret: 1c3cd60908e72dd280840bee9e15f7f6

+ 42 - 42
src/main/resources/mapper/WeChatDao.xml

@@ -2,46 +2,46 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.manager.dao.WeChatDao">
     <select id="getWechatMenuList" resultType="com.caimei365.manager.entity.wechat.WechatMenu">
-        SELECT a.id, a.parentId, a.parentIds, a.`name`, a.sort, a.type, a.`key`,
-               a.url, a.mediaId, a.appid, a.pagePath AS pagePath, a.wxType
+        SELECT a.id, a.parent_id AS parentId, a.parent_ids AS parentIds, a.`name`, a.sort, a.type, a.`key`,
+               a.url, a.media_id AS mediaId, a.appid, a.page_path AS pagePath, a.wx_type AS wxType
         FROM wechat_menu a
-        WHERE a.wxType = #{wxType} AND a.parentId = #{parentId}
+        WHERE a.wx_type = #{wxType} AND a.parent_id = #{parentId}
         ORDER BY a.sort ASC
     </select>
     <select id="getWechatMenu" resultType="com.caimei365.manager.entity.wechat.WechatMenu">
-        SELECT a.id, a.parentId, a.parentIds, a.`name`, a.sort, a.type, a.`key`,
-               a.url, a.mediaId, a.appid, a.pagePath AS pagePath, a.wxType
+        SELECT a.id, a.parent_id AS parentId, a.parent_ids AS parentIds, a.`name`, a.sort, a.type, a.`key`,
+               a.url, a.media_id AS mediaId, a.appid, a.page_path AS pagePath, a.wx_type AS wxType
         FROM wechat_menu a WHERE a.id = #{id}
     </select>
     <select id="countChildByParentId" resultType="java.lang.Integer">
-        SELECT IFNULL(COUNT(*),0) FROM wechat_menu WHERE parentId = #{parentId}
+        SELECT IFNULL(COUNT(*),0) FROM wechat_menu WHERE parent_id = #{parentId}
     </select>
     <update id="updateWechatMenu">
-        UPDATE wechat_menu SET parentId = #{parentId}, parentIds = #{parentIds}, name = #{name}, sort = #{sort},
-                               type = #{type}, `key` = #{key}, url = #{url}, mediaId = #{mediaId}, appid = #{appid},
-                               pagePath = #{pagePath}, updateBy = #{userId}, updateDate = NOW()
+        UPDATE wechat_menu SET parent_id = #{parentId}, parent_ids = #{parentIds}, name = #{name}, sort = #{sort},
+                               type = #{type}, `key` = #{key}, url = #{url}, media_id = #{mediaId}, appid = #{appid},
+                               page_path = #{pagePath}, update_by = #{userId}, update_date = NOW()
         WHERE id = #{id}
     </update>
     <insert id="insertWechatMenu" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO wechat_menu(parentId, parentIds, `name`, sort, type, `key`, url, mediaId, appid, pagePath, wxType, createBy, createDate)
+        INSERT INTO wechat_menu(parent_id, parent_ids, `name`, sort, type, `key`, url, media_id, appid, page_path, wx_type, create_by, create_date)
         VALUES (#{parentId}, #{parentIds}, #{name}, #{sort}, #{type}, #{key}, #{url}, #{mediaId}, #{appid}, #{pagePath}, #{wxType}, #{userId}, NOW())
     </insert>
     <delete id="deleteWechatMenu">
         DELETE FROM wechat_menu WHERE id = #{id}
     </delete>
     <select id="getReplyList" resultType="com.caimei365.manager.entity.wechat.WechatReply">
-        SELECT a.id AS id, a.keyword, a.title, a.responsetype AS responseType,
-               a.msgtype AS msgType, a.relateId AS relateId, a.wxType AS wxType, IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id AS id, a.keyword, a.title, a.response_type AS responseType,
+               a.msg_type AS msgType, a.relate_id AS relateId, a.wx_type AS wxType, IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_reply a
         <where>
             <if test=" wxType != null and  wxType != ''">
-                AND a.wxType =#{wxType}
+                AND a.wx_type =#{wxType}
             </if>
             <if test="responseType != null and responseType != ''">
-                AND a.responsetype = #{responseType}
+                AND a.response_type = #{responseType}
             </if>
             <if test="msgType != null and msgType != ''">
-                AND a.msgtype = #{msgType}
+                AND a.wx_type = #{msgType}
             </if>
             <if test="title != null and title != ''">
                 AND a.title LIKE concat('%',#{title},'%')
@@ -50,29 +50,29 @@
         ORDER BY updateTime DESC
     </select>
     <select id="getWechatReply" resultType="com.caimei365.manager.entity.wechat.WechatReply">
-        SELECT a.id AS id, a.keyword, a.title, a.responsetype AS responseType,
-               a.msgtype AS msgType, a.relateId AS relateId, a.wxType AS wxType, IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id AS id, a.keyword, a.title, a.response_type AS responseType,
+               a.msg_type AS msgType, a.relate_id AS relateId, a.wx_type AS wxType, IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_reply a WHERE a.id = #{id}
     </select>
     <update id="updateWechatReply">
-        UPDATE wechat_reply SET keyword = #{keyword}, title = #{title}, responsetype = #{responseType},
-                                msgtype = #{msgType}, relateId = #{relateId}, updateBy = #{userId}, updateDate = NOW()
+        UPDATE wechat_reply SET keyword = #{keyword}, title = #{title}, response_type = #{responseType},
+                                msg_type = #{msgType}, relate_id = #{relateId}, update_by = #{userId}, update_date = NOW()
         WHERE id = #{id}
     </update>
     <insert id="insertWechatReply" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO wechat_reply(keyword, title, responsetype, msgtype, relateId, wxType, createBy, createDate)
+        INSERT INTO wechat_reply(keyword, title, response_type, msg_type, relate_id, wx_type, create_by, create_date)
         VALUES (#{keyword}, #{title}, #{responseType}, #{msgType}, #{relateId}, #{wxType}, #{userId}, NOW())
     </insert>
     <delete id="deleteWechatReply">
         DELETE FROM wechat_reply WHERE id = #{id}
     </delete>
     <select id="getTextList" resultType="com.caimei365.manager.entity.wechat.WechatText">
-        SELECT a.id AS id, a.title, a.content, a.wxType AS wxType,
-               IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id AS id, a.title, a.content, a.wx_type AS wxType,
+               IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_text a
         <where>
             <if test=" wxType != null and  wxType != ''">
-                AND a.wxType =#{wxType}
+                AND a.wx_type =#{wxType}
             </if>
             <if test="title != null and title != ''">
                 AND a.title LIKE concat('%',#{title},'%')
@@ -81,28 +81,28 @@
         ORDER BY updateTime DESC
     </select>
     <select id="getWechatText" resultType="com.caimei365.manager.entity.wechat.WechatText">
-        SELECT a.id AS id, a.title, a.content, a.wxType AS wxType,
-               IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id AS id, a.title, a.content, a.wx_type AS wxType,
+               IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_text a WHERE a.id = #{id}
     </select>
     <update id="updateWechatText">
-        UPDATE wechat_text SET title = #{title}, content = #{content}, wxType = #{wxType}, updateBy = #{userId}, updateDate = NOW()
+        UPDATE wechat_text SET title = #{title}, content = #{content}, wx_type = #{wxType}, update_by = #{userId}, update_date = NOW()
         WHERE id = #{id}
     </update>
     <insert id="insertWechatText" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO wechat_text(title, content, wxType, createBy, createDate)
+        INSERT INTO wechat_text(title, content, wx_type, create_by, create_date)
         VALUES (#{title}, #{content}, #{wxType}, #{userId}, NOW())
     </insert>
     <delete id="deleteWechatText">
         DELETE FROM wechat_text WHERE id = #{id}
     </delete>
     <select id="getArticleList" resultType="com.caimei365.manager.entity.wechat.WechatArticle">
-        SELECT a.id, a.title, a.wxType AS wxType,
-        IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id, a.title, a.wx_type AS wxType,
+        IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_article a
         <where>
             <if test=" wxType != null and  wxType != ''">
-                AND a.wxType =#{wxType}
+                AND a.wx_type =#{wxType}
             </if>
             <if test="title != null and title != ''">
                 AND a.title LIKE concat('%',#{title},'%')
@@ -111,42 +111,42 @@
         ORDER BY updateTime DESC
     </select>
     <select id="getWechatArticle" resultType="com.caimei365.manager.entity.wechat.WechatArticle">
-        SELECT a.id, a.title, a.wxType AS wxType,
-               IFNULL(a.updateDate,a.createDate) AS updateTime
+        SELECT a.id, a.title, a.wx_type AS wxType,
+               IFNULL(a.update_date,a.create_date) AS updateTime
         FROM wechat_article a WHERE a.id = #{id}
     </select>
     <select id="getArticleDetailIds" resultType="java.lang.Integer">
-        SELECT id FROM wechat_article_detail  WHERE articleId = #{articleId}
+        SELECT id FROM wechat_article_detail  WHERE article_id = #{articleId}
     </select>
     <select id="getArticleDetailList" resultType="com.caimei365.manager.entity.wechat.WechatArticleDetail">
-        SELECT a.id AS id,a.articleId AS articleId, a.title, a.linkurl AS linkUrl, a.picurl AS picurl
-        FROM wechat_article_detail a WHERE a.articleId = #{articleId}
+        SELECT a.id AS id,a.article_id AS articleId, a.title, a.url AS url, a.pic_url AS picurl
+        FROM wechat_article_detail a WHERE a.article_id = #{articleId}
     </select>
     <select id="getWechatArticleDetail" resultType="com.caimei365.manager.entity.wechat.WechatArticleDetail">
-        SELECT a.id AS id, a.articleId AS articleId, a.title, a.linkurl AS linkUrl, a.picurl AS picurl
+        SELECT a.id AS id, a.article_id AS articleId, a.title, a.url AS url, a.pic_url AS picurl
         FROM wechat_article_detail a WHERE a.id = #{id}
     </select>
     <update id="updateWechatArticle">
-        UPDATE wechat_article SET title = #{title}, wxType = #{wxType}, updateBy = #{userId}, updateDate = NOW()
+        UPDATE wechat_article SET title = #{title}, wx_type = #{wxType}, update_by = #{userId}, update_date = NOW()
         WHERE id = #{id}
     </update>
     <update id="updateWechatArticleDetail">
-        UPDATE wechat_article_detail SET articleId = #{articleId}, title = #{title}, linkurl = #{linkUrl}, picurl = #{picurl}, updateBy = #{userId}, updateDate = NOW()
+        UPDATE wechat_article_detail SET article_id = #{articleId}, title = #{title}, url = #{url}, pic_url = #{picurl}, update_by = #{userId}, update_date = NOW()
         WHERE id = #{id}
     </update>
     <insert id="insertWechatArticle" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO wechat_article(title, wxType, createBy, createDate)
+        INSERT INTO wechat_article(title, wx_type, create_by, create_date)
         VALUES (#{title}, #{wxType}, #{userId}, NOW())
     </insert>
     <insert id="insertWechatArticleDetail" keyProperty="id" useGeneratedKeys="true">
-        INSERT INTO wechat_article_detail(articleId, title, linkurl, picurl, createBy, createDate)
-        VALUES (#{articleId}, #{title}, #{linkUrl},#{picurl}, #{userId}, NOW())
+        INSERT INTO wechat_article_detail(article_id, title, url, pic_url, create_by, create_date)
+        VALUES (#{articleId}, #{title}, #{url},#{picurl}, #{userId}, NOW())
     </insert>
     <delete id="deleteWechatArticle">
         DELETE FROM wechat_article WHERE id = #{id}
     </delete>
     <delete id="deleteDetailByArticleId">
-        DELETE FROM wechat_article_detail WHERE articleId = #{articleId}
+        DELETE FROM wechat_article_detail WHERE article_id = #{articleId}
     </delete>
     <delete id="deleteWechatArticleDetail">
         DELETE FROM wechat_article_detail WHERE id = #{id}