# coding=utf-8 from django.utils.module_loading import import_string from enum import Enum from apilib.systypes import IntEnum class TodoTypeEnum(Enum): """ 待办消息的种类 """ SMS_TODO = 1, u"流量卡待办", None @classmethod def choices(cls): result = list() for _ in cls.__members__.values(): result.append(_.code) return result @classmethod def to_list(cls): return [{"code": _.code, "text": _.text} for _ in cls.__members__.values()] def __init__(self, code, text, todoCls): self.code = code self.text = text self.todoCls = todoCls def _load_todoCls(self): return import_string(self.todoCls) def __eq__(self, other): return self.code == other class TodoDone(IntEnum): INIT = 0 # 待办任务的初始化 ING = 1 # 待办任务的进行中(目前可能没有用) DONE = 2 # 待办任务的完成 class LinkageSwitchEnum(object): CHARGE_INSURANCE = "chargeInsurance"