def add_event(user_type, phone, priority, source, status, creater_id, user_id=None, user_info=None, order_id=None, compensation=None, content=None, category_l1=None, category_l2=None, category_l3=None): if user_id is None: user_id = cs_user_service.get_user_by_phone(phone).get('user_id', None) event_id = inner.add_event( user_id=user_id, user_type=user_type, user_info=user_info, phone=phone, priority=priority, source=source, status=status, creater_id=creater_id, handler_id=creater_id, order_id=order_id, compensation=compensation, category_l1=category_l1, category_l2=category_l2, category_l3=category_l3, ) inner.add_record(event_id, creater_id, content, status) return event_id
def update_event(event_id, compensation=None, user_id=None, content=None): event = inner.get_event(event_id) if not event: raise_user_exc(CS_EVENT_NOT_EXIST, event_id=event_id) if compensation is not None: event.update(compensation=compensation) if user_id and content: inner.add_record(event_id, user_id, content, event.status) return True
def add_record(event_id, user_id, content, status=None): if not status: status = get_event(event_id) return inner.add_record(event_id, user_id, content, status)