mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-21 11:07:37 +08:00
🎨 统一抽取errcode常量,同步优化规范部分代码
This commit is contained in:
@@ -4,7 +4,6 @@ import cn.binarywang.wx.miniapp.api.WxMaCloudService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.cloud.*;
|
||||
import cn.binarywang.wx.miniapp.bean.cloud.request.WxCloudSendSmsV2Request;
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import cn.binarywang.wx.miniapp.util.JoinerUtils;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -14,6 +13,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
@@ -65,7 +65,7 @@ public class WxMaCloudServiceImpl implements WxMaCloudService {
|
||||
|
||||
String responseContent = wxMaService.post(DATABASE_ADD_URL, params.toString());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent));
|
||||
}
|
||||
JsonArray idArray = jsonObject.getAsJsonArray("id_list");
|
||||
@@ -89,7 +89,7 @@ public class WxMaCloudServiceImpl implements WxMaCloudService {
|
||||
|
||||
String responseContent = wxMaService.post(DATABASE_ADD_URL, params.toString());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent));
|
||||
}
|
||||
JsonArray idArray = jsonObject.getAsJsonArray("id_list");
|
||||
@@ -120,7 +120,7 @@ public class WxMaCloudServiceImpl implements WxMaCloudService {
|
||||
|
||||
String responseContent = wxMaService.post(DATABASE_DELETE_URL, params.toString());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent));
|
||||
}
|
||||
return jsonObject.get("deleted").getAsInt();
|
||||
|
@@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.bean.device.WxMaDeviceTicketRequest;
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -32,7 +33,7 @@ public class WxMaDeviceSubscribeServiceImpl implements WxMaDeviceSubscribeServic
|
||||
public String getSnTicket(WxMaDeviceTicketRequest deviceTicketRequest) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_SN_TICKET_URL, deviceTicketRequest.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
String snTicket = jsonObject.get("sn_ticket").getAsString();
|
||||
@@ -43,7 +44,7 @@ public class WxMaDeviceSubscribeServiceImpl implements WxMaDeviceSubscribeServic
|
||||
public void sendDeviceSubscribeMsg(WxMaDeviceSubscribeMessageRequest deviceSubscribeMessageRequest) throws WxErrorException {
|
||||
String responseContent = this.service.post(SEND_DEVICE_SUBSCRIBE_MSG_URL, deviceSubscribeMessageRequest.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
}
|
||||
|
@@ -36,6 +36,8 @@ import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* 微信小程序即时配送服务.
|
||||
* <pre>
|
||||
@@ -49,11 +51,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaImmediateDeliveryServiceImpl implements WxMaImmediateDeliveryService {
|
||||
|
||||
/**
|
||||
* 微信响应码.
|
||||
*/
|
||||
public static final String ERR_CODE = "errcode";
|
||||
|
||||
/**
|
||||
* 顺丰同城响应码.
|
||||
*/
|
||||
|
@@ -19,6 +19,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Room;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -30,7 +31,6 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Ro
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaLiveServiceImpl implements WxMaLiveService {
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private static final String ROOM_ID = "roomId";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
@@ -10,6 +10,7 @@ import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -34,7 +35,7 @@ public class WxMaMsgServiceImpl implements WxMaMsgService {
|
||||
public void sendSubscribeMsg(WxMaSubscribeMessage subscribeMessage) throws WxErrorException {
|
||||
String responseContent = this.service.post(SUBSCRIBE_MSG_SEND_URL, subscribeMessage.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
}
|
||||
@@ -43,7 +44,7 @@ public class WxMaMsgServiceImpl implements WxMaMsgService {
|
||||
public void sendUniformMsg(WxMaUniformMessage uniformMessage) throws WxErrorException {
|
||||
String responseContent = this.service.post(UNIFORM_MSG_SEND_URL, uniformMessage.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_GET_URL;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_LISTING_URL;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_UPDATE_URL;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaProductService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
@@ -51,6 +52,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
@@ -68,8 +70,6 @@ import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
@@ -143,7 +143,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
|
||||
}
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(respObj.get("errcode").getAsInt());
|
||||
result.setErrcode(respObj.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = respObj.get("data").getAsJsonObject();
|
||||
WxMinishopAddGoodsSpuData resultData = new WxMinishopAddGoodsSpuData();
|
||||
resultData.setProductId(dataObj.get("product_id").getAsLong());
|
||||
@@ -201,7 +201,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
|
||||
}
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(respObj.get("errcode").getAsInt());
|
||||
result.setErrcode(respObj.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = respObj.get("data").getAsJsonObject();
|
||||
WxMinishopAddGoodsSpuData resultData = new WxMinishopAddGoodsSpuData();
|
||||
resultData.setProductId(dataObj.get("product_id").getAsLong());
|
||||
@@ -260,7 +260,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
|
||||
}
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(jsonObject.get("errcode").getAsInt());
|
||||
result.setErrcode(jsonObject.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
|
||||
WxMinishopAddGoodsSkuData resultData = new WxMinishopAddGoodsSkuData();
|
||||
resultData.setSkuId(dataObj.get("sku_id").getAsLong());
|
||||
@@ -280,7 +280,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
}
|
||||
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(jsonObject.get("errcode").getAsInt());
|
||||
result.setErrcode(jsonObject.get(ERR_CODE).getAsInt());
|
||||
JsonArray jsonArray = jsonObject.get("data").getAsJsonArray();
|
||||
List<WxMinishopAddGoodsSkuData> skuData = new ArrayList<>();
|
||||
for (JsonElement jsonElement : jsonArray) {
|
||||
@@ -318,7 +318,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
|
||||
}
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(jsonObject.get("errcode").getAsInt());
|
||||
result.setErrcode(jsonObject.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
|
||||
WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData();
|
||||
resultData.setUpdateTime(dataObj.get("update_time").getAsString());
|
||||
@@ -340,7 +340,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
}
|
||||
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(jsonObject.get("errcode").getAsInt());
|
||||
result.setErrcode(jsonObject.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
|
||||
WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData();
|
||||
resultData.setUpdateTime(dataObj.get("update_time").getAsString());
|
||||
@@ -362,7 +362,7 @@ public class WxMaProductServiceImpl implements WxMaProductService {
|
||||
}
|
||||
|
||||
WxMinishopResult result = new WxMinishopResult();
|
||||
result.setErrcode(jsonObject.get("errcode").getAsInt());
|
||||
result.setErrcode(jsonObject.get(ERR_CODE).getAsInt());
|
||||
JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
|
||||
WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData();
|
||||
resultData.setUpdateTime(dataObj.get("update_time").getAsString());
|
||||
|
@@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.bean.safety.response.WxMaUserSafetyRiskRankRespo
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -27,7 +28,7 @@ public class WxMaSafetyRiskControlServiceImpl implements WxMaSafetyRiskControlSe
|
||||
public WxMaUserSafetyRiskRankResponse getUserRiskRank(WxMaUserSafetyRiskRankRequest wxMaUserSafetyRiskRankRequest) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_USER_RISK_RANK, wxMaUserSafetyRiskRankRequest.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaUserSafetyRiskRankResponse.fromJson(responseContent);
|
||||
|
@@ -5,6 +5,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.scheme.WxMaGenerateSchemeRequest;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -18,14 +19,13 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Scheme.GENER
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class WxMaSchemeServiceImpl implements WxMaSchemeService {
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public String generate(WxMaGenerateSchemeRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GENERATE_SCHEME_URL, request.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return jsonObject.get("openlink").getAsString();
|
||||
|
@@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.SecCheck.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -93,7 +93,7 @@ public class WxMaSecCheckServiceImpl implements WxMaSecCheckService {
|
||||
|
||||
private void parseErrorResponse(String response) throws WxErrorException {
|
||||
JsonObject jsonObject = GsonParser.parse(response);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -24,14 +25,13 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Account
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopAccountServiceImpl implements WxMaShopAccountService {
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public WxMaShopAccountGetCategoryListResponse getCategoryList() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_CATEGORY_LIST, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAccountGetCategoryListResponse.class);
|
||||
@@ -41,7 +41,7 @@ public class WxMaShopAccountServiceImpl implements WxMaShopAccountService {
|
||||
public WxMaShopAccountGetBrandListResponse getBrandList() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_BRAND_LIST, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAccountGetBrandListResponse.class);
|
||||
@@ -51,7 +51,7 @@ public class WxMaShopAccountServiceImpl implements WxMaShopAccountService {
|
||||
public WxMaShopBaseResponse updateInfo(WxMaShopAccountUpdateInfoRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(UPDATE_INFO, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
@@ -61,7 +61,7 @@ public class WxMaShopAccountServiceImpl implements WxMaShopAccountService {
|
||||
public WxMaShopAccountGetInfoResponse getInfo() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_INFO, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAccountGetInfoResponse.class);
|
||||
|
@@ -15,7 +15,7 @@ import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Aftersale.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
@@ -38,7 +38,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopAfterSaleAddResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_ADD, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleAddResponse.class);
|
||||
@@ -55,7 +55,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_GET, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleGetResponse.class);
|
||||
@@ -72,7 +72,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopEcAfterSaleGetResponse get(WxMaShopEcAfterSaleGetRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(ECAFTERSALE_GET, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopEcAfterSaleGetResponse.class);
|
||||
@@ -89,7 +89,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_UPDATE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
@@ -99,7 +99,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopBaseResponse update(WxMaShopEcAfterSaleUpdateRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(EC_AFTERSALE_UPDATE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
@@ -120,7 +120,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
"aftersale_id", afterSaleId, "openid", openId);
|
||||
String resp = this.wxMaService.post(AFTERSALE_CANCEL, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -137,7 +137,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
throws WxErrorException {
|
||||
String resp = this.wxMaService.post(AFTERSALE_UPLOAD_RETURN_INFO, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -157,7 +157,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
"aftersale_id", afterSaleId);
|
||||
String resp = this.wxMaService.post(AFTERSALE_ACCEPT_REFUND, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -174,7 +174,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
throws WxErrorException {
|
||||
String resp = this.wxMaService.post(AFTERSALE_ACCEPT_RETURN, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -194,7 +194,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
"aftersale_id", afterSaleId);
|
||||
String resp = this.wxMaService.post(AFTERSALE_REJECT, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -211,7 +211,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
throws WxErrorException {
|
||||
String resp = this.wxMaService.post(AFTERSALE_UPLOAD_CERTIFICATES, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -233,7 +233,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
"order_id", orderId, "openid", openid, "after_sale_deadline", afterSaleDeadline);
|
||||
String resp = this.wxMaService.post(AFTERSALE_UPLOAD_DEADLINE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class);
|
||||
@@ -249,7 +249,7 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
public WxMaShopAfterSaleListResponse list(WxMaShopAfterSaleListRequest request) throws WxErrorException {
|
||||
String resp = this.wxMaService.post(AFTERSALE_GET_LIST, request);
|
||||
JsonObject jsonObject = GsonParser.parse(resp);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(resp, WxMaShopAfterSaleListResponse.class);
|
||||
|
@@ -18,7 +18,7 @@ import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Audit.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* 小程序交易组件-接入商品前必需接口(审核相关接口)
|
||||
@@ -42,7 +42,7 @@ public class WxMaShopAuditServiceImpl implements WxMaShopAuditService {
|
||||
public WxMaShopAuditBrandResponse auditBrand(WxMaShopAuditBrandRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AUDIT_BRAND, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAuditBrandResponse.class);
|
||||
@@ -59,7 +59,7 @@ public class WxMaShopAuditServiceImpl implements WxMaShopAuditService {
|
||||
public WxMaShopAuditCategoryResponse auditCategory(WxMaShopAuditCategoryRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AUDIT_CATEGORY, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAuditCategoryResponse.class);
|
||||
@@ -76,7 +76,7 @@ public class WxMaShopAuditServiceImpl implements WxMaShopAuditService {
|
||||
public WxMaShopAuditResultResponse getAuditResult(String auditId) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AUDIT_RESULT, GsonHelper.buildJsonObject("audit_id", auditId));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAuditResultResponse.class);
|
||||
@@ -93,7 +93,7 @@ public class WxMaShopAuditServiceImpl implements WxMaShopAuditService {
|
||||
public JsonObject getMiniappCertificate(int reqType) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_MINIAPP_CERTIFICATE, GsonHelper.buildJsonObject("req_type", reqType));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, JsonObject.class);
|
||||
|
@@ -13,7 +13,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Cat.GET_CAT;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author liming1019
|
||||
@@ -27,7 +27,7 @@ public class WxMaShopCatServiceImpl implements WxMaShopCatService {
|
||||
public WxMaShopCatGetResponse getCat() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_CAT, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopCatGetResponse.class);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.api.impl.WxMaImmediateDeliveryServiceImpl.ERR_CODE;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopCouponService;
|
||||
@@ -20,6 +19,8 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author leiin
|
||||
* created on 2022/7/1 2:49 下午
|
||||
@@ -100,7 +101,7 @@ public class WxMaShopCouponServiceImpl implements WxMaShopCouponService {
|
||||
|
||||
@Override
|
||||
public WxMaShopBaseResponse addUserCoupon(String openid, String outUserCouponId,
|
||||
String outCouponId, Integer status, Long recvTime) throws WxErrorException {
|
||||
String outCouponId, Integer status, Long recvTime) throws WxErrorException {
|
||||
JsonObject userCoupon = GsonHelper.buildJsonObject("out_user_coupon_id", outUserCouponId,
|
||||
"out_coupon_id", outCouponId,
|
||||
"status", status);
|
||||
@@ -129,7 +130,7 @@ public class WxMaShopCouponServiceImpl implements WxMaShopCouponService {
|
||||
|
||||
@Override
|
||||
public WxMaShopBaseResponse updateUserCoupon(String openid, String outUserCouponId,
|
||||
String outCouponId, Long useTime, Long recvTime) throws WxErrorException {
|
||||
String outCouponId, Long useTime, Long recvTime) throws WxErrorException {
|
||||
JsonObject extInfo = GsonHelper.buildJsonObject("use_time", useTime);
|
||||
|
||||
JsonObject userCoupon = GsonHelper.buildJsonObject("out_user_coupon_id", outUserCouponId,
|
||||
@@ -148,7 +149,7 @@ public class WxMaShopCouponServiceImpl implements WxMaShopCouponService {
|
||||
|
||||
@Override
|
||||
public WxMaShopBaseResponse updateUserCouponStatus(String openid, String outUserCouponId,
|
||||
String outCouponId, Integer status) throws WxErrorException {
|
||||
String outCouponId, Integer status) throws WxErrorException {
|
||||
|
||||
JsonObject json = GsonHelper.buildJsonObject("openid", openid,
|
||||
"out_user_coupon_id", outUserCouponId,
|
||||
|
@@ -16,7 +16,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Delivery.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
@@ -37,7 +37,7 @@ public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
|
||||
public WxMaShopDeliveryGetCompanyListResponse getCompanyList() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_COMPANY_LIST, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopDeliveryGetCompanyListResponse.class);
|
||||
@@ -54,7 +54,7 @@ public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
|
||||
public WxMaShopBaseResponse send(WxMaShopDeliverySendRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_SEND, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
@@ -71,7 +71,7 @@ public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
|
||||
public WxMaShopBaseResponse receive(WxMaShopDeliveryRecieveRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_RECEIVE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
|
@@ -20,6 +20,7 @@ import java.text.Format;
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.*;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
@@ -30,7 +31,6 @@ public class WxMaShopOrderServiceImpl implements WxMaShopOrderService {
|
||||
|
||||
private final Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private static final String MATCH_KEY = "is_matched";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Sharer;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopSharerService;
|
||||
@@ -28,7 +29,6 @@ import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopSharerServiceImpl implements WxMaShopSharerService {
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
|
@@ -20,6 +20,7 @@ import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.*;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
@@ -27,8 +28,6 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.*;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopSpuServiceImpl implements WxMaShopSpuService {
|
||||
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
|
@@ -3,6 +3,7 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaSubscribeService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.subscribemsg.CategoryData;
|
||||
import me.chanjar.weixin.common.bean.subscribemsg.PubTemplateKeyword;
|
||||
import me.chanjar.weixin.common.bean.subscribemsg.TemplateInfo;
|
||||
@@ -85,7 +86,7 @@ public class WxMaSubscribeServiceImpl implements WxMaSubscribeService {
|
||||
public void sendSubscribeMsg(WxMaSubscribeMessage subscribeMessage) throws WxErrorException {
|
||||
String responseContent = this.service.post(SUBSCRIBE_MSG_SEND_URL, subscribeMessage.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
if (jsonObject.get(WxConsts.ERR_CODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.constant;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 小程序常量.
|
||||
@@ -7,24 +9,19 @@ package cn.binarywang.wx.miniapp.constant;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public abstract class WxMaConstants {
|
||||
private WxMaConstants() {
|
||||
}
|
||||
@UtilityClass
|
||||
public class WxMaConstants {
|
||||
|
||||
/**
|
||||
* 默认的env_version值
|
||||
*/
|
||||
public static final String DEFAULT_ENV_VERSION = "release";
|
||||
|
||||
/**
|
||||
* 微信接口返回的参数errcode.
|
||||
*/
|
||||
public static final String ERRCODE = "errcode";
|
||||
|
||||
/**
|
||||
* 素材类型.
|
||||
*/
|
||||
public abstract static class MediaType {
|
||||
@UtilityClass
|
||||
public static class MediaType {
|
||||
/**
|
||||
* 图片.
|
||||
*/
|
||||
@@ -34,7 +31,8 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 消息格式.
|
||||
*/
|
||||
public abstract static class MsgDataFormat {
|
||||
@UtilityClass
|
||||
public static class MsgDataFormat {
|
||||
public static final String XML = "XML";
|
||||
public static final String JSON = "JSON";
|
||||
}
|
||||
@@ -42,6 +40,7 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 客服消息的消息类型.
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class KefuMsgType {
|
||||
/**
|
||||
* 文本消息.
|
||||
@@ -64,8 +63,8 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 内容安全检测的媒体类型
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class SecCheckMediaType {
|
||||
|
||||
/**
|
||||
* 音频
|
||||
*/
|
||||
@@ -80,6 +79,7 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 快递账号绑定类型
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class BindAccountType {
|
||||
|
||||
/**
|
||||
@@ -96,6 +96,7 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 快递下单订单来源
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class OrderAddSource {
|
||||
|
||||
/**
|
||||
@@ -112,11 +113,8 @@ public abstract class WxMaConstants {
|
||||
/**
|
||||
* 快递下单保价
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class OrderAddInsured {
|
||||
private OrderAddInsured() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 不保价
|
||||
*/
|
||||
@@ -138,10 +136,8 @@ public abstract class WxMaConstants {
|
||||
* <p>
|
||||
* developer为开发版;trial为体验版;formal为正式版;默认为正式版
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class MiniProgramState {
|
||||
private MiniProgramState() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 开发版
|
||||
*/
|
||||
@@ -163,10 +159,8 @@ public abstract class WxMaConstants {
|
||||
* 进入小程序查看的语言类型
|
||||
* 支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN
|
||||
*/
|
||||
@UtilityClass
|
||||
public static final class MiniProgramLang {
|
||||
private MiniProgramLang() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 简体中文
|
||||
*/
|
||||
|
Reference in New Issue
Block a user