def mod_info(appname, modelName): ''' this api is used to modify one rule Request URL: /appname/rule/rule/update HTTP Method:POST Parameters: { "id": 1, "title": "xxxx" } Return : { "status":0 "data":{ "id": 1, "title":"海豚英文版" } } ''' # check post data MODELNAME = get_model_cls(modelName) required_list = list(MODELNAME.params) + ["id&need&int", ] data = get_valid_params(request, required_list) if isinstance(data, Response): return data return info_mod(appname, MODELNAME, data)
def rule_update(appname): ''' this api is used to modify one rule Request URL: /appname/rule/rule/update HTTP Method:POST Parameters: { "title": "xxxx" "min_version": 0, "max_version": 0, "source":[1], "locale":[1], "operator":[1], "package":[1], "min_value": 0, "max_value": 0, "gray_scale": 100, "gray_start": 1 } Return : { "status":0 "data":{ "id": 1, "title":"海豚英文版", "min_version": 0, "max_version": 0, "first_created": "2015-02-05 21:37:38", "last_modified": "2015-02-05 21:37:38" } } ''' # check post data required_list = list(Rule.params) + ["id&need&int", ] data = get_valid_params(request, required_list) if isinstance(data, Response): return data # check the id of pn/op/src/lc rule_params = ["package", "operator", "source", "locale"] data = check_rule_params(appname, data, rule_params) if isinstance(data, Response): return data return info_mod(appname, Rule, data)