fix(system): 调整小程序配置读取顺序
- 修改 getMpWxSetting 方法,优先读取 sys_setting(mp-weixin) - 读取失败时回退到 db_websopy.app_config(category=wechat) - 更新异常日志内容,明确读取失败顺序 - 适配业务需求调整配置优先级 - 影响所有调用 getMpWxSetting 的相关方法调用流程
This commit is contained in:
@@ -437,7 +437,7 @@ public class WxLoginController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先读取 db_websopy.app_config(category=wechat),不存在或异常时回退到 sys_setting (mp-weixin)
|
||||
* 优先读取 sys_setting (mp-weixin),不存在或异常时回退到 db_websopy.app_config(category=wechat)
|
||||
*
|
||||
* @param tenantId 租户ID(传 null 时使用当前请求租户)
|
||||
* @return JSONObject 配置内容(含 appId / appSecret 等字段)
|
||||
@@ -445,15 +445,16 @@ public class WxLoginController extends BaseController {
|
||||
private JSONObject getMpWxSetting(Integer tenantId) {
|
||||
Integer tid = tenantId != null ? tenantId : getTenantId();
|
||||
try {
|
||||
JSONObject wechat = appConfigService.getByCategory("wechat", tid);
|
||||
if (wechat != null && !wechat.isEmpty()) {
|
||||
return wechat;
|
||||
// 优先:sys_setting.mp-weixin
|
||||
JSONObject setting = settingService.getBySettingKey("mp-weixin");
|
||||
if (setting != null && !setting.isEmpty()) {
|
||||
return setting;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("[WxLoginController] 读取 app_config 失败,回退 sys_setting: " + e.getMessage());
|
||||
System.err.println("[WxLoginController] 读取 sys_setting 失败,回退 app_config: " + e.getMessage());
|
||||
}
|
||||
// 兜底:原 sys_setting.mp-weixin
|
||||
return settingService.getBySettingKey("mp-weixin");
|
||||
// 兜底:db_websopy.app_config(category=wechat)
|
||||
return appConfigService.getByCategory("wechat", tid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user