本文整理了Java中me.chanjar.weixin.common.error.WxError.getErrorCode()
方法的一些代码示例,展示了WxError.getErrorCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WxError.getErrorCode()
方法的具体详情如下:
包路径:me.chanjar.weixin.common.error.WxError
类名称:WxError
方法名:getErrorCode
暂无
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public WxMpStoreBaseInfo get(String poiId) throws WxErrorException {
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id", poiId);
String response = this.wxMpService.post(POI_GET_URL, paramObject.toString());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
return WxMpStoreBaseInfo.fromJson(new JsonParser().parse(response).getAsJsonObject()
.get("business").getAsJsonObject().get("base_info").toString());
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public void delete(String poiId) throws WxErrorException {
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id", poiId);
String response = this.wxMpService.post(POI_DEL_URL, paramObject.toString());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public boolean delPrivateTemplate(String templateId) throws WxErrorException {
String url = API_URL_PREFIX + "/del_private_template";
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("template_id", templateId);
String responseContent = this.wxMpService.post(url, jsonObject.toString());
WxError error = WxError.fromJson(responseContent, WxType.MP);
if (error.getErrorCode() == 0) {
return true;
}
throw new WxErrorException(error);
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public boolean delPrivateTemplate(String templateId) throws WxErrorException {
String url = API_URL_PREFIX + "/del_private_template";
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("template_id", templateId);
String responseContent = this.wxMpService.post(url, jsonObject.toString());
WxError error = WxError.fromJson(responseContent, WxType.MP);
if (error.getErrorCode() == 0) {
return true;
}
throw new WxErrorException(error);
}
代码示例来源:origin: binarywang/WxJava
@Override
public void delete(String poiId) throws WxErrorException {
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id", poiId);
String response = this.wxMpService.post(POI_DEL_URL, paramObject.toString());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public WxMpStoreListResult list(int begin, int limit)
throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("begin", begin);
params.addProperty("limit", limit);
String response = this.wxMpService.post(POI_LIST_URL, params.toString());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
return WxMpStoreListResult.fromJson(response);
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public List<String> listCategories() throws WxErrorException {
String response = this.wxMpService.get(POI_GET_WX_CATEGORY_URL, null);
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(response).getAsJsonObject().get("category_list"),
new TypeToken<List<String>>() {
}.getType());
}
代码示例来源:origin: binarywang/WxJava
@Override
public List<String> listCategories() throws WxErrorException {
String response = this.wxMpService.get(POI_GET_WX_CATEGORY_URL, null);
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(response).getAsJsonObject().get("category_list"),
new TypeToken<List<String>>() {
}.getType());
}
代码示例来源:origin: com.github.binarywang/weixin-java-miniapp
@Override
public WxMaTemplateListResult findTemplateList(int offset, int count) throws WxErrorException {
Map<String, Integer> params = new HashMap<>();
params.put("offset", offset);
params.put("count", count);
String responseText = this.wxMaService.post(TEMPLATE_LIST_URL, WxGsonBuilder.create().toJson(params));
WxError wxError = WxError.fromJson(responseText);
if (wxError.getErrorCode() == 0) {
return WxMaTemplateListResult.fromJson(responseText);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-miniapp
@Override
public WxMaTemplateLibraryListResult findTemplateLibraryList(int offset, int count) throws WxErrorException {
Map<String, Integer> params = new HashMap<>();
params.put("offset", offset);
params.put("count", count);
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_LIST_URL, WxGsonBuilder.create().toJson(params));
WxError wxError = WxError.fromJson(responseText);
if (wxError.getErrorCode() == 0) {
return WxMaTemplateLibraryListResult.fromJson(responseText);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-miniapp
@Override
public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException {
Map<String, String> params = new HashMap<>();
params.put("id", id);
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params));
WxError wxError = WxError.fromJson(responseText);
if (wxError.getErrorCode() == 0) {
return WxMaTemplateLibraryGetResult.fromJson(responseText);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException {
Map<String, String> params = new HashMap<>();
params.put("id", id);
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params));
WxError wxError = WxError.fromJson(responseText);
if (wxError.getErrorCode() == 0) {
return WxMaTemplateLibraryGetResult.fromJson(responseText);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public WxMpMaterialCountResult materialCount() throws WxErrorException {
String responseText = this.wxMpService.get(MATERIAL_GET_COUNT_URL, null);
WxError wxError = WxError.fromJson(responseText, WxType.MP);
if (wxError.getErrorCode() == 0) {
return WxMpGsonBuilder.create().fromJson(responseText, WxMpMaterialCountResult.class);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public WxMpMaterialCountResult materialCount() throws WxErrorException {
String responseText = this.wxMpService.get(MATERIAL_GET_COUNT_URL, null);
WxError wxError = WxError.fromJson(responseText, WxType.MP);
if (wxError.getErrorCode() == 0) {
return WxMpGsonBuilder.create().fromJson(responseText, WxMpMaterialCountResult.class);
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException {
String responseText = this.wxMpService.post(NEWS_UPDATE_URL, wxMpMaterialArticleUpdate.toJson());
WxError wxError = WxError.fromJson(responseText, WxType.MP);
if (wxError.getErrorCode() == 0) {
return true;
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public void update(WxMpStoreBaseInfo request) throws WxErrorException {
String response = this.wxMpService.post(POI_UPDATE_URL, request.toJson());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public void update(WxMpStoreBaseInfo request) throws WxErrorException {
String response = this.wxMpService.post(POI_UPDATE_URL, request.toJson());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException {
String responseText = this.wxMpService.post(NEWS_UPDATE_URL, wxMpMaterialArticleUpdate.toJson());
WxError wxError = WxError.fromJson(responseText, WxType.MP);
if (wxError.getErrorCode() == 0) {
return true;
} else {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public void add(WxMpStoreBaseInfo request) throws WxErrorException {
BeanUtils.checkRequiredFields(request);
String response = this.wxMpService.post(POI_ADD_URL, request.toJson());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public void add(WxMpStoreBaseInfo request) throws WxErrorException {
BeanUtils.checkRequiredFields(request);
String response = this.wxMpService.post(POI_ADD_URL, request.toJson());
WxError wxError = WxError.fromJson(response, WxType.MP);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
}
内容来源于网络,如有侵权,请联系作者删除!