func CmdBackup(context *GoInk.Context) { if context.Method == "POST" { file, e := cmd.DoBackup(context.App(), true) if e != nil { Json(context, false).Set("msg", e.Error()).End() return } Json(context, true).Set("file", file).End() context.Do("bakcup_success", file) model.CreateMessage("backup", "[1]"+file) return } if context.Method == "DELETE" { file := context.String("file") if file == "" { Json(context, false).End() return } cmd.RemoveBackupFile(file) Json(context, true).End() context.Do("backup_delete", file) return } files, _ := cmd.GetBackupFiles() context.Layout("admin/cmd") context.Render("admin/cmd/backup", map[string]interface{}{ "Files": files, "Title": "备份", }) }
func CmdBackup(context *GoInk.Context) { if context.Method == "POST" { file, e := cmd.DoBackup(context.App()) if e != nil { Json(context, false).Set("msg", e.Error()).End() return } Json(context, true).Set("file", file).End() return } if context.Method == "DELETE" { file := context.String("file") if file == "" { Json(context, false).End() return } cmd.RemoveBackupFile(file) Json(context, true).End() return } files, _ := cmd.GetBackupFiles() context.Layout("cmd") context.Render("cmd/backup", map[string]interface{}{ "Files": files, }) }