예제 #1
0
def get_someday_values(uname, day, type_id):
	if not str_deal.is_day_str(day) or not type_id.isdigit():
		return error.raise_param_illegal()
	type_id = int(type_id)
	#检查权限
	if not authority.can_access_physical(type_id, uname):
		return error.raise_no_auth()
	datas = physical.get_someday_values(type_id, day)
	if datas:
		return generate_today_json(datas)
	return error.raise_error_with_info('没有对应的数据')
예제 #2
0
def get_last_one(uname, type_id):
	if not type_id.isdigit():
		return error.raise_param_illegal()
	type_id = int(type_id)
	#检查权限
	if not authority.can_access_physical(type_id, uname):
		return error.raise_no_auth()
	value = physical.get_last_one(type_id)
	if value == None:
		return error.raise_error_with_info('没有对应物理量的数据')
	return generate_json.data_json(value)
예제 #3
0
def get_today_values(uname, type_id):
	#参数合法性检查
	if not type_id.isdigit():
		return error.raise_param_illegal()
	type_id = int(type_id)
	#检查权限
	if not authority.can_access_physical(type_id, uname):
		return error.raise_no_auth()
	today = libtime.strftime('%Y-%m-%d')
	datas = physical.get_someday_values(type_id, today)
	if datas:
		return generate_today_json(datas)
	return error.raise_error_with_info('没有对应的数据')