All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.chanjar.weixin.cp.api.impl.WxCpServiceOnTpImpl Maven / Gradle / Ivy

There is a newer version: 4.6.7.B
Show newest version
package me.chanjar.weixin.cp.api.impl;

import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.tp.service.WxCpTpService;

/**
 * 
 *  默认接口实现类,使用apache httpclient实现,配合第三方应用service使用
 * Created by zhenjun cai.
 * 
* * @author zhenjun cai */ @RequiredArgsConstructor public class WxCpServiceOnTpImpl extends WxCpServiceApacheHttpClientImpl { private final WxCpTpService wxCpTpService; @Override public String getAccessToken(boolean forceRefresh) throws WxErrorException { if (!this.configStorage.isAccessTokenExpired() && !forceRefresh) { return this.configStorage.getAccessToken(); } //access token通过第三方应用service获取 //corpSecret对应企业永久授权码 WxAccessToken accessToken = wxCpTpService.getCorpToken(this.configStorage.getCorpId(), this.configStorage.getCorpSecret()); this.configStorage.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn()); return this.configStorage.getAccessToken(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy