Skip to content

Commit 2058623

Browse files
committed
#477 企业号接口重构,分类管理
1 parent 20e174e commit 2058623

File tree

5 files changed

+27
-413
lines changed

5 files changed

+27
-413
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java

Lines changed: 1 addition & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
/**
2121
* 微信API的Service
22+
* @author chanjaster
2223
*/
2324
public interface WxCpService {
24-
2525
/**
2626
* <pre>
2727
* 验证推送过来的消息的正确性
@@ -85,42 +85,6 @@ public interface WxCpService {
8585
*/
8686
WxJsapiSignature createJsapiSignature(String url) throws WxErrorException;
8787

88-
/**
89-
* @deprecated 请使用 {@link WxCpMenuService#create(WxMenu)}
90-
*/
91-
@Deprecated
92-
void menuCreate(WxMenu menu) throws WxErrorException;
93-
94-
/**
95-
* @deprecated 请使用 {@link WxCpMenuService#create(Integer, WxMenu)}
96-
*/
97-
@Deprecated
98-
void menuCreate(Integer agentId, WxMenu menu) throws WxErrorException;
99-
100-
/**
101-
* @deprecated 请使用 {@link WxCpMenuService#delete()} }
102-
*/
103-
@Deprecated
104-
void menuDelete() throws WxErrorException;
105-
106-
/**
107-
* @deprecated 请使用 {@link WxCpMenuService#delete(Integer)}
108-
*/
109-
@Deprecated
110-
void menuDelete(Integer agentId) throws WxErrorException;
111-
112-
/**
113-
* @deprecated 请使用 {@link WxCpMenuService#get() }
114-
*/
115-
@Deprecated
116-
WxMenu menuGet() throws WxErrorException;
117-
118-
/**
119-
* @deprecated 请使用 {@link WxCpMenuService#get(Integer)}
120-
*/
121-
@Deprecated
122-
WxMenu menuGet(Integer agentId) throws WxErrorException;
123-
12488
/**
12589
* <pre>
12690
* 发送消息
@@ -131,175 +95,6 @@ public interface WxCpService {
13195
*/
13296
WxCpMessageSendResult messageSend(WxCpMessage message) throws WxErrorException;
13397

134-
/**
135-
* @deprecated 请使用 {@link WxCpDepartmentService#create(WxCpDepart)}
136-
*/
137-
@Deprecated
138-
Integer departCreate(WxCpDepart depart) throws WxErrorException;
139-
140-
/**
141-
* @deprecated 请使用 {@link WxCpDepartmentService#update(WxCpDepart)}
142-
*/
143-
@Deprecated
144-
void departUpdate(WxCpDepart group) throws WxErrorException;
145-
146-
/**
147-
* @deprecated 请使用 {@link WxCpDepartmentService#delete(Integer)}
148-
*/
149-
@Deprecated
150-
void departDelete(Integer departId) throws WxErrorException;
151-
152-
/**
153-
* @deprecated 请使用 {@link WxCpDepartmentService#listAll() }
154-
*/
155-
@Deprecated
156-
List<WxCpDepart> departGet() throws WxErrorException;
157-
158-
/**
159-
* @deprecated 请使用 {@link WxCpMediaService#upload(String, String, InputStream)}
160-
*/
161-
@Deprecated
162-
WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream)
163-
throws WxErrorException, IOException;
164-
165-
/**
166-
* @deprecated 请使用 {@link WxCpMediaService#upload(String, File)}
167-
*/
168-
@Deprecated
169-
WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
170-
171-
/**
172-
* @deprecated 请使用 {@link WxCpMediaService#download(String)}
173-
*/
174-
@Deprecated
175-
File mediaDownload(String mediaId) throws WxErrorException;
176-
177-
/**
178-
* @deprecated 请使用 {@link WxCpUserService#authenticate(String)}
179-
*/
180-
@Deprecated
181-
void userAuthenticated(String userId) throws WxErrorException;
182-
183-
/**
184-
* @deprecated 请使用 {@link WxCpUserService#create(WxCpUser)}
185-
*/
186-
@Deprecated
187-
void userCreate(WxCpUser user) throws WxErrorException;
188-
189-
/**
190-
* @deprecated 请使用 {@link WxCpUserService#update(WxCpUser)}
191-
*/
192-
@Deprecated
193-
void userUpdate(WxCpUser user) throws WxErrorException;
194-
195-
/**
196-
* @deprecated 请使用 {@link WxCpUserService#delete(String...)}
197-
*/
198-
@Deprecated
199-
void userDelete(String userid) throws WxErrorException;
200-
201-
/**
202-
* @deprecated 请使用 {@link WxCpUserService#delete(String...)}
203-
*/
204-
@Deprecated
205-
void userDelete(String[] userids) throws WxErrorException;
206-
207-
/**
208-
* @deprecated 请使用 {@link WxCpUserService#getById(String)}
209-
*/
210-
@Deprecated
211-
WxCpUser userGet(String userid) throws WxErrorException;
212-
213-
/**
214-
* @deprecated 请使用 {@link WxCpUserService#listByDepartment(Integer, Boolean, Integer)}
215-
*/
216-
@Deprecated
217-
List<WxCpUser> userList(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException;
218-
219-
/**
220-
* @deprecated 请使用 {@link WxCpUserService#listSimpleByDepartment(Integer, Boolean, Integer)}
221-
*/
222-
@Deprecated
223-
List<WxCpUser> departGetUsers(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException;
224-
225-
/**
226-
* @deprecated 请使用 {@link WxCpTagService#create(String)}
227-
*/
228-
@Deprecated
229-
String tagCreate(String tagName) throws WxErrorException;
230-
231-
/**
232-
* @deprecated 请使用 {@link WxCpTagService#update(String, String)}
233-
*/
234-
@Deprecated
235-
void tagUpdate(String tagId, String tagName) throws WxErrorException;
236-
237-
/**
238-
* @deprecated 请使用 {@link WxCpTagService#delete(String)}
239-
*/
240-
@Deprecated
241-
void tagDelete(String tagId) throws WxErrorException;
242-
243-
/**
244-
* @deprecated 请使用 {@link WxCpTagService#listAll()}
245-
*/
246-
@Deprecated
247-
List<WxCpTag> tagGet() throws WxErrorException;
248-
249-
/**
250-
* @deprecated 请使用 {@link WxCpTagService#listUsersByTagId(String)}
251-
*/
252-
@Deprecated
253-
List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException;
254-
255-
/**
256-
* @deprecated 请使用 {@link WxCpTagService#addUsers2Tag(String, List, List)}
257-
*/
258-
@Deprecated
259-
void tagAddUsers(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException;
260-
261-
/**
262-
* @deprecated 请使用 {@link WxCpTagService#removeUsersFromTag(String, List)}
263-
*/
264-
@Deprecated
265-
void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
266-
267-
/**
268-
* @deprecated 请使用 {@link WxCpOAuth2Service#buildAuthorizationUrl(String)}
269-
*/
270-
@Deprecated
271-
String oauth2buildAuthorizationUrl(String state);
272-
273-
/**
274-
* @deprecated 请使用 {@link WxCpOAuth2Service#buildAuthorizationUrl(String, String)}
275-
*/
276-
@Deprecated
277-
String oauth2buildAuthorizationUrl(String redirectUri, String state);
278-
279-
/**
280-
* @deprecated 请使用 {@link WxCpOAuth2Service#getUserInfo(String)}
281-
*/
282-
@Deprecated
283-
String[] oauth2getUserInfo(String code) throws WxErrorException;
284-
285-
/**
286-
* @deprecated 请使用 {@link WxCpOAuth2Service#getUserInfo(Integer, String)}
287-
*/
288-
@Deprecated
289-
String[] oauth2getUserInfo(Integer agentId, String code) throws WxErrorException;
290-
291-
/**
292-
* <pre>
293-
* 邀请成员关注
294-
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8
295-
* </pre>
296-
*
297-
* @param userId 用户的userid
298-
* @param inviteTips 推送到微信上的提示语(只有认证号可以使用)。当使用微信推送时,该字段默认为“请关注XXX企业号”,邮件邀请时,该字段无效。
299-
* @return 1:微信邀请 2.邮件邀请
300-
*/
301-
int invite(String userId, String inviteTips) throws WxErrorException;
302-
30398
/**
30499
* <pre>
305100
* 获取微信服务器的ip段

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpUserService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,16 @@ public interface WxCpUserService {
8080
* @param userid 用户id
8181
*/
8282
WxCpUser getById(String userid) throws WxErrorException;
83+
84+
/**
85+
* <pre>
86+
* 邀请成员关注
87+
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8
88+
* </pre>
89+
*
90+
* @param userId 用户的userid
91+
* @param inviteTips 推送到微信上的提示语(只有认证号可以使用)。当使用微信推送时,该字段默认为“请关注XXX企业号”,邮件邀请时,该字段无效。
92+
* @return 1:微信邀请 2.邮件邀请
93+
*/
94+
int invite(String userId, String inviteTips) throws WxErrorException;
8395
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public String buildAuthorizationUrl(String redirectUri, String state) {
4747

4848
@Override
4949
public String[] getUserInfo(String code) throws WxErrorException {
50-
return getUserInfo(this.mainService.getWxCpConfigStorage().getAgentId(), code);
50+
return this.getUserInfo(this.mainService.getWxCpConfigStorage().getAgentId(), code);
5151
}
5252

5353
@Override

0 commit comments

Comments
 (0)