class GetParticipants: all_funcs = [ {'func':'get_create_by', 'name':'获取工单创建人'} ] # def all_funcs(self): # # return list(filter(lambda x: x.startswith('get_') and callable(getattr(self, x)), dir(self))) # return [(func, getattr(self, func).__doc__) for func in dir(self) if callable(getattr(self, func)) and func.startswith('get_')] @classmethod def get_create_by(cls, state:dict={}, ticket:dict={}, ticket_data:dict={}, request={}): """工单创建人""" participant = ticket.create_by.id return participant class HandleScripts: all_funcs = [ {'func': 'handle_wproduct', 'name':'处理不合格品'} ] @classmethod def handle_wproduct(cls, ticket:dict={}): """处理不合格品""" ticket_data = ticket.ticket_data wp = ticket.wt_ticket wp = ticket_data if 'shenli2' in ticket_data and ticket_data['shenli2']: if ticket_data['shenli2'] in ['返工', '返修']: pass