Compare commits
2 Commits
b20304da29
...
9a905268e6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a905268e6 | |||
| ed963b7a40 |
@@ -92,7 +92,8 @@ public class CmsWebsiteController extends BaseController {
|
|||||||
return success(cmsWebsiteService.getByIdRelAll(id));
|
return success(cmsWebsiteService.getByIdRelAll(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:save')")
|
// 注册流程:新租户超管尚未被 grantCmsPermission 赋予 cms:website:save,允许超管直接创建首个站点
|
||||||
|
@PreAuthorize("hasAuthority('cms:website:save') or principal.getIsSuperAdmin() == true")
|
||||||
@Operation(summary = "添加网站信息记录表")
|
@Operation(summary = "添加网站信息记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> save(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
@@ -127,7 +128,8 @@ public class CmsWebsiteController extends BaseController {
|
|||||||
return fail("创建失败");
|
return fail("创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:update')")
|
// 注册流程:新租户超管尚未被 grantCmsPermission 赋予 cms:website:update,允许超管直接更新站点
|
||||||
|
@PreAuthorize("hasAuthority('cms:website:update') or principal.getIsSuperAdmin() == true")
|
||||||
@Operation(summary = "修改网站信息记录表")
|
@Operation(summary = "修改网站信息记录表")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> update(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
@@ -154,7 +156,8 @@ public class CmsWebsiteController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:update')")
|
// 注册流程:新租户超管尚未被 grantCmsPermission 赋予 cms:website:update,允许超管直接更新站点
|
||||||
|
@PreAuthorize("hasAuthority('cms:website:update') or principal.getIsSuperAdmin() == true")
|
||||||
@Operation(summary = "修改网站信息记录表")
|
@Operation(summary = "修改网站信息记录表")
|
||||||
@PutMapping("/updateAll")
|
@PutMapping("/updateAll")
|
||||||
public ApiResult<?> updateAll(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> updateAll(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.core.utils.JSONUtil;
|
|||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.Company;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.common.system.service.CompanyService;
|
import com.gxwebsoft.common.system.service.CompanyService;
|
||||||
import com.gxwebsoft.common.system.service.UserService;
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
@@ -204,6 +205,21 @@ public class CmsWebsiteServiceImpl extends ServiceImpl<CmsWebsiteMapper, CmsWebs
|
|||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
if(save(website)){
|
if(save(website)){
|
||||||
|
// 同步域名到 company.app_domain(websopy 租户表),保证 cms_website.domain 与 app_domain 一致
|
||||||
|
if (StrUtil.isNotBlank(website.getDomain())) {
|
||||||
|
try {
|
||||||
|
Company company = companyService.getByTenantIdRel(loginUser.getTenantId());
|
||||||
|
if (company != null) {
|
||||||
|
// 去掉 http(s):// 前缀,与前端处理保持一致
|
||||||
|
String cleanDomain = website.getDomain().replaceFirst("^(https?://)", "");
|
||||||
|
company.setDomain(cleanDomain);
|
||||||
|
companyService.updateById(company);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("同步域名到 company 失败, tenantId={}", loginUser.getTenantId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 插入网站设置记录
|
// 插入网站设置记录
|
||||||
// final CmsWebsiteSetting setting = new CmsWebsiteSetting();
|
// final CmsWebsiteSetting setting = new CmsWebsiteSetting();
|
||||||
// setting.setWebsiteId(website.getWebsiteId());
|
// setting.setWebsiteId(website.getWebsiteId());
|
||||||
|
|||||||
Reference in New Issue
Block a user