package cn.hmsoft.weixin.request;

import cn.hmsoft.weixin.entity.response.OauthAccessTokenResponseJson;

/*****************************************
 * @note 通过code换取网页授权access_token
 * @author revisit@126.com
 * @Company: www.hmsoft.cn
 * @create 2017-05-09 00:48:13
 * @version 4.0.0
 */
public class OauthAccessTokenRequest
		extends AbstractRequest<OauthAccessTokenResponseJson, OauthAccessTokenResponseJson, String> {

	private final static String url = " https://api.weixin.qq.com/sns/oauth2/access_token?";

	private String code;

	/********************************
	 * 通过code换取网页授权access_token
	 * 
	 * @param code
	 *            网页code
	 */
	public OauthAccessTokenRequest(String code) {
		this.code = code;

	}

	@Override
	protected String makeUrl() {
		String vUrl = url + "appid=" + this.wxDefine.getApp_id() + "&secret=" + this.wxDefine.getApp_secrect()
				+ "&code=" + this.code + "&grant_type=authorization_code";
		// System.out.println(vUrl);
		return vUrl;
	}
}
