主要改进了部分API的名称
This commit is contained in:
parent
b706f80cee
commit
e953a748e0
@ -9,13 +9,13 @@ weixin4j
|
|||||||
-------
|
-------
|
||||||
* **weixin4j-mp**
|
* **weixin4j-mp**
|
||||||
|
|
||||||
`公众平台API全封装`
|
`公众平台API封装`
|
||||||
|
|
||||||
`微信支付(刷卡/扫码/公众号)`
|
`微信支付(刷卡/扫码/公众号)`
|
||||||
|
|
||||||
* **weixin4j-qy**
|
* **weixin4j-qy**
|
||||||
|
|
||||||
`企业号API全封装`
|
`企业号API封装`
|
||||||
|
|
||||||
`微信支付(刷卡/扫码/公众号)`
|
`微信支付(刷卡/扫码/公众号)`
|
||||||
|
|
||||||
@ -76,6 +76,6 @@ weixin4j
|
|||||||
|
|
||||||
* 硬件设备 & 摇一摇周边
|
* 硬件设备 & 摇一摇周边
|
||||||
|
|
||||||
* 微信小店
|
* 微信小店&门店
|
||||||
|
|
||||||
* 微信卡券
|
* 微信卡券
|
||||||
@ -440,9 +440,9 @@ public class WeixinProxy {
|
|||||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
public List<KfAccount> listKfAccount(boolean isOnline)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return customApi.getKfAccountList(isOnline);
|
return customApi.listKfAccount(isOnline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -463,9 +463,9 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult addAccount(String id, String name, String pwd)
|
public JsonResult createAccount(String id, String name, String pwd)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return customApi.addAccount(id, name, pwd);
|
return customApi.createAccount(id, name, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -601,9 +601,9 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getKfSessionList(String kfAccount)
|
public List<KfSession> listKfSession(String kfAccount)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return customApi.getKfSessionList(kfAccount);
|
return customApi.listKfSession(kfAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -617,8 +617,8 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
public List<KfSession> listKfSessionWait() throws WeixinException {
|
||||||
return customApi.getKfSessionWaitList();
|
return customApi.listKfSessionWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -822,12 +822,12 @@ public class WeixinProxy {
|
|||||||
* @return 消息发送状态
|
* @return 消息发送状态
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||||
* @see {@link com.foxinmy.weixin4j.mp.event.MassEventMessage#getStatusDesc(String)}
|
* @see {@link com.foxinmy.weixin4j.util.MessageUtil#getStatusDesc(String)}
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
||||||
*/
|
*/
|
||||||
public String getMassNews(String msgId) throws WeixinException {
|
public String getMassNewStatus(String msgId) throws WeixinException {
|
||||||
return massApi.getMassNews(msgId);
|
return massApi.getMassNewStatus(msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1210,8 +1210,8 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getcallbackip() throws WeixinException {
|
public List<String> getCallbackip() throws WeixinException {
|
||||||
return helperApi.getcallbackip();
|
return helperApi.getCallbackip();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class CustomApi extends MpApi {
|
|||||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
public List<KfAccount> listKfAccount(boolean isOnline)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String text = "";
|
String text = "";
|
||||||
@ -130,7 +130,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult addAccount(String id, String name, String pwd)
|
public JsonResult createAccount(String id, String name, String pwd)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("kf_account", id);
|
obj.put("kf_account", id);
|
||||||
@ -322,7 +322,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getKfSessionList(String kfAccount)
|
public List<KfSession> listKfSession(String kfAccount)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_list_uri = getRequestUri("kfsession_list_uri");
|
String kfsession_list_uri = getRequestUri("kfsession_list_uri");
|
||||||
@ -343,7 +343,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
public List<KfSession> listKfSessionWait() throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_wait_uri = getRequestUri("kfsession_wait_uri");
|
String kfsession_wait_uri = getRequestUri("kfsession_wait_uri");
|
||||||
WeixinResponse response = weixinClient.get(String.format(kfsession_wait_uri,
|
WeixinResponse response = weixinClient.get(String.format(kfsession_wait_uri,
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class HelperApi extends MpApi {
|
|||||||
* href="http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html">获取IP地址</a>
|
* href="http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html">获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getcallbackip() throws WeixinException {
|
public List<String> getCallbackip() throws WeixinException {
|
||||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinClient.post(String.format(getcallbackip_uri,
|
WeixinResponse response = weixinClient.post(String.format(getcallbackip_uri,
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.foxinmy.weixin4j.mp.api;
|
package com.foxinmy.weixin4j.mp.api;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -303,13 +305,13 @@ public class MassApi extends MpApi {
|
|||||||
*
|
*
|
||||||
* @param msgId
|
* @param msgId
|
||||||
* 消息ID
|
* 消息ID
|
||||||
* @return 消息发送状态
|
* @return 消息发送状态,如sendsuccess:发送成功、sendfail:发送失败
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see {@link com.foxinmy.weixin4j.mp.event.MassEventMessage#getStatusDesc(String)}
|
* @see {@link com.foxinmy.weixin4j.mp.event.MassEventMessage#getStatusDesc(String)}
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
||||||
*/
|
*/
|
||||||
public String getMassNews(String msgId) throws WeixinException {
|
public String getMassNewStatus(String msgId) throws WeixinException {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("msg_id", msgId);
|
obj.put("msg_id", msgId);
|
||||||
String mass_get_uri = getRequestUri("mass_get_uri");
|
String mass_get_uri = getRequestUri("mass_get_uri");
|
||||||
@ -318,6 +320,29 @@ public class MassApi extends MpApi {
|
|||||||
String.format(mass_get_uri, token.getAccessToken()),
|
String.format(mass_get_uri, token.getAccessToken()),
|
||||||
obj.toJSONString());
|
obj.toJSONString());
|
||||||
|
|
||||||
return response.getAsJson().getString("msg_status");
|
String status = response.getAsJson().getString("msg_status");
|
||||||
|
String desc = massStatusMap.get(status);
|
||||||
|
return String.format("%s:%s", status, desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static Map<String, String> massStatusMap;
|
||||||
|
static {
|
||||||
|
massStatusMap = new HashMap<String, String>();
|
||||||
|
massStatusMap.put("sendsuccess", "发送成功");
|
||||||
|
massStatusMap.put("send_success", "发送成功");
|
||||||
|
massStatusMap.put("success", "发送成功");
|
||||||
|
massStatusMap.put("send success", "发送成功");
|
||||||
|
massStatusMap.put("sendfail", "发送失败");
|
||||||
|
massStatusMap.put("send_fail", "发送失败");
|
||||||
|
massStatusMap.put("fail", "发送失败");
|
||||||
|
massStatusMap.put("send fail", "发送失败");
|
||||||
|
massStatusMap.put("err(10001)", "涉嫌广告");
|
||||||
|
massStatusMap.put("err(20001)", "涉嫌政治");
|
||||||
|
massStatusMap.put("err(20004)", "涉嫌社会");
|
||||||
|
massStatusMap.put("err(20006)", "涉嫌违法犯罪");
|
||||||
|
massStatusMap.put("err(20008)", "涉嫌欺诈");
|
||||||
|
massStatusMap.put("err(20013)", "涉嫌版权");
|
||||||
|
massStatusMap.put("err(22000)", "涉嫌互推(互相宣传)");
|
||||||
|
massStatusMap.put("err(21000)", "涉嫌其他");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,15 +53,15 @@ public class CustomTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void kfList() throws WeixinException {
|
public void kfList() throws WeixinException {
|
||||||
List<KfAccount> kfList = customApi.getKfAccountList(false);
|
List<KfAccount> kfList = customApi.listKfAccount(false);
|
||||||
System.out.println(kfList);
|
System.out.println(kfList);
|
||||||
kfList = customApi.getKfAccountList(true);
|
kfList = customApi.listKfAccount(true);
|
||||||
System.out.println(kfList);
|
System.out.println(kfList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addAccount() throws WeixinException {
|
public void addAccount() throws WeixinException {
|
||||||
JsonResult result = customApi.addAccount("test@test", "test", "123456");
|
JsonResult result = customApi.createAccount("test@test", "test", "123456");
|
||||||
Assert.assertEquals(0, result.getCode());
|
Assert.assertEquals(0, result.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,13 +108,13 @@ public class CustomTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSessionList() throws WeixinException {
|
public void getSessionList() throws WeixinException {
|
||||||
List<KfSession> sessionList = customApi.getKfSessionList("kfAccount");
|
List<KfSession> sessionList = customApi.listKfSession("kfAccount");
|
||||||
System.err.println(sessionList);
|
System.err.println(sessionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSessionWaitList() throws WeixinException {
|
public void getSessionWaitList() throws WeixinException {
|
||||||
List<KfSession> sessionList = customApi.getKfSessionWaitList();
|
List<KfSession> sessionList = customApi.listKfSessionWait();
|
||||||
System.err.println(sessionList);
|
System.err.println(sessionList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class HelpTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getcallbackip() throws WeixinException {
|
public void getcallbackip() throws WeixinException {
|
||||||
List<String> ipList = helperApi.getcallbackip();
|
List<String> ipList = helperApi.getCallbackip();
|
||||||
Assert.assertFalse(ipList.isEmpty());
|
Assert.assertFalse(ipList.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public class MassTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getMassNews() throws WeixinException {
|
public void getMassNews() throws WeixinException {
|
||||||
String status = massApi.getMassNews("82358");
|
String status = massApi.getMassNewStatus("82358");
|
||||||
System.out.println(status);
|
System.out.println(status);
|
||||||
Assert.assertNotNull(status);
|
Assert.assertNotNull(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -695,8 +695,8 @@ public class WeixinProxy {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getcallbackip() throws WeixinException {
|
public List<String> getCallbackip() throws WeixinException {
|
||||||
return helperApi.getcallbackip();
|
return helperApi.getCallbackip();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -762,9 +762,9 @@ public class WeixinProxy {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String inviteuser(IdParameter parameter, Callback callback,
|
public String batchInviteUser(IdParameter parameter, Callback callback,
|
||||||
String tips) throws WeixinException {
|
String tips) throws WeixinException {
|
||||||
return batchApi.inviteuser(parameter, callback, tips);
|
return batchApi.inviteUser(parameter, callback, tips);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -786,9 +786,9 @@ public class WeixinProxy {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">批量更新成员</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">批量更新成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String syncuser(String mediaId, Callback callback)
|
public String batchSyncUser(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return batchApi.syncuser(mediaId, callback);
|
return batchApi.syncUser(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -811,9 +811,9 @@ public class WeixinProxy {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">批量覆盖成员</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">批量覆盖成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String replaceuser(String mediaId, Callback callback)
|
public String batchReplaceUser(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return batchApi.replaceuser(mediaId, callback);
|
return batchApi.replaceUser(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -853,9 +853,9 @@ public class WeixinProxy {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">批量覆盖部门</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">批量覆盖部门</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String replaceparty(String mediaId, Callback callback)
|
public String batchReplaceParty(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return batchApi.replaceparty(mediaId, callback);
|
return batchApi.replaceParty(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class BatchApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String inviteuser(IdParameter parameter, Callback callback,
|
public String inviteUser(IdParameter parameter, Callback callback,
|
||||||
String tips) throws WeixinException {
|
String tips) throws WeixinException {
|
||||||
String batch_inviteuser_uri = getRequestUri("batch_inviteuser_uri");
|
String batch_inviteuser_uri = getRequestUri("batch_inviteuser_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
@ -81,7 +81,7 @@ public class BatchApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">批量更新成员</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">批量更新成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String syncuser(String mediaId, Callback callback)
|
public String syncUser(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
String batch_syncuser_uri = getRequestUri("batch_syncuser_uri");
|
String batch_syncuser_uri = getRequestUri("batch_syncuser_uri");
|
||||||
return batch(batch_syncuser_uri, mediaId, callback);
|
return batch(batch_syncuser_uri, mediaId, callback);
|
||||||
@ -119,7 +119,7 @@ public class BatchApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">批量覆盖成员</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">批量覆盖成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String replaceuser(String mediaId, Callback callback)
|
public String replaceUser(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
String batch_replaceuser_uri = getRequestUri("batch_replaceuser_uri");
|
String batch_replaceuser_uri = getRequestUri("batch_replaceuser_uri");
|
||||||
return batch(batch_replaceuser_uri, mediaId, callback);
|
return batch(batch_replaceuser_uri, mediaId, callback);
|
||||||
@ -144,7 +144,7 @@ public class BatchApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">批量覆盖部门</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">批量覆盖部门</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String replaceparty(String mediaId, Callback callback)
|
public String replaceParty(String mediaId, Callback callback)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
String batch_replaceparty_uri = getRequestUri("batch_replaceparty_uri");
|
String batch_replaceparty_uri = getRequestUri("batch_replaceparty_uri");
|
||||||
return batch(batch_replaceparty_uri, mediaId, callback);
|
return batch(batch_replaceparty_uri, mediaId, callback);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class HelperApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getcallbackip() throws WeixinException {
|
public List<String> getCallbackip() throws WeixinException {
|
||||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinClient.post(String.format(getcallbackip_uri,
|
WeixinResponse response = weixinClient.post(String.format(getcallbackip_uri,
|
||||||
|
|||||||
@ -43,7 +43,9 @@ public class PartyApi extends QyApi {
|
|||||||
public int createParty(Party depart) throws WeixinException {
|
public int createParty(Party depart) throws WeixinException {
|
||||||
String department_create_uri = getRequestUri("department_create_uri");
|
String department_create_uri = getRequestUri("department_create_uri");
|
||||||
JSONObject obj = (JSONObject) JSON.toJSON(depart);
|
JSONObject obj = (JSONObject) JSON.toJSON(depart);
|
||||||
obj.remove("id");
|
if (depart.getId() < 1) {
|
||||||
|
obj.remove("id");
|
||||||
|
}
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinClient.post(
|
WeixinResponse response = weixinClient.post(
|
||||||
String.format(department_create_uri, token.getAccessToken()),
|
String.format(department_create_uri, token.getAccessToken()),
|
||||||
@ -75,7 +77,8 @@ public class PartyApi extends QyApi {
|
|||||||
/**
|
/**
|
||||||
* 查询部门列表(以部门的order字段从小到大排列)
|
* 查询部门列表(以部门的order字段从小到大排列)
|
||||||
*
|
*
|
||||||
* @param partId 部门ID。获取指定部门ID下的子部门
|
* @param partId
|
||||||
|
* 部门ID。获取指定部门ID下的子部门
|
||||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E5.88.97.E8.A1.A8">获取部门列表</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E5.88.97.E8.A1.A8">获取部门列表</a>
|
||||||
@ -85,8 +88,8 @@ public class PartyApi extends QyApi {
|
|||||||
public List<Party> listParty(int partId) throws WeixinException {
|
public List<Party> listParty(int partId) throws WeixinException {
|
||||||
String department_list_uri = getRequestUri("department_list_uri");
|
String department_list_uri = getRequestUri("department_list_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinClient.post(String.format(department_list_uri,
|
WeixinResponse response = weixinClient.post(String.format(
|
||||||
token.getAccessToken()));
|
department_list_uri, token.getAccessToken()));
|
||||||
return JSON.parseArray(response.getAsJson().getString("department"),
|
return JSON.parseArray(response.getAsJson().getString("department"),
|
||||||
Party.class);
|
Party.class);
|
||||||
}
|
}
|
||||||
@ -104,8 +107,8 @@ public class PartyApi extends QyApi {
|
|||||||
public JsonResult deleteParty(int partId) throws WeixinException {
|
public JsonResult deleteParty(int partId) throws WeixinException {
|
||||||
String department_delete_uri = getRequestUri("department_delete_uri");
|
String department_delete_uri = getRequestUri("department_delete_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinClient.post(String.format(department_delete_uri,
|
WeixinResponse response = weixinClient.post(String.format(
|
||||||
token.getAccessToken(), partId));
|
department_delete_uri, token.getAccessToken(), partId));
|
||||||
return response.getAsJsonResult();
|
return response.getAsJsonResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class BatchTest extends TokenTest {
|
|||||||
@Test
|
@Test
|
||||||
public void syncuser() throws WeixinException {
|
public void syncuser() throws WeixinException {
|
||||||
String jobId = batchApi
|
String jobId = batchApi
|
||||||
.syncuser(
|
.syncUser(
|
||||||
"1QFmZ8LE9dFxPPx8EH5Kfm3cqGXB0OuXY432ZpsfwMFTJjEDt7QI4GZB1UhYGOSYr",
|
"1QFmZ8LE9dFxPPx8EH5Kfm3cqGXB0OuXY432ZpsfwMFTJjEDt7QI4GZB1UhYGOSYr",
|
||||||
new Callback("http://182.254.188.133:8090",
|
new Callback("http://182.254.188.133:8090",
|
||||||
"gp2eGT5mIpngr",
|
"gp2eGT5mIpngr",
|
||||||
@ -46,7 +46,7 @@ public class BatchTest extends TokenTest {
|
|||||||
public void replaceparty() throws WeixinException {
|
public void replaceparty() throws WeixinException {
|
||||||
String mediaId = mediaApi.batchUploadParties(Arrays.asList(new Party(5,
|
String mediaId = mediaApi.batchUploadParties(Arrays.asList(new Party(5,
|
||||||
"部门1", 1, 1), new Party(6, "部门2", 1, 1)));
|
"部门1", 1, 1), new Party(6, "部门2", 1, 1)));
|
||||||
String jobId = batchApi.replaceparty(mediaId, new Callback(
|
String jobId = batchApi.replaceParty(mediaId, new Callback(
|
||||||
"http://182.254.188.133:8090", "gp2eGT5mIpngr",
|
"http://182.254.188.133:8090", "gp2eGT5mIpngr",
|
||||||
"BRYfV4zPFUJb3v3MySNBg1ERKE3vyyMRoScu76vFySv"));
|
"BRYfV4zPFUJb3v3MySNBg1ERKE3vyyMRoScu76vFySv"));
|
||||||
System.err.println(jobId);
|
System.err.println(jobId);
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class HelperTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backip() throws WeixinException {
|
public void backip() throws WeixinException {
|
||||||
List<String> ips = helperApi.getcallbackip();
|
List<String> ips = helperApi.getCallbackip();
|
||||||
Assert.assertTrue(ips != null && !ips.isEmpty());
|
Assert.assertTrue(ips != null && !ips.isEmpty());
|
||||||
System.out.println(ips);
|
System.out.println(ips);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import javax.xml.bind.annotation.XmlElement;
|
|||||||
|
|
||||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||||
import com.foxinmy.weixin4j.type.EventType;
|
import com.foxinmy.weixin4j.type.EventType;
|
||||||
import com.foxinmy.weixin4j.util.MessageUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 群发消息事件推送
|
* 群发消息事件推送
|
||||||
@ -55,18 +54,6 @@ public class MassEventMessage extends EventMessage {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送状态描述</br> err(10001,涉嫌广告) err(20001,涉嫌政治) err(20004,涉嫌社会)</br>
|
|
||||||
* err(20002,涉嫌色情) err(20006,涉嫌违法犯罪) err(20008,涉嫌欺诈)</br> err(20013,涉嫌版权)
|
|
||||||
* err(22000,涉嫌互推(互相宣传) err(21000,涉嫌其他)
|
|
||||||
*
|
|
||||||
* @param status
|
|
||||||
* @return 中文描述
|
|
||||||
*/
|
|
||||||
public String getStatusDesc() {
|
|
||||||
return MessageUtil.getMassStatusDesc(status.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalCount() {
|
public int getTotalCount() {
|
||||||
return totalCount;
|
return totalCount;
|
||||||
}
|
}
|
||||||
@ -85,7 +72,7 @@ public class MassEventMessage extends EventMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MassEventMessage [status=" + getStatusDesc() + ", totalCount="
|
return "MassEventMessage [status=" + status + ", totalCount="
|
||||||
+ totalCount + ", filterCount=" + filterCount + ", sentCount="
|
+ totalCount + ", filterCount=" + filterCount + ", sentCount="
|
||||||
+ sentCount + ", errorCount=" + errorCount + ", "
|
+ sentCount + ", errorCount=" + errorCount + ", "
|
||||||
+ super.toString() + "]";
|
+ super.toString() + "]";
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package com.foxinmy.weixin4j.util;
|
package com.foxinmy.weixin4j.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
@ -155,36 +153,4 @@ public final class MessageUtil {
|
|||||||
}
|
}
|
||||||
return xmlContent;
|
return xmlContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Map<String, String> massStatusMap;
|
|
||||||
static {
|
|
||||||
massStatusMap = new HashMap<String, String>();
|
|
||||||
massStatusMap.put("sendsuccess", "发送成功");
|
|
||||||
massStatusMap.put("send_success", "发送成功");
|
|
||||||
massStatusMap.put("success", "发送成功");
|
|
||||||
massStatusMap.put("send success", "发送成功");
|
|
||||||
massStatusMap.put("sendfail", "发送失败");
|
|
||||||
massStatusMap.put("send_fail", "发送失败");
|
|
||||||
massStatusMap.put("fail", "发送失败");
|
|
||||||
massStatusMap.put("send fail", "发送失败");
|
|
||||||
massStatusMap.put("err(10001)", "涉嫌广告");
|
|
||||||
massStatusMap.put("err(20001)", "涉嫌政治");
|
|
||||||
massStatusMap.put("err(20004)", "涉嫌社会");
|
|
||||||
massStatusMap.put("err(20006)", "涉嫌违法犯罪");
|
|
||||||
massStatusMap.put("err(20008)", "涉嫌欺诈");
|
|
||||||
massStatusMap.put("err(20013)", "涉嫌版权");
|
|
||||||
massStatusMap.put("err(22000)", "涉嫌互推(互相宣传)");
|
|
||||||
massStatusMap.put("err(21000)", "涉嫌其他");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取群发状态描述
|
|
||||||
*
|
|
||||||
* @param status
|
|
||||||
* 状态
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getMassStatusDesc(String status) {
|
|
||||||
return massStatusMap.get(status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user