mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-10 14:56:06 +08:00
fix(i18n): 微信能力异常消息消除夹中文伪key, 规范异常类无参构造
- WechatUserService/WechatMaMessageService 5处夹中文伪key改用合法i18n key - ConfigErrorException/OperationFailException/NonceMissingException 无参构造super(中文)改super(key) - wechat.json 补充 userInfoNotFound/userNotSubscribed/phoneNotFound 中英文条目
This commit is contained in:
@@ -34,7 +34,7 @@ public class WechatUserService {
|
||||
public WechatUserInfoResult getUserInfo(String openId, String appId, String appSecret) {
|
||||
// 验证参数
|
||||
if (StrUtil.isBlank(openId) || StrUtil.isBlank(appId) || StrUtil.isBlank(appSecret)) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.payment.channel.参数不能为空");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.channel.wechat.paramsRequired");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -45,7 +45,7 @@ public class WechatUserService {
|
||||
WxMpUser wxMpUser = wxMpService.getUserService().userInfo(openId);
|
||||
|
||||
if (wxMpUser == null) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.payment.channel.获取用户信息失败");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.channel.wechat.userInfoNotFound");
|
||||
}
|
||||
|
||||
// 转换结果
|
||||
@@ -68,7 +68,7 @@ public class WechatUserService {
|
||||
|
||||
// 判断是否是用户未关注
|
||||
if (e.getError().getErrorCode() == 49003) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.payment.channel.用户未关注公众号");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.channel.wechat.userNotSubscribed");
|
||||
}
|
||||
|
||||
// 微信: 获取用户信息失败: {0}
|
||||
@@ -100,7 +100,7 @@ public class WechatUserService {
|
||||
WxMaPhoneNumberInfo phoneInfo = wxMaService.getUserService().getPhoneNoInfo(code);
|
||||
|
||||
if (phoneInfo == null) {
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.payment.channel.获取手机号失败");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.channel.wechat.phoneNotFound");
|
||||
}
|
||||
|
||||
// 转换结果
|
||||
|
||||
@@ -151,7 +151,7 @@ public class WechatMaMessageService {
|
||||
private void validateConfig(String wxAppId, String appSecret) {
|
||||
if (StrUtil.isBlank(wxAppId) || StrUtil.isBlank(appSecret)) {
|
||||
log.error("微信配置参数为空,wxAppId: {}", wxAppId);
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.payment.channel.微信配置参数不能为空");
|
||||
throw new OperationFailException(CommonCode.FAIL_CODE, "error.channel.wechat.configParamsRequired");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
"paramsRequired": "Parameters are required",
|
||||
"phoneFetchFailed": "Failed to fetch phone number: {0}",
|
||||
"phoneFetchError": "Phone number fetch error: {0}",
|
||||
"userInfoNotFound": "WeChat user info not found",
|
||||
"userNotSubscribed": "User has not subscribed to the official account",
|
||||
"phoneNotFound": "WeChat phone number not found",
|
||||
"mpAuthFailed": "WeChat official account authentication failed: {0}",
|
||||
"mpAuthConfigError": "WeChat official account auth configuration error: {0}",
|
||||
"maAuthFailed": "WeChat mini program authentication failed: {0}",
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
"paramsRequired": "参数不能为空",
|
||||
"phoneFetchFailed": "获取手机号失败: {0}",
|
||||
"phoneFetchError": "获取手机号异常: {0}",
|
||||
"userInfoNotFound": "未获取到微信用户信息",
|
||||
"userNotSubscribed": "用户未关注公众号",
|
||||
"phoneNotFound": "未获取到微信手机号",
|
||||
"mpAuthFailed": "微信公众号认证失败: {0}",
|
||||
"mpAuthConfigError": "微信公众号认证配置错误: {0}",
|
||||
"maAuthFailed": "微信小程序认证失败: {0}",
|
||||
|
||||
@@ -7,7 +7,7 @@ import static cn.daxpay.open.platform.core.code.CommonErrorCode.NONCE_MISSING;
|
||||
public class NonceMissingException extends BizInfoException {
|
||||
|
||||
public NonceMissingException() {
|
||||
super(NONCE_MISSING, "Nonce缺失");
|
||||
super(NONCE_MISSING, "error.common.nonceMissing");
|
||||
initMessageKey("error.common.nonceMissing");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ConfigErrorException extends PayFailureException {
|
||||
|
||||
public ConfigErrorException() {
|
||||
// 配置错误
|
||||
super(DaxPayErrorCode.CONFIG_ERROR,"配置错误");
|
||||
super(DaxPayErrorCode.CONFIG_ERROR,"pay.error.configError");
|
||||
initMessageKey("pay.error.configError");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class OperationFailException extends PayFailureException {
|
||||
}
|
||||
|
||||
public OperationFailException() {
|
||||
super(DaxPayErrorCode.OPERATION_FAIL,"操作失败");
|
||||
super(DaxPayErrorCode.OPERATION_FAIL,"pay.error.operateFailed");
|
||||
initMessageKey("pay.error.operateFailed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user