简化优化客服相关接口代码

This commit is contained in:
BinaryWang 2016-07-05 10:55:47 +08:00
parent 244df15d83
commit f9022814fd
5 changed files with 3 additions and 33 deletions

View File

@ -1,15 +0,0 @@
package me.chanjar.weixin.mp.api;
/**
*
* @author Binary Wang
*
*/
public interface WxMpBaseChildService {
/**
* 设置WxMpService对象
* @return
*/
void setWxMpService(WxMpService wxMpService);
}

View File

@ -15,7 +15,7 @@ import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfOnlineList;
* @author Binary Wang * @author Binary Wang
* *
*/ */
public interface WxMpKefuService extends WxMpBaseChildService { public interface WxMpKefuService {
/** /**
* <pre> * <pre>
* 获取客服基本信息 * 获取客服基本信息

View File

@ -23,6 +23,7 @@ import me.chanjar.weixin.common.util.http.*;
import me.chanjar.weixin.common.util.json.GsonHelper; import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.common.util.json.WxGsonBuilder; import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.common.util.xml.XStreamInitializer; 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.*;
import me.chanjar.weixin.mp.bean.result.*; import me.chanjar.weixin.mp.bean.result.*;
import me.chanjar.weixin.mp.util.http.*; import me.chanjar.weixin.mp.util.http.*;
@ -75,7 +76,7 @@ public class WxMpServiceImpl implements WxMpService {
protected WxMpConfigStorage wxMpConfigStorage; protected WxMpConfigStorage wxMpConfigStorage;
protected WxMpKefuService kefuService; protected WxMpKefuService kefuService = new WxMpKefuServiceImpl(this);
protected CloseableHttpClient httpClient; protected CloseableHttpClient httpClient;
@ -1377,8 +1378,4 @@ public class WxMpServiceImpl implements WxMpService {
return this.kefuService; return this.kefuService;
} }
public void setKefuService(WxMpKefuService kefuService) {
this.kefuService = kefuService;
this.kefuService.setWxMpService(this);
}
} }

View File

@ -20,19 +20,10 @@ import me.chanjar.weixin.mp.bean.customerservice.result.WxMpKfOnlineList;
public class WxMpKefuServiceImpl implements WxMpKefuService { public class WxMpKefuServiceImpl implements WxMpKefuService {
private WxMpService wxMpService; private WxMpService wxMpService;
public WxMpKefuServiceImpl(){
}
public WxMpKefuServiceImpl(WxMpService wxMpService) { public WxMpKefuServiceImpl(WxMpService wxMpService) {
this.wxMpService = wxMpService; this.wxMpService = wxMpService;
} }
@Override
public void setWxMpService(WxMpService wxMpService) {
this.wxMpService = wxMpService;
}
@Override @Override
public WxMpKfList kfList() throws WxErrorException { public WxMpKfList kfList() throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/customservice/getkflist"; String url = "https://api.weixin.qq.com/cgi-bin/customservice/getkflist";

View File

@ -24,9 +24,6 @@ public class ApiTestModule implements Module {
WxMpServiceImpl wxService = new WxMpServiceImpl(); WxMpServiceImpl wxService = new WxMpServiceImpl();
wxService.setWxMpConfigStorage(config); wxService.setWxMpConfigStorage(config);
WxMpKefuService kefuService = new WxMpKefuServiceImpl();
wxService.setKefuService(kefuService);
binder.bind(WxMpServiceImpl.class).toInstance(wxService); binder.bind(WxMpServiceImpl.class).toInstance(wxService);
binder.bind(WxMpConfigStorage.class).toInstance(config); binder.bind(WxMpConfigStorage.class).toInstance(config);
} catch (IOException e) { } catch (IOException e) {