From 296f80ec4ab1f85425b7b385f0245c935b92d182 Mon Sep 17 00:00:00 2001 From: wcq <744800102@qq.com> Date: Thu, 9 Feb 2023 10:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E6=9D=83=E9=99=90=E8=B7=AF?= =?UTF-8?q?=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Exceptions/common.py | 7 +++++++ Utils/AuthRuleUtils.py | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Exceptions/common.py create mode 100644 Utils/AuthRuleUtils.py diff --git a/Exceptions/common.py b/Exceptions/common.py new file mode 100644 index 0000000..c484bc9 --- /dev/null +++ b/Exceptions/common.py @@ -0,0 +1,7 @@ +class ErrorException(Exception): + pass + + +# 这个错误类型可以直接将错误传递到前端,作为错误提示 +class CommonException(Exception): + pass diff --git a/Utils/AuthRuleUtils.py b/Utils/AuthRuleUtils.py new file mode 100644 index 0000000..903fc0b --- /dev/null +++ b/Utils/AuthRuleUtils.py @@ -0,0 +1,12 @@ +from typing import List + + +def make_auth_rule_data(rule_id_list: List[int]) -> str: + auth_rule_data = "".join([str(item) for item in rule_id_list]) + return auth_rule_data + + +def parse_auth_rule_data(auth_rule_data: str) -> List[int]: + rule_id_list = [int(item) for item in auth_rule_data.split(",")] + return rule_id_list +