Example #1
0
def update_config_value(key):
    '''更新参数的value'''
    value = UpdateConfigValueValidator().get_data('value')
    config = Config.get_or_404(key=key)
    config.update({'value': value})
    return Success(config, error_code=1)
Example #2
0
def update_config(id):
    '''更新参数配置'''
    form = UpdateConfigValidator().dt_data
    config = Config.get_or_404(id=id)
    config.update(**form)
    return Success(config, error_code=1)
Example #3
0
def get_config(id):
    '''查询参数配置'''
    config = Config.get_or_404(id=id)
    return Success(config)
Example #4
0
def get_config_by_key(key):
    '''查询参数配置(基于key)'''
    config = Config.get_or_404(key=key)
    return Success(config)
Example #5
0
def delete_config(id):
    '''删除参数配置'''
    config = Config.get_or_404(id=id)
    config.delete()
    return Success(error_code=2)