Przeglądaj źródła

clean code

master
Binary Wang 8 lat temu
rodzic
commit
2ae95e48ef
4 zmienionych plików z 22 dodań i 20 usunięć
  1. +0
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpPayService.java
  2. +21
    -14
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java
  3. +1
    -4
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImpl.java
  4. +0
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java

+ 0
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpPayService.java Wyświetl plik

@@ -6,7 +6,6 @@ import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback;
import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult;
import me.chanjar.weixin.mp.bean.pay.WxMpPayResult;
import me.chanjar.weixin.mp.bean.pay.WxMpPrepayIdResult;
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult;
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest;
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest;


+ 21
- 14
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java Wyświetl plik

@@ -1,6 +1,13 @@
package me.chanjar.weixin.mp.api.impl;

import java.io.File;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonObject;

import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
@@ -10,12 +17,12 @@ import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
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.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Date;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
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;

/**
*
@@ -38,7 +45,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
String responseContent = this.wxMpService.post(url, message.toJson());
return true;
return responseContent != null;
}

@Override
@@ -60,7 +67,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/add";
String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
}

@Override
@@ -68,14 +75,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/update";
String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
}

@Override
public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/inviteworker";
String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
}

@Override
@@ -84,14 +91,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount;
WxMediaUploadResult responseContent = this.wxMpService
.execute(new MediaUploadRequestExecutor(), url, imgFile);
return true;
return responseContent != null;
}

@Override
public boolean kfAccountDel(String kfAccount) throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount;
String responseContent = this.wxMpService.get(url, null);
return true;
return responseContent != null;
}

@Override
@@ -100,7 +107,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
String url = API_URL_PREFIX + "/kfsession/create";
String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
}

@Override
@@ -109,7 +116,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
String url = API_URL_PREFIX + "/kfsession/close";
String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
}

@Override


+ 1
- 4
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImpl.java Wyświetl plik

@@ -11,8 +11,6 @@ import java.util.TreeMap;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.joor.Reflect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

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

public WxMpPayServiceImpl(WxMpService wxMpService) {
@@ -286,7 +283,7 @@ public class WxMpPayServiceImpl implements WxMpPayService {

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

}



+ 0
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java Wyświetl plik

@@ -1,6 +1,5 @@
package me.chanjar.weixin.mp.bean.store;

import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;



Ładowanie…
Anuluj
Zapisz