主要改进了部分API的名称
This commit is contained in:
@@ -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>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
||||
public List<KfAccount> listKfAccount(boolean isOnline)
|
||||
throws WeixinException {
|
||||
return customApi.getKfAccountList(isOnline);
|
||||
return customApi.listKfAccount(isOnline);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,9 +463,9 @@ public class WeixinProxy {
|
||||
* @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>
|
||||
*/
|
||||
public JsonResult addAccount(String id, String name, String pwd)
|
||||
public JsonResult createAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
return customApi.addAccount(id, name, pwd);
|
||||
return customApi.createAccount(id, name, pwd);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,9 +601,9 @@ public class WeixinProxy {
|
||||
* @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>
|
||||
*/
|
||||
public List<KfSession> getKfSessionList(String kfAccount)
|
||||
public List<KfSession> listKfSession(String kfAccount)
|
||||
throws WeixinException {
|
||||
return customApi.getKfSessionList(kfAccount);
|
||||
return customApi.listKfSession(kfAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,8 +617,8 @@ public class WeixinProxy {
|
||||
* @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>
|
||||
*/
|
||||
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
||||
return customApi.getKfSessionWaitList();
|
||||
public List<KfSession> listKfSessionWait() throws WeixinException {
|
||||
return customApi.listKfSessionWait();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -822,12 +822,12 @@ public class WeixinProxy {
|
||||
* 消息ID
|
||||
* @return 消息发送状态
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see {@link com.foxinmy.weixin4j.util.MessageUtil#getStatusDesc(String)}
|
||||
* @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>
|
||||
*/
|
||||
public String getMassNews(String msgId) throws WeixinException {
|
||||
*/
|
||||
public String getMassNewStatus(String msgId) throws WeixinException {
|
||||
return massApi.getMassNewStatus(msgId);
|
||||
}
|
||||
|
||||
@@ -1210,8 +1210,8 @@ public class WeixinProxy {
|
||||
* href="http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html">获取IP地址</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<String> getcallbackip() throws WeixinException {
|
||||
*/
|
||||
public List<String> getCallbackip() throws WeixinException {
|
||||
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>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
||||
public List<KfAccount> listKfAccount(boolean isOnline)
|
||||
throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
String text = "";
|
||||
@@ -130,7 +130,7 @@ public class CustomApi extends MpApi {
|
||||
* @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>
|
||||
*/
|
||||
public JsonResult addAccount(String id, String name, String pwd)
|
||||
public JsonResult createAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("kf_account", id);
|
||||
@@ -322,7 +322,7 @@ public class CustomApi extends MpApi {
|
||||
* @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>
|
||||
*/
|
||||
public List<KfSession> getKfSessionList(String kfAccount)
|
||||
public List<KfSession> listKfSession(String kfAccount)
|
||||
throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
String kfsession_list_uri = getRequestUri("kfsession_list_uri");
|
||||
@@ -343,7 +343,7 @@ public class CustomApi extends MpApi {
|
||||
* @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>
|
||||
*/
|
||||
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
||||
public List<KfSession> listKfSessionWait() throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
String kfsession_wait_uri = getRequestUri("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>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<String> getcallbackip() throws WeixinException {
|
||||
public List<String> getCallbackip() throws WeixinException {
|
||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
WeixinResponse response = weixinClient.post(String.format(getcallbackip_uri,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.foxinmy.weixin4j.mp.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -303,13 +305,13 @@ public class MassApi extends MpApi {
|
||||
* 查询群发发送状态
|
||||
*
|
||||
* @param msgId
|
||||
* 消息ID
|
||||
* 消息ID
|
||||
* @return 消息发送状态,如sendsuccess:发送成功、sendfail:发送失败
|
||||
* @throws WeixinException
|
||||
* @see {@link com.foxinmy.weixin4j.mp.event.MassEventMessage#getStatusDesc(String)}
|
||||
* @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>
|
||||
*/
|
||||
*/
|
||||
public String getMassNewStatus(String msgId) throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("msg_id", msgId);
|
||||
@@ -318,6 +320,29 @@ public class MassApi extends MpApi {
|
||||
WeixinResponse response = weixinClient.post(
|
||||
String.format(mass_get_uri, token.getAccessToken()),
|
||||
obj.toJSONString());
|
||||
|
||||
|
||||
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
|
||||
public void kfList() throws WeixinException {
|
||||
List<KfAccount> kfList = customApi.getKfAccountList(false);
|
||||
List<KfAccount> kfList = customApi.listKfAccount(false);
|
||||
System.out.println(kfList);
|
||||
kfList = customApi.getKfAccountList(true);
|
||||
kfList = customApi.listKfAccount(true);
|
||||
System.out.println(kfList);
|
||||
}
|
||||
|
||||
@Test
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ public class CustomTest extends TokenTest {
|
||||
|
||||
@Test
|
||||
public void getSessionList() throws WeixinException {
|
||||
List<KfSession> sessionList = customApi.getKfSessionList("kfAccount");
|
||||
List<KfSession> sessionList = customApi.listKfSession("kfAccount");
|
||||
System.err.println(sessionList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSessionWaitList() throws WeixinException {
|
||||
List<KfSession> sessionList = customApi.getKfSessionWaitList();
|
||||
List<KfSession> sessionList = customApi.listKfSessionWait();
|
||||
System.err.println(sessionList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class HelpTest extends TokenTest {
|
||||
|
||||
@Test
|
||||
public void getcallbackip() throws WeixinException {
|
||||
List<String> ipList = helperApi.getcallbackip();
|
||||
List<String> ipList = helperApi.getCallbackip();
|
||||
Assert.assertFalse(ipList.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MassTest extends TokenTest {
|
||||
|
||||
@Test
|
||||
public void getMassNews() throws WeixinException {
|
||||
String status = massApi.getMassNews("82358");
|
||||
String status = massApi.getMassNewStatus("82358");
|
||||
System.out.println(status);
|
||||
Assert.assertNotNull(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user