mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
实现多客服会话控制的接口
This commit is contained in:
@@ -3,9 +3,12 @@ package me.chanjar.weixin.mp.api;
|
||||
import java.io.File;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.request.WxMpKfAccountRequest;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfList;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfOnlineList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;
|
||||
|
||||
/**
|
||||
* 客服接口 ,
|
||||
@@ -15,59 +18,112 @@ import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfOnlineList;
|
||||
* @author Binary Wang
|
||||
*
|
||||
*/
|
||||
public interface WxMpKefuService {
|
||||
public interface WxMpKefuService {
|
||||
|
||||
//*******************客服管理接口***********************//
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客服基本信息
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN
|
||||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
WxMpKfList kfList() throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取在线客服接待信息
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=ACCESS_TOKEN
|
||||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
WxMpKfOnlineList kfOnlineList() throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 添加客服账号
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN
|
||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
boolean kfAccountAdd(WxMpKfAccountRequest request) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 设置客服信息(更新)
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN
|
||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
boolean kfAccountUpdate(WxMpKfAccountRequest request) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 上传客服头像
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||
* 接口url格式:http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
boolean kfAccountUploadHeadImg(String kfAccount, File imgFile) throws WxErrorException;
|
||||
|
||||
boolean kfAccountUploadHeadImg(String kfAccount, File imgFile)
|
||||
throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除客服账号
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/18/749901f4e123170fb8a4d447ae6040ba.html">客服管理</a>
|
||||
* https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||
* 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||
* </pre>
|
||||
*/
|
||||
boolean kfAccountDel(String kfAccount) throws WxErrorException;
|
||||
|
||||
//*******************多客服会话控制接口***********************//
|
||||
/**
|
||||
* <pre>
|
||||
* 创建会话
|
||||
* 开发者可以使用本接口,为多客服的客服工号创建会话,将某个客户直接指定给客服工号接待,需要注意此接口不会受客服自动接入数以及自动接入开关限制。只能为在线的客服(PC客户端在线,或者已绑定多客服助手)创建会话。
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/4/4b256cfb246b22ad020e07cf8a61a738.html">多客服会话控制接口</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
boolean kfSessionCreate(String openid, String kfAccount, String text) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 关闭会话
|
||||
* 开发者可以使用本接口,关闭一个会话。
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/4/4b256cfb246b22ad020e07cf8a61a738.html">多客服会话控制接口</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
boolean kfSessionClose(String openid, String kfAccount, String text) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客户的会话状态
|
||||
* 开发者可以通过本接口获取客户当前的会话状态。
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/4/4b256cfb246b22ad020e07cf8a61a738.html">多客服会话控制接口</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID
|
||||
* </pre>
|
||||
*/
|
||||
WxMpKfSessionGetResult kfSessionGet(String openid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取客服的会话列表
|
||||
* 开发者可以通过本接口获取某个客服正在接待的会话列表。
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/4/4b256cfb246b22ad020e07cf8a61a738.html">多客服会话控制接口</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
|
||||
* </pre>
|
||||
*/
|
||||
WxMpKfSessionList kfSessionList(String kfAccount) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取未接入会话列表
|
||||
* 开发者可以通过本接口获取当前正在等待队列中的会话列表,此接口最多返回最早进入队列的100个未接入会话。
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki/4/4b256cfb246b22ad020e07cf8a61a738.html">多客服会话控制接口</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*/
|
||||
WxMpKfSessionWaitCaseList kfSessionGetWaitCase() throws WxErrorException;
|
||||
}
|
||||
|
||||
@@ -1,35 +1,23 @@
|
||||
package me.chanjar.weixin.mp.api;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.WxAccessToken;
|
||||
import me.chanjar.weixin.common.bean.WxCardApiSignature;
|
||||
import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
||||
import me.chanjar.weixin.common.bean.WxMenu;
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.session.StandardSessionManager;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.common.util.RandomUtils;
|
||||
import me.chanjar.weixin.common.util.crypto.SHA1;
|
||||
import me.chanjar.weixin.common.util.crypto.WxCryptUtil;
|
||||
import me.chanjar.weixin.common.util.fs.FileUtils;
|
||||
import me.chanjar.weixin.common.util.http.*;
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpKefuServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.*;
|
||||
import me.chanjar.weixin.mp.bean.result.*;
|
||||
import me.chanjar.weixin.mp.util.http.*;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.Charsets;
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
@@ -45,16 +33,85 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.helpers.MessageFormatter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.WxAccessToken;
|
||||
import me.chanjar.weixin.common.bean.WxCardApiSignature;
|
||||
import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
||||
import me.chanjar.weixin.common.bean.WxMenu;
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.session.StandardSessionManager;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.common.util.RandomUtils;
|
||||
import me.chanjar.weixin.common.util.crypto.SHA1;
|
||||
import me.chanjar.weixin.common.util.crypto.WxCryptUtil;
|
||||
import me.chanjar.weixin.common.util.fs.FileUtils;
|
||||
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
|
||||
import me.chanjar.weixin.common.util.http.DefaultApacheHttpHttpClientBuilder;
|
||||
import me.chanjar.weixin.common.util.http.MediaDownloadRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.URIUtil;
|
||||
import me.chanjar.weixin.common.util.http.Utf8ResponseHandler;
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpKefuServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpGroup;
|
||||
import me.chanjar.weixin.mp.bean.WxMpIndustry;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterial;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate;
|
||||
import me.chanjar.weixin.mp.bean.WxMpMaterialNews;
|
||||
import me.chanjar.weixin.mp.bean.WxMpSemanticQuery;
|
||||
import me.chanjar.weixin.mp.bean.WxMpTemplateMessage;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMediaImgUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialCountResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialFileBatchGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialNewsBatchGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialUploadResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialVideoInfoResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpPayCallback;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpPayRefundResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpPayResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpPrepayIdResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserSummary;
|
||||
import me.chanjar.weixin.mp.bean.result.WxRedpackResult;
|
||||
import me.chanjar.weixin.mp.util.http.MaterialDeleteRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.MaterialNewsInfoRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.MaterialUploadRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.MaterialVideoInfoRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.MaterialVoiceAndImageDownloadRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.MediaImgUploadRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.http.QrCodeRequestExecutor;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
public class WxMpServiceImpl implements WxMpService {
|
||||
|
||||
|
||||
@@ -8,9 +8,13 @@ import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
|
||||
import me.chanjar.weixin.mp.api.WxMpKefuService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.request.WxMpKfAccountRequest;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfList;
|
||||
import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfOnlineList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
|
||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,45 +31,103 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
|
||||
@Override
|
||||
public WxMpKfList kfList() throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/customservice/getkflist";
|
||||
String responseContent = this.wxMpService.execute(
|
||||
new SimpleGetRequestExecutor(), url, null);
|
||||
String responseContent = this.wxMpService
|
||||
.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return WxMpKfList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpKfOnlineList kfOnlineList() throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist";
|
||||
String responseContent = this.wxMpService.execute(
|
||||
new SimpleGetRequestExecutor(), url, null);
|
||||
String responseContent = this.wxMpService
|
||||
.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return WxMpKfOnlineList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfAccountAdd(WxMpKfAccountRequest request) throws WxErrorException {
|
||||
public boolean kfAccountAdd(WxMpKfAccountRequest request)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/add";
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, request.toJson());
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||
request.toJson());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfAccountUpdate(WxMpKfAccountRequest request) throws WxErrorException {
|
||||
public boolean kfAccountUpdate(WxMpKfAccountRequest request)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/update";
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, request.toJson());
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||
request.toJson());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfAccountUploadHeadImg(String kfAccount, File imgFile) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?kf_account=" + kfAccount ;
|
||||
public boolean kfAccountUploadHeadImg(String kfAccount, File imgFile)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?kf_account="
|
||||
+ kfAccount;
|
||||
this.wxMpService.execute(new MediaUploadRequestExecutor(), url, imgFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfAccountDel(String kfAccount) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/del?kf_account=" + kfAccount;
|
||||
String url = "https://api.weixin.qq.com/customservice/kfaccount/del?kf_account="
|
||||
+ kfAccount;
|
||||
this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfSessionCreate(String openid, String kfAccount, String text)
|
||||
throws WxErrorException {
|
||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid,
|
||||
text);
|
||||
String url = "https://api.weixin.qq.com/customservice/kfsession/create";
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||
request.toJson());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean kfSessionClose(String openid, String kfAccount, String text)
|
||||
throws WxErrorException {
|
||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid,
|
||||
text);
|
||||
String url = "https://api.weixin.qq.com/customservice/kfsession/close";
|
||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url,
|
||||
request.toJson());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpKfSessionGetResult kfSessionGet(String openid)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfsession/getsession?openid="
|
||||
+ openid;
|
||||
String responseContent = this.wxMpService
|
||||
.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return WxMpKfSessionGetResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpKfSessionList kfSessionList(String kfAccount)
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfsession/getsessionlist?kf_account="
|
||||
+ kfAccount;
|
||||
String responseContent = this.wxMpService
|
||||
.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return WxMpKfSessionList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpKfSessionWaitCaseList kfSessionGetWaitCase()
|
||||
throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/customservice/kfsession/getwaitcase";
|
||||
String responseContent = this.wxMpService
|
||||
.execute(new SimpleGetRequestExecutor(), url, null);
|
||||
return WxMpKfSessionWaitCaseList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user