From cc344f105e53009827ee822aa1632665f55a81e4 Mon Sep 17 00:00:00 2001
From: benben <117718955+benben4466@users.noreply.github.com>
Date: Wed, 2 Jul 2025 10:33:56 +0800
Subject: [PATCH] =?UTF-8?q?:art:=20#3624=20=E3=80=90=E4=BC=81=E4=B8=9A?=
=?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E4=BC=81=E5=BE=AE=E5=BE=AE=E7=9B=98?=
=?UTF-8?q?API=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=8E=BB=E6=8E=89?=
=?UTF-8?q?=E5=BA=9F=E5=BC=83=E7=9A=84userId=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../weixin/cp/api/WxCpOaWeDriveService.java | 29 ++++++++-----------
.../cp/api/impl/WxCpOaWeDriveServiceImpl.java | 16 ++++------
.../cp/api/WxCpOaWeDriveServiceTest.java | 12 ++++----
3 files changed, 23 insertions(+), 34 deletions(-)
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java
index 8c3efbc1a..e7217616b 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java
@@ -48,12 +48,11 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param userId the user id
* @param spaceId the space id
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
- WxCpBaseResp spaceDismiss(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
+ WxCpBaseResp spaceDismiss(@NonNull String spaceId) throws WxErrorException;
/**
* 获取空间信息
@@ -62,12 +61,11 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param userId the user id
* @param spaceId the space id
* @return wx cp space info
* @throws WxErrorException the wx error exception
*/
- WxCpSpaceInfo spaceInfo(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
+ WxCpSpaceInfo spaceInfo(@NonNull String spaceId) throws WxErrorException;
/**
* 添加成员/部门
@@ -115,12 +113,11 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param userId the user id
* @param spaceId the space id
* @return wx cp space share
* @throws WxErrorException the wx error exception
*/
- WxCpSpaceShare spaceShare(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
+ WxCpSpaceShare spaceShare(@NonNull String spaceId) throws WxErrorException;
/**
* 获取文件列表
@@ -155,18 +152,18 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param fileId 文件fileid(只支持下载普通文件,不支持下载文件夹或微文档)
+ * @param fileId 文件fileid(只支持下载普通文件,不支持下载文件夹或微文档)
* @param selectedTicket 微盘和文件选择器jsapi返回的selectedTicket。若填此参数,则不需要填fileid。
* @return {
- * "errcode": 0,
- * "errmsg": "ok",
- * "download_url": "DOWNLOAD_URL",
- * "cookie_name": "COOKIE_NAME",
- * "cookie_value": "COOKIE_VALUE"
+ * "errcode": 0,
+ * "errmsg": "ok",
+ * "download_url": "DOWNLOAD_URL",
+ * "cookie_name": "COOKIE_NAME",
+ * "cookie_value": "COOKIE_VALUE"
* }
* @throws WxErrorException the wx error exception
*/
- WxCpFileDownload fileDownload( String fileId, String selectedTicket) throws WxErrorException;
+ WxCpFileDownload fileDownload(String fileId, String selectedTicket) throws WxErrorException;
/**
* 重命名文件
@@ -271,14 +268,13 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param userId the user id
* @param fileId the file id
* @param authScope the auth scope
* @param auth the auth
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
- WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException;
+ WxCpBaseResp fileSetting(@NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException;
/**
* 获取分享链接
@@ -287,11 +283,10 @@ public interface WxCpOaWeDriveService {
* 请求方式:POST(HTTPS)
* 请求地址: ...
*
- * @param userId the user id
* @param fileId the file id
* @return wx cp file share
* @throws WxErrorException the wx error exception
*/
- WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException;
+ WxCpFileShare fileShare(@NonNull String fileId) throws WxErrorException;
}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
index 597851aae..a41195ae8 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java
@@ -39,20 +39,18 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpBaseResp spaceDismiss(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
+ public WxCpBaseResp spaceDismiss(@NonNull String spaceId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_DISMISS);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("spaceid", spaceId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpBaseResp.fromJson(responseContent);
}
@Override
- public WxCpSpaceInfo spaceInfo(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
+ public WxCpSpaceInfo spaceInfo(@NonNull String spaceId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_INFO);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("spaceid", spaceId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpSpaceInfo.fromJson(responseContent);
@@ -80,10 +78,9 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpSpaceShare spaceShare(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
+ public WxCpSpaceShare spaceShare(@NonNull String spaceId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_SHARE);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("spaceid", spaceId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpSpaceShare.fromJson(responseContent);
@@ -166,11 +163,9 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope,
- Integer auth) throws WxErrorException {
+ public WxCpBaseResp fileSetting(@NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SETTING);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("fileid", fileId);
jsonObject.addProperty("auth_scope", authScope);
if (auth != null) {
@@ -181,10 +176,9 @@ public class WxCpOaWeDriveServiceImpl implements WxCpOaWeDriveService {
}
@Override
- public WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException {
+ public WxCpFileShare fileShare(@NonNull String fileId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SHARE);
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("userid", userId);
jsonObject.addProperty("fileid", fileId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpFileShare.fromJson(responseContent);
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveServiceTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveServiceTest.java
index bd7599061..1364ab5a1 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveServiceTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveServiceTest.java
@@ -59,13 +59,13 @@ public class WxCpOaWeDriveServiceTest {
/*
* 获取分享链接
*/
- WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(uId, fileId2);
+ WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(fileId2);
log.info("获取分享链接返回结果为:{}", fileShare.toJson());
/*
* 分享设置
*/
- WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(uId, fileId2, 2, 1);
+ WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(fileId2, 2, 1);
log.info("分享设置返回结果为:{}", fileSetting.toJson());
/*
@@ -200,13 +200,13 @@ public class WxCpOaWeDriveServiceTest {
/*
* 获取邀请链接
*/
- WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(uId, spId);
+ WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(spId);
log.info("获取邀请链接信息为:{}", spaceShare.toJson());
/*
* 获取空间信息
*/
- WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(uId, spId);
+ WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(spId);
log.info("获取空间信息为:{}", data.toJson());
/*
@@ -252,7 +252,7 @@ public class WxCpOaWeDriveServiceTest {
/*
* 获取空间信息
*/
- WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("WangKai", "s.ww45d3e188865aca30.652091685u4h");
+ WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("s.ww45d3e188865aca30.652091685u4h");
log.info("获取空间信息,spaceInfo信息为:{}", spaceInfo.toJson());
/*
@@ -279,7 +279,7 @@ public class WxCpOaWeDriveServiceTest {
/*
* 解散空间
*/
- WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss("WangKai", spaceCreateData.getSpaceId());
+ WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss(spaceCreateData.getSpaceId());
log.info("解散成功:{}", thisResp.toJson());
}