Search in sources :

Example 1 with BackResponse

use of com.tale.dto.BackResponse in project tale by otale.

the class IndexController method backup.

/**
     * 系统备份
     * @return
     */
@Route(value = "backup", method = HttpMethod.POST)
@JSON
public RestResponse backup(@QueryParam String bk_type, @QueryParam String bk_path, Request request) {
    if (StringKit.isBlank(bk_type)) {
        return RestResponse.fail("请确认信息输入完整");
    }
    try {
        BackResponse backResponse = siteService.backup(bk_type, bk_path, "yyyyMMddHHmm");
        logService.save(LogActions.SYS_BACKUP, null, request.address(), this.getUid());
        return RestResponse.ok(backResponse);
    } catch (Exception e) {
        String msg = "备份失败";
        if (e instanceof TipException) {
            msg = e.getMessage();
        } else {
            LOGGER.error(msg, e);
        }
        return RestResponse.fail(msg);
    }
}
Also used : BackResponse(com.tale.dto.BackResponse) TipException(com.tale.exception.TipException) TipException(com.tale.exception.TipException) JSON(com.blade.mvc.annotation.JSON) Route(com.blade.mvc.annotation.Route)

Aggregations

JSON (com.blade.mvc.annotation.JSON)1 Route (com.blade.mvc.annotation.Route)1 BackResponse (com.tale.dto.BackResponse)1 TipException (com.tale.exception.TipException)1