|
|
@@ -169,28 +169,19 @@ public class MiniServiceImpl implements MiniService {
|
|
|
public String generateSchema(MiniSchemaReq req) throws Exception {
|
|
|
//跳转路径
|
|
|
req.setPath("pages/index/index");
|
|
|
- String key = RedisService.key.MINI_SCHEMA_URL_PATH.getEnvName() + req.getPath();
|
|
|
- String miniSchema = redisService.getStr(key);
|
|
|
- if (StrUtil.isEmpty(miniSchema)) {
|
|
|
- try {
|
|
|
- //调用微信小程序接口
|
|
|
- String accessToken = weChatService.getAccessToken(certMiniConfig.getAppId());
|
|
|
- TargetAppletSchemeReq targetAppletSchemeReq = new TargetAppletSchemeReq();
|
|
|
- targetAppletSchemeReq.setExpireType(0l);
|
|
|
- targetAppletSchemeReq.setExpireTime((System.currentTimeMillis() / 1000) + Times.second_per_day);
|
|
|
- targetAppletSchemeReq.setIsExpired(false);
|
|
|
- TargetAppletSchemeReq.JumpWxa jumpWxa = new TargetAppletSchemeReq.JumpWxa(req.getPath(), "");
|
|
|
- targetAppletSchemeReq.setJumpWxa(jumpWxa);
|
|
|
- miniSchema = weChatService.generateSchema(accessToken, targetAppletSchemeReq);
|
|
|
- if (StrUtil.isNotBlank(miniSchema)) {
|
|
|
- redisService.setNx(key, miniSchema, RedisService.key.MINI_SCHEMA_URL_PATH.getTimeout());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- if (StrUtil.isNotBlank(req.getDsCode()) && StrUtil.isNotBlank(miniSchema)) {
|
|
|
- miniSchema = miniSchema.contains("?") ? miniSchema + "&dsCode=" + req.getDsCode() : miniSchema + "?dsCode=" + req.getDsCode();
|
|
|
+ String query = StrUtil.EMPTY;
|
|
|
+ if (StrUtil.isNotBlank(req.getDsCode())) {
|
|
|
+ query = "dsCode=" + req.getDsCode();
|
|
|
}
|
|
|
+ //调用微信小程序接口
|
|
|
+ String accessToken = weChatService.getAccessToken(certMiniConfig.getAppId());
|
|
|
+ TargetAppletSchemeReq targetAppletSchemeReq = new TargetAppletSchemeReq();
|
|
|
+ targetAppletSchemeReq.setExpireType(0l);
|
|
|
+ targetAppletSchemeReq.setExpireTime((System.currentTimeMillis() / 1000) + Times.second_per_day);
|
|
|
+ targetAppletSchemeReq.setIsExpired(false);
|
|
|
+ TargetAppletSchemeReq.JumpWxa jumpWxa = new TargetAppletSchemeReq.JumpWxa(req.getPath(), query);
|
|
|
+ targetAppletSchemeReq.setJumpWxa(jumpWxa);
|
|
|
+ String miniSchema = weChatService.generateSchema(accessToken, targetAppletSchemeReq);
|
|
|
return miniSchema;
|
|
|
}
|
|
|
|