🎨 规范化代码
This commit is contained in:
@@ -3,7 +3,7 @@ package me.chanjar.weixin.cp.api;
|
|||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
|
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpUserDetail;
|
import me.chanjar.weixin.cp.bean.WxCpUserDetail;
|
||||||
import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificatioInformation;
|
import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -138,17 +138,13 @@ public interface WxCpOAuth2Service {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户二次验证信息
|
* 获取用户二次验证信息
|
||||||
*
|
* <p>
|
||||||
* https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=ACCESS_TOKEN
|
* api: https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=ACCESS_TOKEN
|
||||||
*
|
|
||||||
* @author Hugo
|
|
||||||
* @date 2023/12/14 10:29
|
|
||||||
* @param code 用户进入二次验证页面时,企业微信颁发的code,每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
|
|
||||||
* @return me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificatioInformation 二次验证授权码,开发者可以调用通过二次验证接口,解锁企业微信终端.tfa_code有效期五分钟,且只能使用一次。
|
|
||||||
*
|
|
||||||
* 权限说明:仅『通讯录同步』或者自建应用可调用,如用自建应用调用,用户需要在二次验证范围和应用可见范围内。
|
* 权限说明:仅『通讯录同步』或者自建应用可调用,如用自建应用调用,用户需要在二次验证范围和应用可见范围内。
|
||||||
*
|
|
||||||
* 并发限制:20
|
* 并发限制:20
|
||||||
|
*
|
||||||
|
* @param code 用户进入二次验证页面时,企业微信颁发的code,每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
|
||||||
|
* @return me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo 二次验证授权码,开发者可以调用通过二次验证接口,解锁企业微信终端.tfa_code有效期五分钟,且只能使用一次。
|
||||||
*/
|
*/
|
||||||
WxCpSecondVerificatioInformation get_tfa_info(String code) throws WxErrorException;
|
WxCpSecondVerificationInfo getTfaInfo(String code) throws WxErrorException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
|
|||||||
import me.chanjar.weixin.cp.api.WxCpService;
|
import me.chanjar.weixin.cp.api.WxCpService;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
|
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpUserDetail;
|
import me.chanjar.weixin.cp.bean.WxCpUserDetail;
|
||||||
import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificatioInformation;
|
import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo;
|
||||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||||
|
|
||||||
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.*;
|
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.*;
|
||||||
@@ -123,11 +123,9 @@ public class WxCpOAuth2ServiceImpl implements WxCpOAuth2Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxCpSecondVerificatioInformation get_tfa_info(String code) throws WxErrorException {
|
public WxCpSecondVerificationInfo getTfaInfo(String code) throws WxErrorException {
|
||||||
JsonObject param = new JsonObject();
|
|
||||||
param.addProperty("code", code);
|
|
||||||
String responseText = this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(GET_TFA_INFO),
|
String responseText = this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(GET_TFA_INFO),
|
||||||
param.toString());
|
GsonHelper.buildJsonObject("code", code));
|
||||||
return WxCpGsonBuilder.create().fromJson(responseText, WxCpSecondVerificatioInformation.class);
|
return WxCpGsonBuilder.create().fromJson(responseText, WxCpSecondVerificationInfo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
package me.chanjar.weixin.cp.bean.workbench;
|
package me.chanjar.weixin.cp.bean.workbench;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hugo
|
* @author Hugo
|
||||||
* <pre>
|
* <pre>
|
||||||
* 获取用户二次验证信息的结果类
|
* 获取用户二次验证信息的结果类
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
* 文档1:https://developer.work.weixin.qq.com/document/path/99499
|
* <a href="https://developer.work.weixin.qq.com/document/path/99499">文档</a>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class WxCpSecondVerificatioInformation {
|
public class WxCpSecondVerificationInfo implements Serializable {
|
||||||
private static final long serialVersionUID = -4301564507150486556L;
|
private static final long serialVersionUID = -4301564507150486556L;
|
||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
private String tfa_code;
|
|
||||||
|
@SerializedName("tfa_code")
|
||||||
|
private String tfaCode;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user