feat(cms): 同步域名到租户表保证一致性

- 在保存网站信息后同步 cms_website.domain 到 company.app_domain 字段
- 去除域名前缀的 http(s):// 以保持与前端处理一致
- 添加异常捕获,防止同步失败影响主流程
- 通过 tenantId 关联查询对应租户公司信息并更新域名字段
- 记录同步失败的警告日志,便于问题排查
This commit is contained in:
2026-08-06 23:05:09 +08:00
parent 9a905268e6
commit 8f3e337b9c

View File

@@ -210,9 +210,8 @@ public class CmsWebsiteServiceImpl extends ServiceImpl<CmsWebsiteMapper, CmsWebs
try { try {
Company company = companyService.getByTenantIdRel(loginUser.getTenantId()); Company company = companyService.getByTenantIdRel(loginUser.getTenantId());
if (company != null) { if (company != null) {
// 去掉 http(s):// 前缀,与前端处理保持一致 // 默认域名由前端带上 https:// 前缀,自定义域名已去除前缀,此处原样保存
String cleanDomain = website.getDomain().replaceFirst("^(https?://)", ""); company.setDomain(website.getDomain());
company.setDomain(cleanDomain);
companyService.updateById(company); companyService.updateById(company);
} }
} catch (Exception e) { } catch (Exception e) {