mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
按照最新微信官方文档对客服会话控制接口进行修正
This commit is contained in:
parent
42ce9a1918
commit
72c46d1bec
@ -94,7 +94,7 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
boolean kfSessionCreate(String openid, String kfAccount, String text) throws WxErrorException;
|
boolean kfSessionCreate(String openid, String kfAccount) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -104,7 +104,7 @@ public interface WxMpKefuService {
|
|||||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
|
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
boolean kfSessionClose(String openid, String kfAccount, String text) throws WxErrorException;
|
boolean kfSessionClose(String openid, String kfAccount) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -88,10 +88,9 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean kfSessionCreate(String openid, String kfAccount, String text)
|
public boolean kfSessionCreate(String openid, String kfAccount)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid,
|
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
|
||||||
text);
|
|
||||||
String url = "https://api.weixin.qq.com/customservice/kfsession/create";
|
String url = "https://api.weixin.qq.com/customservice/kfsession/create";
|
||||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||||
request.toJson());
|
request.toJson());
|
||||||
@ -99,10 +98,9 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean kfSessionClose(String openid, String kfAccount, String text)
|
public boolean kfSessionClose(String openid, String kfAccount)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid,
|
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
|
||||||
text);
|
|
||||||
String url = "https://api.weixin.qq.com/customservice/kfsession/close";
|
String url = "https://api.weixin.qq.com/customservice/kfsession/close";
|
||||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||||
request.toJson());
|
request.toJson());
|
||||||
|
@ -24,18 +24,9 @@ public class WxMpKfSessionRequest implements Serializable {
|
|||||||
@SerializedName("openid")
|
@SerializedName("openid")
|
||||||
private String openid;
|
private String openid;
|
||||||
|
|
||||||
/**
|
public WxMpKfSessionRequest(String kfAccount, String openid) {
|
||||||
* text 附加信息,文本会展示在客服人员的多客服客户端
|
|
||||||
* 目前看起来无用,主要是老版的多客服客户端使用
|
|
||||||
*/
|
|
||||||
@SerializedName("text")
|
|
||||||
@Deprecated
|
|
||||||
private String text;
|
|
||||||
|
|
||||||
public WxMpKfSessionRequest(String kfAccount, String openid, String text) {
|
|
||||||
this.kfAccount = kfAccount;
|
this.kfAccount = kfAccount;
|
||||||
this.openid = openid;
|
this.openid = openid;
|
||||||
this.text = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,12 +46,4 @@ public class WxMpKfSessionRequest implements Serializable {
|
|||||||
this.kfAccount = kfAccount;
|
this.kfAccount = kfAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return this.text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class WxMpKefuServiceImplTest {
|
|||||||
public void testKfSessionCreate(String kfAccount, String openid)
|
public void testKfSessionCreate(String kfAccount, String openid)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
boolean result = this.wxService.getKefuService().kfSessionCreate(openid,
|
boolean result = this.wxService.getKefuService().kfSessionCreate(openid,
|
||||||
kfAccount, "welcome");
|
kfAccount);
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public class WxMpKefuServiceImplTest {
|
|||||||
public void testKfSessionClose(String kfAccount, String openid)
|
public void testKfSessionClose(String kfAccount, String openid)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
boolean result = this.wxService.getKefuService().kfSessionClose(openid,
|
boolean result = this.wxService.getKefuService().kfSessionClose(openid,
|
||||||
kfAccount, "bye bye");
|
kfAccount);
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user