diff --git a/src/main/java/run/halo/app/controller/admin/api/MigrateController.java b/src/main/java/run/halo/app/controller/admin/api/MigrateController.java index 14761af9e..a6aa4063b 100644 --- a/src/main/java/run/halo/app/controller/admin/api/MigrateController.java +++ b/src/main/java/run/halo/app/controller/admin/api/MigrateController.java @@ -41,16 +41,4 @@ public class MigrateController { } migrateService.migrate(file, MigrateType.HALO); } - - // @PostMapping("wordpress") - // @ApiOperation("Migrate from WordPress") - // public void migrateWordPress(@RequestPart("file") MultipartFile file) { - // migrateService.migrate(file, MigrateType.WORDPRESS); - // } - // - // @PostMapping("cnblogs") - // @ApiOperation("Migrate from cnblogs") - // public void migrateCnBlogs(@RequestPart("file") MultipartFile file) { - // migrateService.migrate(file, MigrateType.CNBLOGS); - // } } diff --git a/src/main/java/run/halo/app/model/enums/MigrateType.java b/src/main/java/run/halo/app/model/enums/MigrateType.java index 08ce4c55b..c70fadc5a 100644 --- a/src/main/java/run/halo/app/model/enums/MigrateType.java +++ b/src/main/java/run/halo/app/model/enums/MigrateType.java @@ -11,17 +11,7 @@ public enum MigrateType implements ValueEnum { /** * Halo */ - HALO(0), - - /** - * WordPress - */ - WORDPRESS(1), - - /** - * cnblogs.com - */ - CNBLOGS(2); + HALO(0); private final Integer value; diff --git a/src/main/java/run/halo/app/service/impl/BackupServiceImpl.java b/src/main/java/run/halo/app/service/impl/BackupServiceImpl.java index 47e0ed272..30411d13d 100644 --- a/src/main/java/run/halo/app/service/impl/BackupServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/BackupServiceImpl.java @@ -68,6 +68,7 @@ import run.halo.app.model.entity.SheetComment; import run.halo.app.model.entity.SheetMeta; import run.halo.app.model.entity.Tag; import run.halo.app.model.entity.ThemeSetting; +import run.halo.app.model.entity.User; import run.halo.app.model.params.PostMarkdownParam; import run.halo.app.model.support.HaloConst; import run.halo.app.model.vo.PostMarkdownVO; @@ -515,6 +516,14 @@ public class BackupServiceImpl implements BackupService { themeSettingService.createInBatch(themeSettings); eventPublisher.publishEvent(new ThemeUpdatedEvent(this)); + + List users = Arrays.asList(mapper + .readValue(mapper.writeValueAsString(data.get("user")), + User[].class)); + + if (users.size() > 0) { + userService.create(users.get(0)); + } } @Override