def delete(self, action_id, *args, **kwargs):
        """删除"""
        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if action.delete():
            self.on_success()
        else:
            self.on_error(**ErrorCodeMessage.database_error)
    def post(self, *args, **kwargs):
        action_id = self.get_angular_argument('id')

        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if action.recover():
            self.on_success()
            return
        else:
            self.on_error(**ErrorCodeMessage.database_error)
    def put(self, *args, **kwargs):
        """改名"""
        action_name = self.get_angular_argument('name')
        action_id = self.get_angular_argument('id')

        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if not action_name:
            self.on_error(**ErrorCodeMessage.action_name_illegal)
            return

        if action.edit_name(action_name):
            self.on_success()
        else:
            self.on_error(**ErrorCodeMessage.database_error)