| @@ -22,13 +22,21 @@ import tk.mybatis.spring.annotation.MapperScan; | |||||
| @EnableRocketMQ | @EnableRocketMQ | ||||
| public class UserApplication { | public class UserApplication { | ||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(UserApplication.class, args); | SpringApplication.run(UserApplication.class, args); | ||||
| @@ -74,20 +74,6 @@ public class WxAppinfoController extends BaseController { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); | return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); | ||||
| } | } | ||||
| @ApiOperation("C端更新AccessToken, 无限制二维码生成需要更新token") | |||||
| @GetMapping("/accessTokenUpdate") | |||||
| public ResultData ctokenUpdate() { | |||||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::ctokenUpdate"); | |||||
| try { | |||||
| wxAppinfoService.ctokenUpdate(getTenantId()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation(value = "下载二维码", notes = "参数{\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") | @ApiOperation(value = "下载二维码", notes = "参数{\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") | ||||
| @PostMapping("/downQrCode") | @PostMapping("/downQrCode") | ||||
| public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) { | public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) { | ||||
| @@ -22,7 +22,7 @@ spring: | |||||
| poolPreparedStatements: true | poolPreparedStatements: true | ||||
| maxOpenPreparedStatements: 20 | maxOpenPreparedStatements: 20 | ||||
| connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" | connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" | ||||
| #jackson: | |||||
| #jackson: | |||||
| #date-format: yyyy-MM-dd HH:mm:ss | #date-format: yyyy-MM-dd HH:mm:ss | ||||
| # REDIS | # REDIS | ||||
| redis: | redis: | ||||
| @@ -85,6 +85,25 @@ wechat: | |||||
| appId: "wxe31beafbfd8295ba" | appId: "wxe31beafbfd8295ba" | ||||
| secret: "c689fabf3c4c9f5b6424ff2a36a26727" | secret: "c689fabf3c4c9f5b6424ff2a36a26727" | ||||
| url: "https://mall.youlane.cn" | url: "https://mall.youlane.cn" | ||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -92,6 +111,8 @@ jasypt: | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: false | |||||
| ueditor: | ueditor: | ||||
| config: config.json | config: config.json | ||||
| @@ -44,13 +44,13 @@ spring: | |||||
| password: ENC(APQMO9XQRzMKd0eap+oSSOYH9MQe/r5K0YFF9A9mizU=) # 授权密码 | password: ENC(APQMO9XQRzMKd0eap+oSSOYH9MQe/r5K0YFF9A9mizU=) # 授权密码 | ||||
| properties: | properties: | ||||
| mail: | mail: | ||||
| smtp: | |||||
| auth: true | |||||
| starttls: | |||||
| enable: true | |||||
| socketFactory: | |||||
| port: 465 | |||||
| class: javax.net.ssl.SSLSocketFactory | |||||
| smtp: | |||||
| auth: true | |||||
| starttls: | |||||
| enable: true | |||||
| socketFactory: | |||||
| port: 465 | |||||
| class: javax.net.ssl.SSLSocketFactory | |||||
| # RABBITMQ | # RABBITMQ | ||||
| rabbitmq: | rabbitmq: | ||||
| host: localhost | host: localhost | ||||
| @@ -73,9 +73,30 @@ wechat: | |||||
| appId: "wx9cc4ca09eb20fe03" | appId: "wx9cc4ca09eb20fe03" | ||||
| secret: "af1d7f7a1268022a73cb4ce0b9cf0985" | secret: "af1d7f7a1268022a73cb4ce0b9cf0985" | ||||
| url: "https://admin.malls.iformall.com" | url: "https://admin.malls.iformall.com" | ||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| ueditor: | ueditor: | ||||
| config: config.json | config: config.json | ||||
| @@ -73,9 +73,30 @@ wechat: | |||||
| appId: "wx091907dd0bfd3f6b" | appId: "wx091907dd0bfd3f6b" | ||||
| secret: "2a2ca10738998b9ef92c1fe8a4d366a6" | secret: "2a2ca10738998b9ef92c1fe8a4d366a6" | ||||
| url: "https://admintest.malls.iformall.com" | url: "https://admintest.malls.iformall.com" | ||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| ueditor: | ueditor: | ||||
| config: config.json | config: config.json | ||||
| @@ -21,11 +21,19 @@ public class BApplication { | |||||
| @Value("${fm.exception}") | @Value("${fm.exception}") | ||||
| private boolean fmException; | private boolean fmException; | ||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | @Bean | ||||
| public boolean isFmException() { | public boolean isFmException() { | ||||
| return fmException; | return fmException; | ||||
| } | } | ||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(BApplication.class, args); | SpringApplication.run(BApplication.class, args); | ||||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxMerchantBUserService; | import com.iformall.service.WxMerchantBUserService; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| @@ -26,12 +27,17 @@ import javax.servlet.http.HttpServletRequest; | |||||
| @RestController | @RestController | ||||
| public class BaseController { | public class BaseController { | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantBUserService wxMerchantBUserService; | private WxMerchantBUserService wxMerchantBUserService; | ||||
| @Autowired | @Autowired | ||||
| private WxAppinfoService wxAppinfoService; | private WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @InitBinder | @InitBinder | ||||
| public void InitBinder(WebDataBinder dataBinder) { | public void InitBinder(WebDataBinder dataBinder) { | ||||
| dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | ||||
| @@ -79,14 +85,21 @@ public class BaseController { | |||||
| } | } | ||||
| public WxMaService getWeappService(String appId) { | public WxMaService getWeappService(String appId) { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| if(isFmOpen) { | |||||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| } else { | |||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | |||||
| } | } | ||||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | ||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| if(!isFmOpen) { | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| public String getIpAddr() { | public String getIpAddr() { | ||||
| @@ -41,6 +41,9 @@ import java.util.Map; | |||||
| public class WxInfoController extends BaseController { | public class WxInfoController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @@ -115,28 +118,14 @@ public class WxInfoController extends BaseController { | |||||
| private Map<String,String> getOpenIdInfo(String appId, String code) { | private Map<String,String> getOpenIdInfo(String appId, String code) { | ||||
| WxAppinfo wxAppinfo = getAppInfo(appId); | WxAppinfo wxAppinfo = getAppInfo(appId); | ||||
| WxMaService wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||||
| try { | |||||
| String accessToken = wxMaService.getAccessToken(true); | |||||
| wxAppinfo.setAccessToken(accessToken); | |||||
| wxAppinfo.setLastTokenTime(new Date()); | |||||
| wxAppinfo.setExpiresIn(7200); | |||||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| WxMaService wxMaService = null; | |||||
| if(isFmOpen) { | |||||
| wxMaService = getWeappService(appId); | |||||
| } else { | } else { | ||||
| // 检查token是否已过期, 小时就重新获取 | |||||
| Date curDate = new Date(); | |||||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { | |||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||||
| try { | try { | ||||
| String accessToken = wxMaService.getAccessToken(true); | String accessToken = wxMaService.getAccessToken(true); | ||||
| wxAppinfo.setAccessToken(accessToken); | wxAppinfo.setAccessToken(accessToken); | ||||
| @@ -148,7 +137,26 @@ public class WxInfoController extends BaseController { | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| } | } | ||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | wxMaService = getWeappServiceByAppInfo(wxAppinfo); | ||||
| } else { | |||||
| // 检查token是否已过期, 小时就重新获取 | |||||
| Date curDate = new Date(); | |||||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { | |||||
| try { | |||||
| String accessToken = wxMaService.getAccessToken(true); | |||||
| wxAppinfo.setAccessToken(accessToken); | |||||
| wxAppinfo.setLastTokenTime(new Date()); | |||||
| wxAppinfo.setExpiresIn(7200); | |||||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -23,7 +23,6 @@ spring: | |||||
| maxOpenPreparedStatements: 20 | maxOpenPreparedStatements: 20 | ||||
| #jackson: | #jackson: | ||||
| #date-format: yyyy-MM-dd HH:mm:ss | #date-format: yyyy-MM-dd HH:mm:ss | ||||
| # REDIS | # REDIS | ||||
| redis: | redis: | ||||
| host: 202.165.179.86 | host: 202.165.179.86 | ||||
| @@ -63,8 +62,31 @@ jasypt: | |||||
| encryptor: | encryptor: | ||||
| password: oRqdnDbK5pj3eMmB | password: oRqdnDbK5pj3eMmB | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -65,8 +65,31 @@ aws: | |||||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | ||||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -65,8 +65,31 @@ aws: | |||||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | ||||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -21,11 +21,19 @@ public class CApplication { | |||||
| @Value("${fm.exception}") | @Value("${fm.exception}") | ||||
| private boolean fmException; | private boolean fmException; | ||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | @Bean | ||||
| public boolean isFmException() { | public boolean isFmException() { | ||||
| return fmException; | return fmException; | ||||
| } | } | ||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(CApplication.class, args); | SpringApplication.run(CApplication.class, args); | ||||
| @@ -9,6 +9,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.WxCUserService; | import com.iformall.service.WxCUserService; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| @@ -29,12 +30,18 @@ import java.util.List; | |||||
| @RestController | @RestController | ||||
| public class BaseController { | public class BaseController { | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @Autowired | @Autowired | ||||
| private WxAppinfoService wxAppinfoService; | private WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @@ -88,17 +95,25 @@ public class BaseController { | |||||
| } | } | ||||
| public WxMaService getWeappService(String appId) { | public WxMaService getWeappService(String appId) { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| if (appinfo == null) { | |||||
| return null; | |||||
| if(isFmOpen) { | |||||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| } else { | |||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| if (appinfo == null) { | |||||
| return null; | |||||
| } | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | } | ||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | } | ||||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | ||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| if(!isFmOpen) { | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import com.iformall.enums.EnumAssignTagsTrigger; | |||||
| import com.iformall.enums.EnumLevelConfigDiscountStatus; | import com.iformall.enums.EnumLevelConfigDiscountStatus; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -47,6 +48,9 @@ import java.util.Map; | |||||
| public class WxUserGrantController extends BaseController { | public class WxUserGrantController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserTokenService userTokenService; | private WxCUserTokenService userTokenService; | ||||
| @@ -71,6 +75,9 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @@ -108,19 +115,25 @@ public class WxUserGrantController extends BaseController { | |||||
| if(wxAppinfo == null) { | if(wxAppinfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| WxMaService wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| WxMaService wxMaService = null; | |||||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||||
| if(isFmOpen) { | |||||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| } else { | |||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | wxMaService = getWeappServiceByAppInfo(wxAppinfo); | ||||
| } else { | |||||
| // 检查token是否已过期, 1小时就重新获取 | |||||
| Date curDate = new Date(); | |||||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { | |||||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||||
| updateAppAccessToken(wxAppinfo, wxMaService); | updateAppAccessToken(wxAppinfo, wxMaService); | ||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | wxMaService = getWeappServiceByAppInfo(wxAppinfo); | ||||
| } else { | |||||
| // 检查token是否已过期, 1小时就重新获取 | |||||
| Date curDate = new Date(); | |||||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { | |||||
| updateAppAccessToken(wxAppinfo, wxMaService); | |||||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -58,6 +58,26 @@ aws: | |||||
| access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | ||||
| secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -65,6 +85,8 @@ jasypt: | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -65,10 +65,31 @@ aws: | |||||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | ||||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -65,8 +65,31 @@ aws: | |||||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | ||||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan; | |||||
| @EnableEncryptableProperties | @EnableEncryptableProperties | ||||
| public class ConsumerApplication { | public class ConsumerApplication { | ||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| @@ -77,6 +77,26 @@ aws: | |||||
| access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | ||||
| secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -84,6 +104,8 @@ jasypt: | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -66,10 +66,31 @@ aws: | |||||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | ||||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -66,8 +66,31 @@ aws: | |||||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | ||||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan; | |||||
| @EnableEncryptableProperties | @EnableEncryptableProperties | ||||
| public class ScheduleApplication { | public class ScheduleApplication { | ||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| @@ -19,6 +19,9 @@ public class WeChatAccessTokenSchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoMapper wxAppinfoMapper; | WxAppinfoMapper wxAppinfoMapper; | ||||
| @@ -27,12 +30,14 @@ public class WeChatAccessTokenSchedule { | |||||
| public void getAccessTokens() { | public void getAccessTokens() { | ||||
| logger.info("微信访问AccessToken获取定时任务启动"); | logger.info("微信访问AccessToken获取定时任务启动"); | ||||
| if(!isFmOpen) { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.findList(appinfoQ); | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.findList(appinfoQ); | |||||
| for (WxAppinfo appinfo : appList) { | |||||
| resetAccessToken(appinfo); | |||||
| for (WxAppinfo appinfo : appList) { | |||||
| resetAccessToken(appinfo); | |||||
| } | |||||
| } | } | ||||
| logger.info("微信访问AccessToken获取定时任务结束"); | logger.info("微信访问AccessToken获取定时任务结束"); | ||||
| @@ -5,6 +5,7 @@ import java.util.*; | |||||
| import cn.binarywang.wx.miniapp.api.WxMaService; | import cn.binarywang.wx.miniapp.api.WxMaService; | ||||
| import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend; | import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -24,12 +25,18 @@ import com.iformall.service.WxUserVisitService; | |||||
| @Component | @Component | ||||
| public class WxAppVisitSchedule { | public class WxAppVisitSchedule { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | |||||
| private WxUserVisitService wxUserVisitService; | |||||
| @Autowired | |||||
| private WxUserVisitService wxUserVisitService; | |||||
| @Autowired | |||||
| private WxAppinfoService WxAppinfoService; | |||||
| @Autowired | |||||
| private WxAppinfoService WxAppinfoService; | |||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Scheduled(cron = "0 0 9 * * ? ") //早晨9点做一次,获取前一日,微信时间为GMT | @Scheduled(cron = "0 0 9 * * ? ") //早晨9点做一次,获取前一日,微信时间为GMT | ||||
| @@ -96,7 +103,12 @@ public class WxAppVisitSchedule { | |||||
| } | } | ||||
| private void getData(Date lastDate,WxAppinfo appInfo) throws Exception { | private void getData(Date lastDate,WxAppinfo appInfo) throws Exception { | ||||
| WxMaService wxMaService = MaUtil.getWeappService(appInfo); | |||||
| WxMaService wxMaService = null; | |||||
| if(isFmOpen) { | |||||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appInfo.getAppId()); | |||||
| } else { | |||||
| wxMaService = MaUtil.getWeappService(appInfo); | |||||
| } | |||||
| try { | try { | ||||
| List<WxMaVisitTrend> vtList = wxMaService.getAnalysisService().getDailyVisitTrend(lastDate, lastDate); | List<WxMaVisitTrend> vtList = wxMaService.getAnalysisService().getDailyVisitTrend(lastDate, lastDate); | ||||
| logger.info(vtList.toString()); | logger.info(vtList.toString()); | ||||
| @@ -60,6 +60,26 @@ aws: | |||||
| access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | ||||
| secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -67,6 +87,8 @@ jasypt: | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -66,10 +66,31 @@ aws: | |||||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | ||||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -66,8 +66,31 @@ aws: | |||||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | ||||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -0,0 +1,69 @@ | |||||
| package com.iformall.config; | |||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||||
| /** | |||||
| * Stormeye | |||||
| */ | |||||
| @ConfigurationProperties(prefix = "wechat.open") | |||||
| public class WechatOpenProperties { | |||||
| /** | |||||
| * 设置微信三方平台的appid | |||||
| */ | |||||
| private String componentAppId; | |||||
| /** | |||||
| * 设置微信三方平台的app secret | |||||
| */ | |||||
| private String componentSecret; | |||||
| /** | |||||
| * 设置微信三方平台的token | |||||
| */ | |||||
| private String componentToken; | |||||
| /** | |||||
| * 设置微信三方平台的EncodingAESKey | |||||
| */ | |||||
| private String componentAesKey; | |||||
| public String getComponentAppId() { | |||||
| return componentAppId; | |||||
| } | |||||
| public void setComponentAppId(String componentAppId) { | |||||
| this.componentAppId = componentAppId; | |||||
| } | |||||
| public String getComponentSecret() { | |||||
| return componentSecret; | |||||
| } | |||||
| public void setComponentSecret(String componentSecret) { | |||||
| this.componentSecret = componentSecret; | |||||
| } | |||||
| public String getComponentToken() { | |||||
| return componentToken; | |||||
| } | |||||
| public void setComponentToken(String componentToken) { | |||||
| this.componentToken = componentToken; | |||||
| } | |||||
| public String getComponentAesKey() { | |||||
| return componentAesKey; | |||||
| } | |||||
| public void setComponentAesKey(String componentAesKey) { | |||||
| this.componentAesKey = componentAesKey; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringBuilder.reflectionToString(this, | |||||
| ToStringStyle.MULTI_LINE_STYLE); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,124 @@ | |||||
| package com.iformall.config; | |||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||||
| import redis.clients.jedis.JedisPoolConfig; | |||||
| import redis.clients.jedis.Protocol; | |||||
| import javax.net.ssl.HostnameVerifier; | |||||
| import javax.net.ssl.SSLParameters; | |||||
| import javax.net.ssl.SSLSocketFactory; | |||||
| /** | |||||
| * Stormeye | |||||
| */ | |||||
| @ConfigurationProperties(prefix = "wechat.redis") | |||||
| public class WechatRedisProperies extends JedisPoolConfig { | |||||
| private String host = Protocol.DEFAULT_HOST; | |||||
| private int port = Protocol.DEFAULT_PORT; | |||||
| private String password; | |||||
| private int database = 1; | |||||
| private int connectionTimeout = Protocol.DEFAULT_TIMEOUT; | |||||
| private int soTimeout = Protocol.DEFAULT_TIMEOUT; | |||||
| private String clientName; | |||||
| private boolean ssl; | |||||
| private SSLSocketFactory sslSocketFactory; | |||||
| private SSLParameters sslParameters; | |||||
| private HostnameVerifier hostnameVerifier; | |||||
| public boolean isSsl() { | |||||
| return ssl; | |||||
| } | |||||
| public void setSsl(boolean ssl) { | |||||
| this.ssl = ssl; | |||||
| } | |||||
| public SSLSocketFactory getSslSocketFactory() { | |||||
| return sslSocketFactory; | |||||
| } | |||||
| public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) { | |||||
| this.sslSocketFactory = sslSocketFactory; | |||||
| } | |||||
| public SSLParameters getSslParameters() { | |||||
| return sslParameters; | |||||
| } | |||||
| public void setSslParameters(SSLParameters sslParameters) { | |||||
| this.sslParameters = sslParameters; | |||||
| } | |||||
| public HostnameVerifier getHostnameVerifier() { | |||||
| return hostnameVerifier; | |||||
| } | |||||
| public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { | |||||
| this.hostnameVerifier = hostnameVerifier; | |||||
| } | |||||
| public String getHost() { | |||||
| return host; | |||||
| } | |||||
| public void setHost(String host) { | |||||
| if (host == null || "".equals(host)) { | |||||
| host = Protocol.DEFAULT_HOST; | |||||
| } | |||||
| this.host = host; | |||||
| } | |||||
| public int getPort() { | |||||
| return port; | |||||
| } | |||||
| public void setPort(int port) { | |||||
| this.port = port; | |||||
| } | |||||
| public String getPassword() { | |||||
| return password; | |||||
| } | |||||
| public void setPassword(String password) { | |||||
| if ("".equals(password)) { | |||||
| password = null; | |||||
| } | |||||
| this.password = password; | |||||
| } | |||||
| public int getDatabase() { | |||||
| return database; | |||||
| } | |||||
| public void setDatabase(int database) { | |||||
| this.database = database; | |||||
| } | |||||
| public String getClientName() { | |||||
| return clientName; | |||||
| } | |||||
| public void setClientName(String clientName) { | |||||
| if ("".equals(clientName)) { | |||||
| clientName = null; | |||||
| } | |||||
| this.clientName = clientName; | |||||
| } | |||||
| public int getConnectionTimeout() { | |||||
| return connectionTimeout; | |||||
| } | |||||
| public void setConnectionTimeout(int connectionTimeout) { | |||||
| this.connectionTimeout = connectionTimeout; | |||||
| } | |||||
| public int getSoTimeout() { | |||||
| return soTimeout; | |||||
| } | |||||
| public void setSoTimeout(int soTimeout) { | |||||
| this.soTimeout = soTimeout; | |||||
| } | |||||
| } | |||||
| @@ -9,9 +9,19 @@ public interface WxAuthorizerInfoMapper extends CommonMapper<WxAuthorizerInfo, L | |||||
| List<WxAuthorizerInfo> findList(WxAuthorizerInfo wxAuthorizerInfo); | List<WxAuthorizerInfo> findList(WxAuthorizerInfo wxAuthorizerInfo); | ||||
| List<WxWeappInfo> findWeappList(); | |||||
| List<WxWeappInfo> findWxMpList(); | |||||
| List<WxWeappInfo> findVoList(WxWeappInfo wxWeappInfo); | List<WxWeappInfo> findVoList(WxWeappInfo wxWeappInfo); | ||||
| void updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||||
| WxWeappInfo findVo(WxWeappInfo wxWeappInfo); | |||||
| int updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||||
| int updateRefreshToken(WxAuthorizerInfo wxAuthorizerInfo); | |||||
| int updateAccessToken(WxAuthorizerInfo wxAuthorizerInfo); | |||||
| @@ -7,10 +7,8 @@ import com.iformall.domain.po.WxComponentVerifyTicket; | |||||
| public interface WxComponentVerifyTicketMapper extends CommonMapper<WxComponentVerifyTicket, Long> { | public interface WxComponentVerifyTicketMapper extends CommonMapper<WxComponentVerifyTicket, Long> { | ||||
| List<WxComponentVerifyTicket> findList(WxComponentVerifyTicket wxComponentVerifyTicket); | List<WxComponentVerifyTicket> findList(WxComponentVerifyTicket wxComponentVerifyTicket); | ||||
| int updateAccessToken(WxComponentVerifyTicket wxComponentVerifyTicket); | |||||
| } | } | ||||
| @@ -63,13 +63,6 @@ public interface WxAppinfoService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 更新accessToken | |||||
| * @param appId | |||||
| */ | |||||
| void ctokenUpdate(String appId); | |||||
| /** | /** | ||||
| * 位置码/导购码生成 | * 位置码/导购码生成 | ||||
| */ | */ | ||||
| @@ -8,6 +8,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxTemplateMsgMapper; | import com.iformall.mapper.WxTemplateMsgMapper; | ||||
| import com.iformall.service.MsgSendService; | import com.iformall.service.MsgSendService; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -24,18 +25,28 @@ import java.util.List; | |||||
| public class SendSmartAppMsgServiceImpl implements MsgSendService { | public class SendSmartAppMsgServiceImpl implements MsgSendService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| private boolean isFmOpen; | |||||
| @Autowired | |||||
| private WxTemplateMsgMapper wxTemplateMsgMapper; | private WxTemplateMsgMapper wxTemplateMsgMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxAppinfoService wxAppinfoService; | private WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg; | SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg; | ||||
| WxTemplateMsg msg = null; | WxTemplateMsg msg = null; | ||||
| WxMaTemplateMessage templateMessage; | WxMaTemplateMessage templateMessage; | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(smartAppMsg.getAppId()); | |||||
| WxMaService wxMaService = MaUtil.getWeappService(appInfo); | |||||
| WxMaService wxMaService = null; | |||||
| if(isFmOpen) { | |||||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(smartAppMsg.getAppId()); | |||||
| } else { | |||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(smartAppMsg.getAppId()); | |||||
| wxMaService = MaUtil.getWeappService(appInfo); | |||||
| } | |||||
| //查询信息模板 | //查询信息模板 | ||||
| WxTemplateMsg msgQ = new WxTemplateMsg(); | WxTemplateMsg msgQ = new WxTemplateMsg(); | ||||
| @@ -87,43 +87,6 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| wxAppinfoMapper.deleteByPrimaryKey(id); | wxAppinfoMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| /** | |||||
| * 租户c端小程序更新token | |||||
| * @param tenantId | |||||
| */ | |||||
| @Override | |||||
| public void ctokenUpdate(String tenantId) { | |||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setTenantId(tenantId); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.findList(appQ); | |||||
| if (appList.size() <= 0) { | |||||
| return; | |||||
| } | |||||
| WxAppinfo appinfo = appList.get(0); | |||||
| if(appinfo == null) { | |||||
| return; | |||||
| } | |||||
| // get access_token | |||||
| WxMaService wxMaService = MaUtil.getWeappService(appinfo); | |||||
| if(wxMaService == null) { | |||||
| return; | |||||
| } | |||||
| String access_token = ""; | |||||
| try{ | |||||
| access_token = wxMaService.getAccessToken(); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| Date date = new Date(); | |||||
| // update db | |||||
| appinfo.setAccessToken(access_token); | |||||
| appinfo.setLastTokenTime(date); | |||||
| wxAppinfoMapper.updateByPrimaryKeySelective(appinfo); | |||||
| } | |||||
| private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { | private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { | ||||
| try { | try { | ||||
| response.reset(); | response.reset(); | ||||
| @@ -13,13 +13,13 @@ import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxScreenAd; | import com.iformall.domain.po.WxScreenAd; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.enums.EnumCouponChannelType; | import com.iformall.enums.EnumCouponChannelType; | ||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.enums.EnumScreenAdType; | import com.iformall.enums.EnumScreenAdType; | ||||
| import com.iformall.mapper.WxCampaignMapper; | import com.iformall.mapper.WxCampaignMapper; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxScreenAdMapper; | import com.iformall.mapper.WxScreenAdMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxScreenAdService; | import com.iformall.service.WxScreenAdService; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -33,6 +33,9 @@ import java.util.List; | |||||
| @Service | @Service | ||||
| public class WxScreenAdServiceImpl implements WxScreenAdService { | public class WxScreenAdServiceImpl implements WxScreenAdService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| WxScreenAdMapper wxScreenAdMapper; | WxScreenAdMapper wxScreenAdMapper; | ||||
| @@ -40,6 +43,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @@ -162,12 +168,18 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| private static String QRCODE_JUMP_CMD_COUPON = "JC"; | private static String QRCODE_JUMP_CMD_COUPON = "JC"; | ||||
| private static String QRCODE_JUMP_CMD_GROUP = "JG"; | private static String QRCODE_JUMP_CMD_GROUP = "JG"; | ||||
| private static String QRCODE_JUMP_CMD_CAMPGIN = "JB"; | private static String QRCODE_JUMP_CMD_CAMPGIN = "JB"; | ||||
| private byte[] getQrcode(Long id, int type, int subType, WxAppinfo appInfo) throws Exception { | private byte[] getQrcode(Long id, int type, int subType, WxAppinfo appInfo) throws Exception { | ||||
| if(appInfo == null) { | if(appInfo == null) { | ||||
| logger.error("QRCODE get error: appinfo is null"); | logger.error("QRCODE get error: appinfo is null"); | ||||
| return null; | return null; | ||||
| } | } | ||||
| WxMaService wxMaService = MaUtil.getWeappService(appInfo); | |||||
| WxMaService wxMaService = null; | |||||
| if(isFmOpen) { | |||||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appInfo.getAppId()); | |||||
| } else { | |||||
| wxMaService = MaUtil.getWeappService(appInfo); | |||||
| } | |||||
| String scene = ""; | String scene = ""; | ||||
| if (EnumScreenAdType.COUPON.getCode().equals(type)) { | if (EnumScreenAdType.COUPON.getCode().equals(type)) { | ||||
| @@ -0,0 +1,253 @@ | |||||
| package com.iformall.service.wechat; | |||||
| import com.iformall.common.MipHttpClientBuilder; | |||||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||||
| import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||||
| import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||||
| import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; | |||||
| import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import redis.clients.jedis.Jedis; | |||||
| import redis.clients.jedis.JedisPool; | |||||
| import redis.clients.util.Pool; | |||||
| import java.util.Date; | |||||
| public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { | |||||
| private final static String COMPONENT_VERIFY_TICKET_KEY = "wechat_component_verify_ticket:"; | |||||
| private final static String COMPONENT_ACCESS_TOKEN_KEY = "wechat_component_access_token:"; | |||||
| private final static String AUTHORIZER_REFRESH_TOKEN_KEY = "wechat_authorizer_refresh_token:"; | |||||
| private final static String AUTHORIZER_ACCESS_TOKEN_KEY = "wechat_authorizer_access_token:"; | |||||
| private final static String JSAPI_TICKET_KEY = "wechat_jsapi_ticket:"; | |||||
| private final static String CARD_API_TICKET_KEY = "wechat_card_api_ticket:"; | |||||
| protected final Pool<Jedis> jedisPool; | |||||
| private WxComponentVerifyTicketMapper wxComponentVerifyTicketMapper; | |||||
| private WxAuthorizerInfoMapper wxAuthorizerInfoMapper; | |||||
| /** | |||||
| * redis 存储的 key 的前缀,可为空 | |||||
| */ | |||||
| private String keyPrefix; | |||||
| private String componentVerifyTicketKey; | |||||
| private String componentAccessTokenKey; | |||||
| private String authorizerRefreshTokenKey; | |||||
| private String authorizerAccessTokenKey; | |||||
| private String jsapiTicketKey; | |||||
| private String cardApiTicket; | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| public FmOpenInRedisDBConfigStorage(Pool<Jedis> jedisPool) { | |||||
| this.jedisPool = jedisPool; | |||||
| } | |||||
| public FmOpenInRedisDBConfigStorage(Pool<Jedis> jedisPool, String keyPrefix) { | |||||
| this.jedisPool = jedisPool; | |||||
| this.keyPrefix = keyPrefix; | |||||
| } | |||||
| public FmOpenInRedisDBConfigStorage(JedisPool jedisPool, WxComponentVerifyTicketMapper componentVerifyTicketMapper, WxAuthorizerInfoMapper authorizerInfoMapper) { | |||||
| this.jedisPool = jedisPool; | |||||
| this.wxComponentVerifyTicketMapper = componentVerifyTicketMapper; | |||||
| this.wxAuthorizerInfoMapper = authorizerInfoMapper; | |||||
| } | |||||
| @Override | |||||
| public void setComponentAppId(String componentAppId) { | |||||
| super.setComponentAppId(componentAppId); | |||||
| String prefix = StringUtils.isBlank(keyPrefix) ? "" : | |||||
| (StringUtils.endsWith(keyPrefix, ":") ? keyPrefix : (keyPrefix + ":")); | |||||
| componentVerifyTicketKey = prefix + COMPONENT_VERIFY_TICKET_KEY.concat(componentAppId); | |||||
| componentAccessTokenKey = prefix + COMPONENT_ACCESS_TOKEN_KEY.concat(componentAppId); | |||||
| authorizerRefreshTokenKey = prefix + AUTHORIZER_REFRESH_TOKEN_KEY.concat(componentAppId); | |||||
| authorizerAccessTokenKey = prefix + AUTHORIZER_ACCESS_TOKEN_KEY.concat(componentAppId); | |||||
| this.jsapiTicketKey = JSAPI_TICKET_KEY.concat(componentAppId); | |||||
| this.cardApiTicket = CARD_API_TICKET_KEY.concat(componentAppId); | |||||
| } | |||||
| @Override | |||||
| public String getComponentVerifyTicket() { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.componentVerifyTicketKey); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void setComponentVerifyTicket(String componentVerifyTicket) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.set(this.componentVerifyTicketKey, componentVerifyTicket); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public String getComponentAccessToken() { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.componentAccessTokenKey); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean isComponentAccessTokenExpired() { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.ttl(this.componentAccessTokenKey) < 2; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void expireComponentAccessToken(){ | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.expire(this.componentAccessTokenKey, 0); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void updateComponentAccessTokent(String componentAccessToken, int expiresInSeconds) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); | |||||
| WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); | |||||
| ticket.setComponentAppid(getComponentAppId()); | |||||
| ticket.setAccessToken(componentAccessToken); | |||||
| ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (expiresInSeconds * 1000)))); | |||||
| int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); | |||||
| logger.info("updateComponentVerifyTicketAccessToken rows: " + num); | |||||
| } | |||||
| } | |||||
| private String getKey(String prefix, String appId) { | |||||
| return prefix.endsWith(":") ? prefix.concat(appId) : prefix.concat(":").concat(appId); | |||||
| } | |||||
| @Override | |||||
| public String getAuthorizerRefreshToken(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.getKey(this.authorizerRefreshTokenKey, appId)); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void setAuthorizerRefreshToken(String appId, String authorizerRefreshToken) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.set(this.getKey(this.authorizerRefreshTokenKey, appId), authorizerRefreshToken); | |||||
| WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | |||||
| authorizerInfo.setAuthorizerAppid(appId); | |||||
| authorizerInfo.setRefreshToken(authorizerRefreshToken); | |||||
| int num = wxAuthorizerInfoMapper.updateRefreshToken(authorizerInfo); | |||||
| logger.info("setAuthorizerRefreshToken " + appId + " rows: " + num); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public String getAuthorizerAccessToken(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.getKey(this.authorizerAccessTokenKey, appId)); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean isAuthorizerAccessTokenExpired(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.ttl(this.getKey(this.authorizerAccessTokenKey, appId)) < 2; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void expireAuthorizerAccessToken(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.expire(this.getKey(this.authorizerAccessTokenKey, appId), 0); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void updateAuthorizerAccessToken(String appId, WxOpenAuthorizerAccessToken authorizerAccessToken) { | |||||
| this.updateAuthorizerAccessToken(appId, authorizerAccessToken.getAuthorizerAccessToken(), authorizerAccessToken.getExpiresIn()); | |||||
| WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | |||||
| authorizerInfo.setAuthorizerAppid(appId); | |||||
| authorizerInfo.setAccessToken(authorizerAccessToken.getAuthorizerAccessToken()); | |||||
| authorizerInfo.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (authorizerAccessToken.getExpiresIn() * 1000)))); | |||||
| int num = wxAuthorizerInfoMapper.updateAccessToken(authorizerInfo); | |||||
| logger.info("updateAuthorizerAccessToken " + appId + " rows: " + num); | |||||
| } | |||||
| @Override | |||||
| public void updateAuthorizerAccessToken(String appId, String authorizerAccessToken, int expiresInSeconds) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.setex(this.getKey(this.authorizerAccessTokenKey, appId), expiresInSeconds - 200, authorizerAccessToken); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public String getJsapiTicket(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.getKey(this.jsapiTicketKey, appId)); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean isJsapiTicketExpired(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.ttl(this.getKey(this.jsapiTicketKey, appId)) < 2; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void expireJsapiTicket(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.expire(this.getKey(this.jsapiTicketKey, appId), 0); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void updateJsapiTicket(String appId, String jsapiTicket, int expiresInSeconds) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.setex(this.getKey(this.jsapiTicketKey, appId), expiresInSeconds - 200, jsapiTicket); | |||||
| } | |||||
| // TODO update to DB | |||||
| } | |||||
| @Override | |||||
| public String getCardApiTicket(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.get(this.getKey(this.cardApiTicket, appId)); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public boolean isCardApiTicketExpired(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| return jedis.ttl(this.getKey(this.cardApiTicket, appId)) < 2; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void expireCardApiTicket(String appId) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.expire(this.getKey(this.cardApiTicket, appId), 0); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void updateCardApiTicket(String appId, String cardApiTicket, int expiresInSeconds) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||||
| jedis.setex(this.getKey(this.cardApiTicket, appId), expiresInSeconds - 200, cardApiTicket); | |||||
| } | |||||
| // TODO update to DB | |||||
| } | |||||
| @Override | |||||
| public ApacheHttpClientBuilder getApacheHttpClientBuilder() { | |||||
| return MipHttpClientBuilder.get(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,73 @@ | |||||
| package com.iformall.service.wechat; | |||||
| import com.iformall.config.WechatOpenProperties; | |||||
| import com.iformall.config.WechatRedisProperies; | |||||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||||
| import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||||
| import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter; | |||||
| import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | |||||
| import org.springframework.stereotype.Service; | |||||
| import redis.clients.jedis.JedisPool; | |||||
| import javax.annotation.PostConstruct; | |||||
| /** | |||||
| * Stormeye WU | |||||
| */ | |||||
| @Service | |||||
| @EnableConfigurationProperties({WechatOpenProperties.class, WechatRedisProperies.class}) | |||||
| public class FmOpenService extends WxOpenServiceImpl { | |||||
| private Logger logger = LoggerFactory.getLogger(getClass()); | |||||
| @Autowired | |||||
| private WechatOpenProperties wechatProperties; | |||||
| @Autowired | |||||
| private WechatRedisProperies redisProperies; | |||||
| @Autowired | |||||
| private WxComponentVerifyTicketMapper componentVerifyTicketMapper; | |||||
| @Autowired | |||||
| private WxAuthorizerInfoMapper authorizerInfoMapper; | |||||
| private static JedisPool pool; | |||||
| private WxOpenMessageRouter wxOpenMessageRouter; | |||||
| @PostConstruct | |||||
| public void init() { | |||||
| FmOpenInRedisDBConfigStorage configStorage = new FmOpenInRedisDBConfigStorage(getJedisPool(), componentVerifyTicketMapper, authorizerInfoMapper); | |||||
| configStorage.setComponentAppId(wechatProperties.getComponentAppId()); | |||||
| configStorage.setComponentAppSecret(wechatProperties.getComponentSecret()); | |||||
| configStorage.setComponentToken(wechatProperties.getComponentToken()); | |||||
| configStorage.setComponentAesKey(wechatProperties.getComponentAesKey()); | |||||
| setWxOpenConfigStorage(configStorage); | |||||
| wxOpenMessageRouter = new WxOpenMessageRouter(this); | |||||
| wxOpenMessageRouter.rule().handler((wxMpXmlMessage, map, wxMpService, wxSessionManager) -> { | |||||
| logger.info("\n接收到 {} 公众号请求消息,内容:{}", wxMpService.getWxMpConfigStorage().getAppId(), wxMpXmlMessage); | |||||
| return null; | |||||
| }).next(); | |||||
| } | |||||
| public WxOpenMessageRouter getWxOpenMessageRouter() { | |||||
| return wxOpenMessageRouter; | |||||
| } | |||||
| private JedisPool getJedisPool() { | |||||
| if (pool == null) { | |||||
| synchronized (FmOpenService.class) { | |||||
| if (pool == null) { | |||||
| pool = new JedisPool(redisProperies, redisProperies.getHost(), | |||||
| redisProperies.getPort(), redisProperies.getConnectionTimeout(), | |||||
| redisProperies.getSoTimeout(), redisProperies.getPassword(), | |||||
| redisProperies.getDatabase(), redisProperies.getClientName(), | |||||
| redisProperies.isSsl(), redisProperies.getSslSocketFactory(), | |||||
| redisProperies.getSslParameters(), redisProperies.getHostnameVerifier()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return pool; | |||||
| } | |||||
| } | |||||
| @@ -246,6 +246,14 @@ | |||||
| <include refid="dynamicVWhereConditions" /> | <include refid="dynamicVWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findVo" parameterType="com.iformall.domain.vo.WxWeappInfo" resultMap="VBaseResultMap"> | |||||
| select | |||||
| <include refid="allVColumns"/> | |||||
| from wx_authorizer_info ai | |||||
| left join wx_appinfo a on ai.`authorizer_appid` = a.app_id | |||||
| where ai.`authorizer_appid` = #{authorizerAppid} | |||||
| </select> | |||||
| <select id="findWeappList" resultMap="BaseResultMap"> | <select id="findWeappList" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allVColumns"/> | <include refid="allVColumns"/> | ||||
| @@ -19,13 +19,21 @@ import tk.mybatis.spring.annotation.MapperScan; | |||||
| @EnableEncryptableProperties | @EnableEncryptableProperties | ||||
| public class SocketServerApplication { | public class SocketServerApplication { | ||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Value("${fm.exception}") | |||||
| private boolean fmException; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Value("${fm.open}") | |||||
| private boolean fmOpen; | |||||
| @Bean | |||||
| public boolean isFmException() { | |||||
| return fmException; | |||||
| } | |||||
| @Bean | |||||
| public boolean isFmOpen() { | |||||
| return fmOpen; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| @@ -10,6 +10,7 @@ import com.iformall.interceptor.AuthHandshakeInterceptor; | |||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.WxCUserService; | import com.iformall.service.WxCUserService; | ||||
| import com.iformall.service.wechat.FmOpenService; | |||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import com.iformall.utils.MaUtil; | import com.iformall.utils.MaUtil; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -29,12 +30,18 @@ import java.util.List; | |||||
| @RestController | @RestController | ||||
| public class BaseController { | public class BaseController { | ||||
| @Autowired | |||||
| private boolean isFmOpen; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @Autowired | @Autowired | ||||
| private WxAppinfoService wxAppinfoService; | private WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| private FmOpenService openService; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @@ -86,17 +93,24 @@ public class BaseController { | |||||
| } | } | ||||
| public WxMaService getWeappService(String appId) { | public WxMaService getWeappService(String appId) { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| if (appinfo == null) { | |||||
| return null; | |||||
| if(isFmOpen) { | |||||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| } else { | |||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| if (appinfo == null) { | |||||
| return null; | |||||
| } | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | } | ||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | } | ||||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | ||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| if(!isFmOpen) { | |||||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||||
| return service; | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| @@ -74,6 +74,26 @@ aws: | |||||
| access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) | ||||
| secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: "wx897e4673286c915d" | |||||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||||
| componentToken: "formall2018" | |||||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||||
| redis: | |||||
| host: 202.165.179.86 | |||||
| port: 6379 | |||||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 500 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -81,6 +101,8 @@ jasypt: | |||||
| fm: | fm: | ||||
| exception: false | exception: false | ||||
| deploy: 1 | |||||
| open: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -63,10 +63,31 @@ aws: | |||||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | ||||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 3 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -63,8 +63,31 @@ aws: | |||||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | ||||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | ||||
| wechat: | |||||
| open: | |||||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||||
| redis: | |||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||||
| timeout: 3600 | |||||
| expire: 1800 #30分钟 | |||||
| database: 2 | |||||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||||
| jedis: | |||||
| pool: | |||||
| max-active: 100 | |||||
| max-idle: 100 | |||||
| max-wait: -1 | |||||
| min-idle: 10 | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| deploy: 2 | |||||
| open: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -33,6 +33,7 @@ | |||||
| <weixin-java-mp.version>3.3.0</weixin-java-mp.version> | <weixin-java-mp.version>3.3.0</weixin-java-mp.version> | ||||
| <weixin-java-miniapp.version>3.3.0</weixin-java-miniapp.version> | <weixin-java-miniapp.version>3.3.0</weixin-java-miniapp.version> | ||||
| <weixin-java-pay.version>3.3.0</weixin-java-pay.version> | <weixin-java-pay.version>3.3.0</weixin-java-pay.version> | ||||
| <weixin-java-open.version>3.3.0</weixin-java-open.version> | |||||
| <quartz.version>2.3.0</quartz.version> | <quartz.version>2.3.0</quartz.version> | ||||
| </properties> | </properties> | ||||
| @@ -337,6 +338,12 @@ | |||||
| <version>${weixin-java-pay.version}</version> | <version>${weixin-java-pay.version}</version> | ||||
| </dependency> | </dependency> | ||||
| <dependency> | |||||
| <groupId>com.github.binarywang</groupId> | |||||
| <artifactId>weixin-java-open</artifactId> | |||||
| <version>${weixin-java-open.version}</version> | |||||
| </dependency> | |||||
| <dependency> | <dependency> | ||||
| <groupId>com.github.ulisesbocchio</groupId> | <groupId>com.github.ulisesbocchio</groupId> | ||||
| <artifactId>jasypt-spring-boot</artifactId> | <artifactId>jasypt-spring-boot</artifactId> | ||||