fix: replace uuid.uuid4() with getID() from appPublic.uniqueID for all table ID generation
This commit is contained in:
parent
843ec0cc24
commit
d0b588d82c
@ -2,6 +2,7 @@ from ahserver.serverenv import ServerEnv
|
||||
from appPublic.worker import awaitify
|
||||
import json
|
||||
import uuid
|
||||
from appPublic.uniqueID import getID
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
class WorkflowCore:
|
||||
@ -10,7 +11,7 @@ class WorkflowCore:
|
||||
|
||||
async def create_workflow(self, workflow_data, org_id):
|
||||
"""创建审批工作流"""
|
||||
workflow_id = str(uuid.uuid4()).replace('-', '')
|
||||
workflow_id = getID()
|
||||
workflow_data['id'] = workflow_id
|
||||
workflow_data['org_id'] = org_id
|
||||
workflow_data['created_at'] = datetime.now()
|
||||
@ -22,7 +23,7 @@ class WorkflowCore:
|
||||
|
||||
async def create_approval_step(self, step_data, org_id):
|
||||
"""创建审批步骤"""
|
||||
step_id = str(uuid.uuid4()).replace('-', '')
|
||||
step_id = getID()
|
||||
step_data['id'] = step_id
|
||||
step_data['org_id'] = org_id
|
||||
|
||||
@ -41,7 +42,7 @@ class WorkflowCore:
|
||||
|
||||
# 使用第一个匹配的工作流(实际可按条件筛选)
|
||||
workflow = workflows[0]
|
||||
instance_id = str(uuid.uuid4()).replace('-', '')
|
||||
instance_id = getID()
|
||||
|
||||
instance_data = {
|
||||
'id': instance_id,
|
||||
@ -117,7 +118,7 @@ class WorkflowCore:
|
||||
|
||||
# 创建审批任务
|
||||
for approver_id in approvers:
|
||||
task_id = str(uuid.uuid4()).replace('-', '')
|
||||
task_id = getID()
|
||||
due_at = None
|
||||
if current_step.get('timeout_hours'):
|
||||
due_at = datetime.now() + timedelta(hours=current_step['timeout_hours'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user