Skip to content

Commit

Permalink
Merge pull request #1228 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
bugfix: TicketLog 新增_objects
  • Loading branch information
hanshuaikang authored Nov 8, 2023
2 parents c7233d4 + 8a7672e commit 413e2c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions itsm/ticket/models/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ class TicketFollowerNotifyLog(NotifyLogModel):
)
is_sys_sended = models.BooleanField(_("是否系统流程发送"), default=False)

_objects = models.Manager()

class Meta:
app_label = "ticket"
verbose_name = _("关注人通知日志")
Expand All @@ -286,15 +288,15 @@ def __unicode__(self):
def get_unique_token(cls):
"""生成唯一的短码,7位,3x62^6种"""

ticket_token = get_random_string(6)
ticket_token = get_random_string(8)
retry = 0

while retry < 60:
# 满足条件,退出循环,且retry<60
if not cls.objects.filter(ticket_token=ticket_token).exists():
break

ticket_token = get_random_string(6)
ticket_token = get_random_string(8)
retry += 1
else:
# 尝试60次一直重复,则放弃生成code
Expand Down
3 changes: 1 addition & 2 deletions itsm/ticket/models/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4263,9 +4263,8 @@ def do_before_end_pipeline(
action=FINISHED,
retry=False,
)

# 清理Token
TicketFollowerNotifyLog.objects.filter(ticket_id=self.id).delete()
TicketFollowerNotifyLog._objects.filter(ticket_id=self.id).delete()
return

def proceed(self, state_id, fields, operator="", source=WEB):
Expand Down

0 comments on commit 413e2c4

Please sign in to comment.