View Javadoc
1   package com.foxinmy.weixin4j.token;
2   
3   import com.foxinmy.weixin4j.cache.CacheStorager;
4   import com.foxinmy.weixin4j.model.Token;
5   
6   /**
7    * 第三方应用永久授权码的存取
8    *
9    * @className PerTicketManager
10   * @author jinyu(foxinmy@gmail.com)
11   * @date 2015年6月22日
12   * @since JDK 1.6
13   */
14  public class PerTicketManager extends TicketManager {
15  
16  	private final String authAppId;
17  
18  	public PerTicketManager(String authAppId, String thirdId,
19  			String thirdSecret, CacheStorager<Token> cacheStorager) {
20  		super(thirdId, thirdSecret, cacheStorager);
21  		this.authAppId = authAppId;
22  	}
23  
24  	/**
25  	 * 获取永久授权码的key
26  	 *
27  	 * @return
28  	 */
29  	@Override
30  	public String getCacheKey() {
31  		return String.format("%sthird_party_percode_ticket_%s_%s",
32  				TokenCreator.CACHEKEY_PREFIX, getThirdId(), authAppId);
33  	}
34  
35  	public String getAuthAppId() {
36  		return authAppId;
37  	}
38  }