File tree Expand file tree Collapse file tree 3 files changed +19
-20
lines changed
weixin-java-cp/src/main/java/me/chanjar/weixin/cp Expand file tree Collapse file tree 3 files changed +19
-20
lines changed Original file line number Diff line number Diff line change 3
3
import me .chanjar .weixin .common .error .WxErrorException ;
4
4
import me .chanjar .weixin .cp .bean .WxCpOauth2UserInfo ;
5
5
import me .chanjar .weixin .cp .bean .WxCpUserDetail ;
6
- import me .chanjar .weixin .cp .bean .workbench .WxCpSecondVerificatioInformation ;
6
+ import me .chanjar .weixin .cp .bean .workbench .WxCpSecondVerificationInfo ;
7
7
8
8
/**
9
9
* <pre>
@@ -138,17 +138,13 @@ public interface WxCpOAuth2Service {
138
138
139
139
/**
140
140
* 获取用户二次验证信息
141
- *
142
- * https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=ACCESS_TOKEN
143
- *
144
- * @author Hugo
145
- * @date 2023/12/14 10:29
146
- * @param code 用户进入二次验证页面时,企业微信颁发的code,每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
147
- * @return me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificatioInformation 二次验证授权码,开发者可以调用通过二次验证接口,解锁企业微信终端.tfa_code有效期五分钟,且只能使用一次。
148
- *
141
+ * <p>
142
+ * api: https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=ACCESS_TOKEN
149
143
* 权限说明:仅『通讯录同步』或者自建应用可调用,如用自建应用调用,用户需要在二次验证范围和应用可见范围内。
150
- *
151
144
* 并发限制:20
145
+ *
146
+ * @param code 用户进入二次验证页面时,企业微信颁发的code,每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
147
+ * @return me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo 二次验证授权码,开发者可以调用通过二次验证接口,解锁企业微信终端.tfa_code有效期五分钟,且只能使用一次。
152
148
*/
153
- WxCpSecondVerificatioInformation get_tfa_info (String code ) throws WxErrorException ;
149
+ WxCpSecondVerificationInfo getTfaInfo (String code ) throws WxErrorException ;
154
150
}
Original file line number Diff line number Diff line change 10
10
import me .chanjar .weixin .cp .api .WxCpService ;
11
11
import me .chanjar .weixin .cp .bean .WxCpOauth2UserInfo ;
12
12
import me .chanjar .weixin .cp .bean .WxCpUserDetail ;
13
- import me .chanjar .weixin .cp .bean .workbench .WxCpSecondVerificatioInformation ;
13
+ import me .chanjar .weixin .cp .bean .workbench .WxCpSecondVerificationInfo ;
14
14
import me .chanjar .weixin .cp .util .json .WxCpGsonBuilder ;
15
15
16
16
import static me .chanjar .weixin .common .api .WxConsts .OAuth2Scope .*;
@@ -123,11 +123,9 @@ public WxCpOauth2UserInfo getAuthUserInfo(String code) throws WxErrorException {
123
123
}
124
124
125
125
@ Override
126
- public WxCpSecondVerificatioInformation get_tfa_info (String code ) throws WxErrorException {
127
- JsonObject param = new JsonObject ();
128
- param .addProperty ("code" , code );
126
+ public WxCpSecondVerificationInfo getTfaInfo (String code ) throws WxErrorException {
129
127
String responseText = this .mainService .post (this .mainService .getWxCpConfigStorage ().getApiUrl (GET_TFA_INFO ),
130
- param . toString ( ));
131
- return WxCpGsonBuilder .create ().fromJson (responseText , WxCpSecondVerificatioInformation .class );
128
+ GsonHelper . buildJsonObject ( "code" , code ));
129
+ return WxCpGsonBuilder .create ().fromJson (responseText , WxCpSecondVerificationInfo .class );
132
130
}
133
131
}
Original file line number Diff line number Diff line change 1
1
package me .chanjar .weixin .cp .bean .workbench ;
2
2
3
+ import com .google .gson .annotations .SerializedName ;
3
4
import lombok .AllArgsConstructor ;
4
5
import lombok .Builder ;
5
6
import lombok .Data ;
6
7
import lombok .NoArgsConstructor ;
7
8
import lombok .experimental .Accessors ;
8
9
10
+ import java .io .Serializable ;
11
+
9
12
/**
10
13
* @author Hugo
11
14
* <pre>
12
15
* 获取用户二次验证信息的结果类
13
16
* </pre>
14
17
* <p>
15
- * 文档1: https://developer.work.weixin.qq.com/document/path/99499
18
+ * <a href=" https://developer.work.weixin.qq.com/document/path/99499">文档</a>
16
19
*/
17
20
@ Data
18
21
@ Accessors (chain = true )
19
22
@ NoArgsConstructor
20
23
@ AllArgsConstructor
21
24
@ Builder
22
- public class WxCpSecondVerificatioInformation {
25
+ public class WxCpSecondVerificationInfo implements Serializable {
23
26
private static final long serialVersionUID = -4301564507150486556L ;
24
27
25
28
private String userId ;
26
- private String tfa_code ;
29
+
30
+ @ SerializedName ("tfa_code" )
31
+ private String tfaCode ;
27
32
}
You can’t perform that action at this time.
0 commit comments