微信接口开发
This commit is contained in:
parent
735296b0f9
commit
037480cc32
@ -534,7 +534,7 @@ public class WechatAppletController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getToken")
|
@GetMapping("/getToken")
|
||||||
public String getToken(@RequestParam String appId) {
|
public String getToken(@RequestParam String appId) throws Exception {
|
||||||
return iWechatAppletService.getAccessToken(appId);
|
return iWechatAppletService.getAccessToken(appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.stdiet.custom.service;
|
|||||||
|
|
||||||
public interface IWechatAppletService {
|
public interface IWechatAppletService {
|
||||||
|
|
||||||
public String getAccessToken(String appId);
|
public String getAccessToken(String appId) throws Exception;
|
||||||
|
|
||||||
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark);
|
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
|
|||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccessToken(String appId) {
|
public String getAccessToken(String appId) throws Exception {
|
||||||
String accessToken = redisCache.getCacheObject(appId);
|
String accessToken = redisCache.getCacheObject(appId);
|
||||||
if (StringUtils.isNull(accessToken)) {
|
if (StringUtils.isNull(accessToken)) {
|
||||||
String appSecret = "";
|
String appSecret = "";
|
||||||
@ -50,7 +50,7 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark) {
|
public void postRecipesMessage(String appId, String openId, String name, String startDate, String endDate, String remark) throws Exception {
|
||||||
String accessToken = getAccessToken(appId);
|
String accessToken = getAccessToken(appId);
|
||||||
if (StringUtils.isNull(accessToken)) {
|
if (StringUtils.isNull(accessToken)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user