feat: ofm-service-pulicity 反存ticket_data 到 obj
This commit is contained in:
parent
67f9cbb700
commit
9f030ece6d
|
@ -91,3 +91,16 @@ def bind_publicity(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
if ins.ticket is None:
|
if ins.ticket is None:
|
||||||
ins.ticket = ticket
|
ins.ticket = ticket
|
||||||
ins.save()
|
ins.save()
|
||||||
|
|
||||||
|
|
||||||
|
def save_ticket_data(ticket: Ticket, new_ticket_data: dict):
|
||||||
|
try:
|
||||||
|
obj = Publicity.objects.get(id=new_ticket_data['t_id'])
|
||||||
|
except Publicity.DoesNotExist:
|
||||||
|
raise ParseError("Publicity t_id 不存在")
|
||||||
|
data_save = {k: v for k, v in new_ticket_data.items() if k not in ['t_model', 't_id']}
|
||||||
|
|
||||||
|
for k, v in data_save.items():
|
||||||
|
setattr(obj, k, v)
|
||||||
|
obj.save()
|
||||||
|
|
Loading…
Reference in New Issue