Commit b68eea6186a746e633eafac00697d494ffa9a2f9

Authored by 陈杰
1 parent 10cb26e0
Exists in master

1

src/main/java/com/sincere/wechatbusiness/controller/TokenController.java
... ... @@ -6,6 +6,7 @@ import com.sincere.wechatbusiness.model.AccessToken;
6 6 import com.sincere.wechatbusiness.model.Channel;
7 7 import com.sincere.wechatbusiness.model.Token;
8 8 import com.sincere.wechatbusiness.service.ChannelService;
  9 +import com.sincere.wechatbusiness.utils.HttpClientUtils;
9 10 import io.swagger.annotations.ApiOperation;
10 11 import org.springframework.beans.factory.annotation.Autowired;
11 12 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -29,8 +30,10 @@ public class TokenController {
29 30 ChannelService channelService ;
30 31  
31 32 @Autowired
32   - ChannelMapper channelMapper ;
  33 + ChannelMapper channelMapper;
33 34  
  35 + private static String appId = "wx6078ff3f67524996" ;
  36 + private static String secret = "8a0465b8ad0f000f568f48853e2818c8" ;
34 37  
35 38 @ApiOperation(value = "获取分享token")
36 39 @RequestMapping(value = "getToken",method = RequestMethod.GET)
... ... @@ -48,13 +51,13 @@ public class TokenController {
48 51  
49 52 if(minute<60) token.setAccess_token(accessToken.getAccessToken());
50 53 else{
51   - token=getAccessToken("wx6078ff3f67524996","8a0465b8ad0f000f568f48853e2818c8");
  54 + token=getAccessToken(appId,secret);
52 55 accessToken.setAccessToken(token.getAccess_token());
53 56 channelService.insertAccessToken(accessToken);
54 57 }
55 58 }
56 59 else {
57   - token=getAccessToken("wx6078ff3f67524996","8a0465b8ad0f000f568f48853e2818c8");
  60 + token=getAccessToken(appId,secret);
58 61 accessToken=new AccessToken();
59 62 accessToken.setAccessToken(token.getAccess_token());
60 63 channelService.insertAccessToken(accessToken);
... ...