WxAuthClient.java
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.linkwechat.wecom.wxclient;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Request;
import com.linkwechat.wecom.domain.weixin.dto.WxTokenDto;
import com.linkwechat.wecom.domain.weixin.dto.WxAuthUserInfoDto;
import com.linkwechat.wecom.interceptor.WeiXinAuthInterceptor;
/**
* @author danmo
* @description
* @date 2021/4/5 15:47
**/
@BaseRequest(baseURL = "https://api.weixin.qq.com/sns",contentType = "application/json"
,interceptor = WeiXinAuthInterceptor.class)
public interface WxAuthClient {
/**
* 获取微信授权token
*
* @param appId 公众号的唯一标识
* @param secret 密钥
* @param code 302重定向code
* @param grantType 填写为authorization_code
* @return
*/
@Request(url = "/oauth2/access_token", type = "GET")
WxTokenDto getAuthToken(@Query("appid") String appId, @Query("secret") String secret,
@Query("code") String code, @Query("grant_type") String grantType);
/**
* 刷新access_token
*
*
* @param id
* @param appId 公众号的唯一标识
* @param grantType 填写为refresh_token
* @param refreshToken 填写通过access_token获取到的refresh_token参数
* @return
*/
@Request(url = "/oauth2/refresh_token", type = "GET")
WxTokenDto refreshToken(@Query("appid") String appId, @Query("grant_type") String grantType,
@Query("refresh_token") String refreshToken);
/**
* 检验授权凭证(access_token)是否有效
* @param openId 用户的唯一标识
* @return
*/
@Request(url = "/auth", type = "GET")
WxTokenDto auth(@Query("openid") String openId);
/**
* 拉取用户信息(需scope为 snsapi_userinfo)
* @param openId 用户的唯一标识
* @param lang 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
* @return
*/
@Request(url = "/userinfo", type = "GET")
WxAuthUserInfoDto getUserInfo(@Query("openid") String openId, @Query("lang") String lang);
}