mirror of https://github.com/halo-dev/halo
feat: support import user. (#1283)
parent
a848b734b7
commit
867d1703ae
|
@ -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);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -11,17 +11,7 @@ public enum MigrateType implements ValueEnum<Integer> {
|
|||
/**
|
||||
* Halo
|
||||
*/
|
||||
HALO(0),
|
||||
|
||||
/**
|
||||
* WordPress
|
||||
*/
|
||||
WORDPRESS(1),
|
||||
|
||||
/**
|
||||
* cnblogs.com
|
||||
*/
|
||||
CNBLOGS(2);
|
||||
HALO(0);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
|
|
|
@ -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<User> users = Arrays.asList(mapper
|
||||
.readValue(mapper.writeValueAsString(data.get("user")),
|
||||
User[].class));
|
||||
|
||||
if (users.size() > 0) {
|
||||
userService.create(users.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue