将微信支付的调用appid进行优化。

This commit is contained in:
pikachu1995@126.com 2024-06-28 09:08:32 +08:00
parent 4fc1d0e346
commit 1b316baac6
2 changed files with 17 additions and 9 deletions

View File

@ -140,7 +140,7 @@ public class WechatPlugin implements Payment {
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getServiceAppId(); String appid = setting.getH5AppId();
if (appid == null) { if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
} }
@ -199,7 +199,7 @@ public class WechatPlugin implements Payment {
String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8); String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8);
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getServiceAppId(); String appid = setting.getJsapiAppId();
if (appid == null) { if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
} }
@ -264,7 +264,7 @@ public class WechatPlugin implements Payment {
String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8); String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8);
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getAppId(); String appid = setting.getJsapiAppId();
if (appid == null) { if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
} }
@ -332,7 +332,7 @@ public class WechatPlugin implements Payment {
WechatPaymentSetting setting = wechatPaymentSetting(); WechatPaymentSetting setting = wechatPaymentSetting();
String appid = setting.getServiceAppId(); String appid = setting.getNativeAppId();
if (appid == null) { if (appid == null) {
throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING); throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
} }

View File

@ -14,17 +14,25 @@ import lombok.experimental.Accessors;
public class WechatPaymentSetting { public class WechatPaymentSetting {
/** /**
* APP应用id * JSAPI支付应用ID
*/ */
private String appId; private String jsapiAppId;
/** /**
* 小程序应用id * native支付应用ID
*/
private String nativeAppId;
/**
* 小程序支付应用id
*/ */
private String mpAppId; private String mpAppId;
/** /**
* 服务号应用id * H5支付应用ID
*/ */
private String serviceAppId; private String h5AppId;
/**
* APP支付应用ID
*/
private String appAppId;
/** /**
* 商户号 * 商户号
*/ */