Просмотр исходного кода

[微信开放平台][修改]:accessToken获取启用微信第三方开放平台

release_toaliyun_real
Stormeye Wu 7 лет назад
Родитель
Сommit
9fcf20f63a
44 измененных файлов: 1190 добавлений и 160 удалений
  1. +14
    -6
      mallinkAdmin/src/main/java/com/iformall/UserApplication.java
  2. +0
    -14
      mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java
  3. +22
    -1
      mallinkAdmin/src/main/resources/application-dev.yml
  4. +28
    -7
      mallinkAdmin/src/main/resources/application-prod.yml
  5. +21
    -0
      mallinkAdmin/src/main/resources/application-test.yml
  6. +8
    -0
      mallinkBApi/src/main/java/com/iformall/BApplication.java
  7. +18
    -5
      mallinkBApi/src/main/java/com/iformall/controller/BaseController.java
  8. +28
    -20
      mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java
  9. +23
    -1
      mallinkBApi/src/main/resources/application-dev.yml
  10. +23
    -0
      mallinkBApi/src/main/resources/application-prod.yml
  11. +23
    -0
      mallinkBApi/src/main/resources/application-test.yml
  12. +8
    -0
      mallinkCApi/src/main/java/com/iformall/CApplication.java
  13. +22
    -7
      mallinkCApi/src/main/java/com/iformall/controller/BaseController.java
  14. +21
    -8
      mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java
  15. +22
    -0
      mallinkCApi/src/main/resources/application-dev.yml
  16. +22
    -1
      mallinkCApi/src/main/resources/application-prod.yml
  17. +23
    -0
      mallinkCApi/src/main/resources/application-test.yml
  18. +14
    -6
      mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java
  19. +22
    -0
      mallinkMQConsumer/src/main/resources/application-dev.yml
  20. +22
    -1
      mallinkMQConsumer/src/main/resources/application-prod.yml
  21. +23
    -0
      mallinkMQConsumer/src/main/resources/application-test.yml
  22. +14
    -6
      mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java
  23. +9
    -4
      mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java
  24. +17
    -5
      mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java
  25. +22
    -0
      mallinkSchedule/src/main/resources/application-dev.yml
  26. +22
    -1
      mallinkSchedule/src/main/resources/application-prod.yml
  27. +23
    -0
      mallinkSchedule/src/main/resources/application-test.yml
  28. +69
    -0
      mallinkService/src/main/java/com/iformall/config/WechatOpenProperties.java
  29. +124
    -0
      mallinkService/src/main/java/com/iformall/config/WechatRedisProperies.java
  30. +11
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java
  31. +2
    -4
      mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java
  32. +0
    -7
      mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java
  33. +13
    -2
      mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java
  34. +0
    -37
      mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java
  35. +14
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java
  36. +253
    -0
      mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java
  37. +73
    -0
      mallinkService/src/main/java/com/iformall/service/wechat/FmOpenService.java
  38. +8
    -0
      mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml
  39. +14
    -6
      mallinkWebSocketServer/src/main/java/com/iformall/SocketServerApplication.java
  40. +21
    -7
      mallinkWebSocketServer/src/main/java/com/iformall/controller/BaseController.java
  41. +22
    -0
      mallinkWebSocketServer/src/main/resources/application-dev.yml
  42. +22
    -1
      mallinkWebSocketServer/src/main/resources/application-prod.yml
  43. +23
    -0
      mallinkWebSocketServer/src/main/resources/application-test.yml
  44. +7
    -0
      pom.xml

+ 14
- 6
mallinkAdmin/src/main/java/com/iformall/UserApplication.java Просмотреть файл

@@ -22,13 +22,21 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableRocketMQ
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) {
SpringApplication.run(UserApplication.class, args);


+ 0
- 14
mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java Просмотреть файл

@@ -74,20 +74,6 @@ public class WxAppinfoController extends BaseController {
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\"}")
@PostMapping("/downQrCode")
public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) {


+ 22
- 1
mallinkAdmin/src/main/resources/application-dev.yml Просмотреть файл

@@ -22,7 +22,7 @@ spring:
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000"
#jackson:
#jackson:
#date-format: yyyy-MM-dd HH:mm:ss
# REDIS
redis:
@@ -85,6 +85,25 @@ wechat:
appId: "wxe31beafbfd8295ba"
secret: "c689fabf3c4c9f5b6424ff2a36a26727"
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:
encryptor:
@@ -92,6 +111,8 @@ jasypt:

fm:
exception: false
deploy: 1
open: false

ueditor:
config: config.json


+ 28
- 7
mallinkAdmin/src/main/resources/application-prod.yml Просмотреть файл

@@ -44,13 +44,13 @@ spring:
password: ENC(APQMO9XQRzMKd0eap+oSSOYH9MQe/r5K0YFF9A9mizU=) # 授权密码
properties:
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:
host: localhost
@@ -73,9 +73,30 @@ wechat:
appId: "wx9cc4ca09eb20fe03"
secret: "af1d7f7a1268022a73cb4ce0b9cf0985"
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:
exception: true
deploy: 3
open: true

ueditor:
config: config.json


+ 21
- 0
mallinkAdmin/src/main/resources/application-test.yml Просмотреть файл

@@ -73,9 +73,30 @@ wechat:
appId: "wx091907dd0bfd3f6b"
secret: "2a2ca10738998b9ef92c1fe8a4d366a6"
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:
exception: true
deploy: 2
open: true

ueditor:
config: config.json


+ 8
- 0
mallinkBApi/src/main/java/com/iformall/BApplication.java Просмотреть файл

@@ -21,11 +21,19 @@ public class BApplication {
@Value("${fm.exception}")
private boolean 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) {
SpringApplication.run(BApplication.class, args);


+ 18
- 5
mallinkBApi/src/main/java/com/iformall/controller/BaseController.java Просмотреть файл

@@ -12,6 +12,7 @@ import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxMerchantBUserService;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.Constant;
import com.iformall.utils.IPUtil;
import com.iformall.utils.MaUtil;
@@ -26,12 +27,17 @@ import javax.servlet.http.HttpServletRequest;

@RestController
public class BaseController {
@Autowired
private boolean isFmOpen;
@Autowired
private WxMerchantBUserService wxMerchantBUserService;

@Autowired
private WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@InitBinder
public void InitBinder(WebDataBinder dataBinder) {
dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@@ -79,14 +85,21 @@ public class BaseController {
}

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) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
if(!isFmOpen) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
}
return null;
}

public String getIpAddr() {


+ 28
- 20
mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java Просмотреть файл

@@ -41,6 +41,9 @@ import java.util.Map;
public class WxInfoController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private boolean isFmOpen;

@Autowired
WxAppinfoService wxAppinfoService;

@@ -115,28 +118,14 @@ public class WxInfoController extends BaseController {

private Map<String,String> getOpenIdInfo(String appId, String code) {
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 {
// 检查token是否已过期, 小时就重新获取
Date curDate = new Date();
if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) {
wxMaService = getWeappServiceByAppInfo(wxAppinfo);
if(StringUtils.isBlank(wxAppinfo.getAccessToken())) {
// 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用
try {
String accessToken = wxMaService.getAccessToken(true);
wxAppinfo.setAccessToken(accessToken);
@@ -148,7 +137,26 @@ public class WxInfoController extends BaseController {
} catch (Exception e) {
logger.error(e.getMessage());
}

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
- 1
mallinkBApi/src/main/resources/application-dev.yml Просмотреть файл

@@ -23,7 +23,6 @@ spring:
maxOpenPreparedStatements: 20
#jackson:
#date-format: yyyy-MM-dd HH:mm:ss

# REDIS
redis:
host: 202.165.179.86
@@ -63,8 +62,31 @@ jasypt:
encryptor:
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:
exception: false
deploy: 1
open: false

logging:
level:


+ 23
- 0
mallinkBApi/src/main/resources/application-prod.yml Просмотреть файл

@@ -65,8 +65,31 @@ aws:
access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=)
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:
exception: true
deploy: 3
open: true

logging:
level:


+ 23
- 0
mallinkBApi/src/main/resources/application-test.yml Просмотреть файл

@@ -65,8 +65,31 @@ aws:
access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=)
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:
exception: true
deploy: 2
open: true

logging:
level:


+ 8
- 0
mallinkCApi/src/main/java/com/iformall/CApplication.java Просмотреть файл

@@ -21,11 +21,19 @@ public class CApplication {
@Value("${fm.exception}")
private boolean 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) {
SpringApplication.run(CApplication.class, args);


+ 22
- 7
mallinkCApi/src/main/java/com/iformall/controller/BaseController.java Просмотреть файл

@@ -9,6 +9,7 @@ import com.iformall.exception.MallinkException;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserService;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.Constant;
import com.iformall.utils.IPUtil;
import com.iformall.utils.MaUtil;
@@ -29,12 +30,18 @@ import java.util.List;

@RestController
public class BaseController {
@Autowired
private boolean isFmOpen;

@Autowired
private WxCUserService wxCUserService;

@Autowired
private WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@@ -88,17 +95,25 @@ public class BaseController {
}

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) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
if(!isFmOpen) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
}
return null;
}




+ 21
- 8
mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java Просмотреть файл

@@ -18,6 +18,7 @@ import com.iformall.enums.EnumAssignTagsTrigger;
import com.iformall.enums.EnumLevelConfigDiscountStatus;
import com.iformall.enums.EnumScoreType;
import com.iformall.service.*;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.Constant;
import com.iformall.utils.IPUtil;
import io.swagger.annotations.Api;
@@ -47,6 +48,9 @@ import java.util.Map;
public class WxUserGrantController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private boolean isFmOpen;

@Autowired
private WxCUserTokenService userTokenService;

@@ -71,6 +75,9 @@ public class WxUserGrantController extends BaseController {
@Autowired
WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@Autowired
WxMerchantService wxMerchantService;

@@ -108,19 +115,25 @@ public class WxUserGrantController extends BaseController {
if(wxAppinfo == null) {
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);

} 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);
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);
}
}
}



+ 22
- 0
mallinkCApi/src/main/resources/application-dev.yml Просмотреть файл

@@ -58,6 +58,26 @@ aws:
access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=)
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:
encryptor:
@@ -65,6 +85,8 @@ jasypt:

fm:
exception: false
deploy: 1
open: true

logging:
level:


+ 22
- 1
mallinkCApi/src/main/resources/application-prod.yml Просмотреть файл

@@ -65,10 +65,31 @@ aws:
access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=)
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:
exception: true
deploy: 3
open: true

logging:
level:


+ 23
- 0
mallinkCApi/src/main/resources/application-test.yml Просмотреть файл

@@ -65,8 +65,31 @@ aws:
access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=)
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:
exception: true
deploy: 2
open: true

logging:
level:


+ 14
- 6
mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java Просмотреть файл

@@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableEncryptableProperties
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) {


+ 22
- 0
mallinkMQConsumer/src/main/resources/application-dev.yml Просмотреть файл

@@ -77,6 +77,26 @@ aws:
access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=)
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:
encryptor:
@@ -84,6 +104,8 @@ jasypt:

fm:
exception: false
deploy: 1
open: false

logging:
level:


+ 22
- 1
mallinkMQConsumer/src/main/resources/application-prod.yml Просмотреть файл

@@ -66,10 +66,31 @@ aws:
access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=)
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:
exception: true
deploy: 3
open: true

logging:
level:


+ 23
- 0
mallinkMQConsumer/src/main/resources/application-test.yml Просмотреть файл

@@ -66,8 +66,31 @@ aws:
access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=)
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:
exception: true
deploy: 2
open: true

logging:
level:


+ 14
- 6
mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java Просмотреть файл

@@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableEncryptableProperties
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) {


+ 9
- 4
mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java Просмотреть файл

@@ -19,6 +19,9 @@ public class WeChatAccessTokenSchedule {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private boolean isFmOpen;

@Autowired
WxAppinfoMapper wxAppinfoMapper;

@@ -27,12 +30,14 @@ public class WeChatAccessTokenSchedule {
public void getAccessTokens() {

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获取定时任务结束");


+ 17
- 5
mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java Просмотреть файл

@@ -5,6 +5,7 @@ import java.util.*;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.MaUtil;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
@@ -24,12 +25,18 @@ import com.iformall.service.WxUserVisitService;
@Component
public class WxAppVisitSchedule {
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
@@ -96,7 +103,12 @@ public class WxAppVisitSchedule {
}
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 {
List<WxMaVisitTrend> vtList = wxMaService.getAnalysisService().getDailyVisitTrend(lastDate, lastDate);
logger.info(vtList.toString());


+ 22
- 0
mallinkSchedule/src/main/resources/application-dev.yml Просмотреть файл

@@ -60,6 +60,26 @@ aws:
access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=)
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:
encryptor:
@@ -67,6 +87,8 @@ jasypt:

fm:
exception: false
deploy: 1
open: false

logging:
level:


+ 22
- 1
mallinkSchedule/src/main/resources/application-prod.yml Просмотреть файл

@@ -66,10 +66,31 @@ aws:
access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=)
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:
exception: true
deploy: 3
open: true

logging:
level:


+ 23
- 0
mallinkSchedule/src/main/resources/application-test.yml Просмотреть файл

@@ -66,8 +66,31 @@ aws:
access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=)
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:
exception: true
deploy: 2
open: true

logging:
level:


+ 69
- 0
mallinkService/src/main/java/com/iformall/config/WechatOpenProperties.java Просмотреть файл

@@ -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);
}
}

+ 124
- 0
mallinkService/src/main/java/com/iformall/config/WechatRedisProperies.java Просмотреть файл

@@ -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;
}
}

+ 11
- 1
mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java Просмотреть файл

@@ -9,9 +9,19 @@ public interface WxAuthorizerInfoMapper extends CommonMapper<WxAuthorizerInfo, L

List<WxAuthorizerInfo> findList(WxAuthorizerInfo wxAuthorizerInfo);

List<WxWeappInfo> findWeappList();

List<WxWeappInfo> findWxMpList();

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);



+ 2
- 4
mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java Просмотреть файл

@@ -7,10 +7,8 @@ import com.iformall.domain.po.WxComponentVerifyTicket;
public interface WxComponentVerifyTicketMapper extends CommonMapper<WxComponentVerifyTicket, Long> {

List<WxComponentVerifyTicket> findList(WxComponentVerifyTicket wxComponentVerifyTicket);

int updateAccessToken(WxComponentVerifyTicket wxComponentVerifyTicket);
}

+ 0
- 7
mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java Просмотреть файл

@@ -63,13 +63,6 @@ public interface WxAppinfoService {
*/
void deleteById(Long id);


/**
* 更新accessToken
* @param appId
*/
void ctokenUpdate(String appId);

/**
* 位置码/导购码生成
*/


+ 13
- 2
mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxTemplateMsgMapper;
import com.iformall.service.MsgSendService;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.MaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -24,18 +25,28 @@ import java.util.List;
public class SendSmartAppMsgServiceImpl implements MsgSendService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private boolean isFmOpen;
@Autowired
private WxTemplateMsgMapper wxTemplateMsgMapper;
@Autowired
private WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@Override
public void send(BaseMsg baseMsg) throws Exception{
SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg;
WxTemplateMsg msg = null;
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();


+ 0
- 37
mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java Просмотреть файл

@@ -87,43 +87,6 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
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 {
try {
response.reset();


+ 14
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java Просмотреть файл

@@ -13,13 +13,13 @@ import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxScreenAd;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.enums.EnumCouponChannelType;
import com.iformall.enums.EnumCouponType;
import com.iformall.enums.EnumScreenAdType;
import com.iformall.mapper.WxCampaignMapper;
import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.mapper.WxScreenAdMapper;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxScreenAdService;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.MaUtil;
import me.chanjar.weixin.common.error.WxErrorException;
import org.slf4j.Logger;
@@ -33,6 +33,9 @@ import java.util.List;
@Service
public class WxScreenAdServiceImpl implements WxScreenAdService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private boolean isFmOpen;
@Autowired
WxScreenAdMapper wxScreenAdMapper;
@@ -40,6 +43,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService {
@Autowired
WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@Autowired
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_GROUP = "JG";
private static String QRCODE_JUMP_CMD_CAMPGIN = "JB";

private byte[] getQrcode(Long id, int type, int subType, WxAppinfo appInfo) throws Exception {
if(appInfo == null) {
logger.error("QRCODE get error: appinfo is 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 = "";
if (EnumScreenAdType.COUPON.getCode().equals(type)) {


+ 253
- 0
mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java Просмотреть файл

@@ -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();
}
}

+ 73
- 0
mallinkService/src/main/java/com/iformall/service/wechat/FmOpenService.java Просмотреть файл

@@ -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;
}
}

+ 8
- 0
mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml Просмотреть файл

@@ -246,6 +246,14 @@
<include refid="dynamicVWhereConditions" />
</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
<include refid="allVColumns"/>


+ 14
- 6
mallinkWebSocketServer/src/main/java/com/iformall/SocketServerApplication.java Просмотреть файл

@@ -19,13 +19,21 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableEncryptableProperties
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) {


+ 21
- 7
mallinkWebSocketServer/src/main/java/com/iformall/controller/BaseController.java Просмотреть файл

@@ -10,6 +10,7 @@ import com.iformall.interceptor.AuthHandshakeInterceptor;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserService;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.IPUtil;
import com.iformall.utils.MaUtil;
import org.apache.commons.lang3.StringUtils;
@@ -29,12 +30,18 @@ import java.util.List;

@RestController
public class BaseController {
@Autowired
private boolean isFmOpen;

@Autowired
private WxCUserService wxCUserService;

@Autowired
private WxAppinfoService wxAppinfoService;

@Autowired
private FmOpenService openService;

@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@@ -86,17 +93,24 @@ public class BaseController {
}

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) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
if(!isFmOpen) {
WxMaService service = MaUtil.getWeappService(appinfo);
return service;
}
return null;
}




+ 22
- 0
mallinkWebSocketServer/src/main/resources/application-dev.yml Просмотреть файл

@@ -74,6 +74,26 @@ aws:
access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=)
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:
encryptor:
@@ -81,6 +101,8 @@ jasypt:

fm:
exception: false
deploy: 1
open: false

logging:
level:


+ 22
- 1
mallinkWebSocketServer/src/main/resources/application-prod.yml Просмотреть файл

@@ -63,10 +63,31 @@ aws:
access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=)
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:
exception: true
deploy: 3
open: true

logging:
level:


+ 23
- 0
mallinkWebSocketServer/src/main/resources/application-test.yml Просмотреть файл

@@ -63,8 +63,31 @@ aws:
access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=)
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:
exception: true
deploy: 2
open: true

logging:
level:


+ 7
- 0
pom.xml Просмотреть файл

@@ -33,6 +33,7 @@
<weixin-java-mp.version>3.3.0</weixin-java-mp.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-open.version>3.3.0</weixin-java-open.version>
<quartz.version>2.3.0</quartz.version>
</properties>

@@ -337,6 +338,12 @@
<version>${weixin-java-pay.version}</version>
</dependency>

<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-open</artifactId>
<version>${weixin-java-open.version}</version>
</dependency>

<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot</artifactId>


Загрузка…
Отмена
Сохранить