Skip to content

Commit 2ae95e4

Browse files
committed
clean code
1 parent 8281b63 commit 2ae95e4

4 files changed

Lines changed: 22 additions & 20 deletions

File tree

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpPayService.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback;
77
import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult;
88
import me.chanjar.weixin.mp.bean.pay.WxMpPayResult;
9-
import me.chanjar.weixin.mp.bean.pay.WxMpPrepayIdResult;
109
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult;
1110
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest;
1211
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest;

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3+
import java.io.File;
4+
import java.util.Date;
5+
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
39
import com.google.gson.JsonObject;
10+
411
import me.chanjar.weixin.common.bean.result.WxError;
512
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
613
import me.chanjar.weixin.common.exception.WxErrorException;
@@ -10,12 +17,12 @@
1017
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
1118
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
1219
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest;
13-
import me.chanjar.weixin.mp.bean.kefu.result.*;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
16-
17-
import java.io.File;
18-
import java.util.Date;
20+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
21+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
22+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
23+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
24+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
25+
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;
1926

2027
/**
2128
*
@@ -38,7 +45,7 @@ public boolean customMessageSend(WxMpCustomMessage message)
3845
throws WxErrorException {
3946
String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
4047
String responseContent = this.wxMpService.post(url, message.toJson());
41-
return true;
48+
return responseContent != null;
4249
}
4350

4451
@Override
@@ -60,22 +67,22 @@ public boolean kfAccountAdd(WxMpKfAccountRequest request)
6067
throws WxErrorException {
6168
String url = API_URL_PREFIX + "/kfaccount/add";
6269
String responseContent = this.wxMpService.post(url, request.toJson());
63-
return true;
70+
return responseContent != null;
6471
}
6572

6673
@Override
6774
public boolean kfAccountUpdate(WxMpKfAccountRequest request)
6875
throws WxErrorException {
6976
String url = API_URL_PREFIX + "/kfaccount/update";
7077
String responseContent = this.wxMpService.post(url, request.toJson());
71-
return true;
78+
return responseContent != null;
7279
}
7380

7481
@Override
7582
public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException {
7683
String url = API_URL_PREFIX + "/kfaccount/inviteworker";
7784
String responseContent = this.wxMpService.post(url, request.toJson());
78-
return true;
85+
return responseContent != null;
7986
}
8087

8188
@Override
@@ -84,14 +91,14 @@ public boolean kfAccountUploadHeadImg(String kfAccount, File imgFile)
8491
String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount;
8592
WxMediaUploadResult responseContent = this.wxMpService
8693
.execute(new MediaUploadRequestExecutor(), url, imgFile);
87-
return true;
94+
return responseContent != null;
8895
}
8996

9097
@Override
9198
public boolean kfAccountDel(String kfAccount) throws WxErrorException {
9299
String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount;
93100
String responseContent = this.wxMpService.get(url, null);
94-
return true;
101+
return responseContent != null;
95102
}
96103

97104
@Override
@@ -100,7 +107,7 @@ public boolean kfSessionCreate(String openid, String kfAccount)
100107
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
101108
String url = API_URL_PREFIX + "/kfsession/create";
102109
String responseContent = this.wxMpService.post(url, request.toJson());
103-
return true;
110+
return responseContent != null;
104111
}
105112

106113
@Override
@@ -109,7 +116,7 @@ public boolean kfSessionClose(String openid, String kfAccount)
109116
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
110117
String url = API_URL_PREFIX + "/kfsession/close";
111118
String responseContent = this.wxMpService.post(url, request.toJson());
112-
return true;
119+
return responseContent != null;
113120
}
114121

115122
@Override

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImpl.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import org.apache.commons.codec.digest.DigestUtils;
1212
import org.apache.commons.lang3.StringUtils;
1313
import org.joor.Reflect;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
1614

1715
import com.google.common.collect.Lists;
1816
import com.google.common.collect.Maps;
@@ -42,7 +40,6 @@ public class WxMpPayServiceImpl implements WxMpPayService {
4240

4341
private static final List<String> TRADE_TYPES = Lists.newArrayList("JSAPI",
4442
"NATIVE", "APP");
45-
private final Logger log = LoggerFactory.getLogger(WxMpPayServiceImpl.class);
4643
private WxMpService wxMpService;
4744

4845
public WxMpPayServiceImpl(WxMpService wxMpService) {
@@ -286,7 +283,7 @@ private void checkParameters(WxUnifiedOrderRequest request) {
286283

287284
if (!TRADE_TYPES.contains(request.getTradeType())) {
288285
throw new IllegalArgumentException(
289-
"trade_type目前必须为" + TRADE_TYPES + "其中之一");
286+
"trade_type目前必须为" + TRADE_TYPES + "其中之一");
290287

291288
}
292289

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package me.chanjar.weixin.mp.bean.store;
22

3-
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
43
import org.apache.commons.lang3.builder.ToStringBuilder;
54
import org.apache.commons.lang3.builder.ToStringStyle;
65

0 commit comments

Comments
 (0)