feat: 页面配置默认模板回退+删除功能
This commit is contained in:
@@ -16,12 +16,26 @@ import java.util.Map;
|
||||
public class SitePagesController {
|
||||
|
||||
private final SitePagesService sitePagesService;
|
||||
private final com.par.core.mapper.SiteMapper siteMapper;
|
||||
|
||||
@GetMapping("/api/v1/sites/{siteId}/pages")
|
||||
public ApiResponse<Map<String, Object>> getPages(@PathVariable String siteId) {
|
||||
Map<String, Object> data = sitePagesService.getPages(siteId);
|
||||
if (data == null) return ApiResponse.error(404, "页面配置不存在");
|
||||
return ApiResponse.success(data);
|
||||
if (data != null) {
|
||||
data.put("source", "custom");
|
||||
return ApiResponse.success(data);
|
||||
}
|
||||
// 回退到站点类型默认模板
|
||||
var site = siteMapper.selectBySiteId(siteId);
|
||||
String siteType = site != null && site.getSiteType() != null ? site.getSiteType().getValue() : null;
|
||||
if (siteType != null) {
|
||||
Map<String, Object> def = sitePagesService.getPages("default:" + siteType);
|
||||
if (def != null) {
|
||||
def.put("source", "default");
|
||||
return ApiResponse.success(def);
|
||||
}
|
||||
}
|
||||
return ApiResponse.error(404, "页面配置不存在");
|
||||
}
|
||||
|
||||
@GetMapping("/api/v1/sites/{siteId}/pages/version")
|
||||
|
||||
Reference in New Issue
Block a user