微信接口开发

This commit is contained in:
huangdeliang 2021-05-13 20:20:06 +08:00
parent 735296b0f9
commit 037480cc32
3 changed files with 5 additions and 5 deletions

View File

@ -534,7 +534,7 @@ public class WechatAppletController extends BaseController {
}
@GetMapping("/getToken")
public String getToken(@RequestParam String appId) {
public String getToken(@RequestParam String appId) throws Exception {
return iWechatAppletService.getAccessToken(appId);
}

View File

@ -2,7 +2,7 @@ package com.stdiet.custom.service;
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;
}

View File

@ -24,7 +24,7 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
private RestTemplate restTemplate;
@Override
public String getAccessToken(String appId) {
public String getAccessToken(String appId) throws Exception {
String accessToken = redisCache.getCacheObject(appId);
if (StringUtils.isNull(accessToken)) {
String appSecret = "";
@ -50,7 +50,7 @@ public class WeChartAppletServiceImp implements IWechatAppletService {
}
@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);
if (StringUtils.isNull(accessToken)) {
return;