mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
优化代码,替换掉ToStringBuilder.reflectionToString相关代码
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaTemplateService;
|
||||
import cn.binarywang.wx.miniapp.bean.template.WxMaTemplateAddResult;
|
||||
@@ -10,15 +14,11 @@ import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
private WxMaService wxMaService;
|
||||
|
||||
public WxMaTemplateServiceImpl(WxMaService wxMaService){
|
||||
public WxMaTemplateServiceImpl(WxMaService wxMaService) {
|
||||
this.wxMaService = wxMaService;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_LIST_URL, WxGsonBuilder.create().toJson(params));
|
||||
WxError wxError = WxError.fromJson(responseText);
|
||||
if(wxError.getErrorCode() == 0){
|
||||
if (wxError.getErrorCode() == 0) {
|
||||
return WxMaTemplateLibraryListResult.fromJson(responseText);
|
||||
}else {
|
||||
} else {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
}
|
||||
@@ -46,9 +46,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params));
|
||||
WxError wxError = WxError.fromJson(responseText);
|
||||
if(wxError.getErrorCode() == 0){
|
||||
if (wxError.getErrorCode() == 0) {
|
||||
return WxMaTemplateLibraryGetResult.fromJson(responseText);
|
||||
}else {
|
||||
} else {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
}
|
||||
@@ -62,9 +62,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
String responseText = this.wxMaService.post(TEMPLATE_ADD_URL, WxGsonBuilder.create().toJson(params));
|
||||
WxError wxError = WxError.fromJson(responseText);
|
||||
if(wxError.getErrorCode() == 0){
|
||||
if (wxError.getErrorCode() == 0) {
|
||||
return WxMaTemplateAddResult.fromJson(responseText);
|
||||
}else {
|
||||
} else {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
}
|
||||
@@ -78,9 +78,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
String responseText = this.wxMaService.post(TEMPLATE_LIST_URL, WxGsonBuilder.create().toJson(params));
|
||||
WxError wxError = WxError.fromJson(responseText);
|
||||
if(wxError.getErrorCode() == 0){
|
||||
if (wxError.getErrorCode() == 0) {
|
||||
return WxMaTemplateListResult.fromJson(responseText);
|
||||
}else {
|
||||
} else {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
}
|
||||
@@ -92,9 +92,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService {
|
||||
|
||||
String responseText = this.wxMaService.post(TEMPLATE_DEL_URL, WxGsonBuilder.create().toJson(params));
|
||||
WxError wxError = WxError.fromJson(responseText);
|
||||
if(wxError.getErrorCode() == 0){
|
||||
if (wxError.getErrorCode() == 0) {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
throw new WxErrorException(wxError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user