Compare commits

..

No commits in common. "d6f8165d6389acdf547dd6b5f1a33b0ff67454a9" and "82930c1cf5b48a6a1cc607a2cd802f2b19b6440c" have entirely different histories.

1 changed files with 4 additions and 42 deletions

View File

@ -108,19 +108,7 @@ class WorkflowController extends Controller
$request->validate([ $request->validate([
'subject_type' => 'required', 'subject_type' => 'required',
]); ]);
if ($subjectType == (new TaskHygiene)->getMorphClass()) { $check = WorkflowCheck::where('subject_type', $request->input('subject_type'))->where('subject_id', $id)->firstOrFail();
$task = Task::findOrFail($id);
$taskable = $task->taskable;
if (!$taskable) {
throw new RuntimeException('任务不存在');
}
$check = $taskable->workflow;
if (!$check) {
throw new RuntimeException('审核记录不存在');
}
} else {
$check = WorkflowCheck::where('subject_type', $subjectType)->where('subject_id', $id)->firstOrFail();
}
$logs = $check->logs()->sort()->get(); $logs = $check->logs()->sort()->get();
return WorkflowLogResource::collection($logs); return WorkflowLogResource::collection($logs);
@ -131,20 +119,7 @@ class WorkflowController extends Controller
$request->validate([ $request->validate([
'subject_type' => 'required', 'subject_type' => 'required',
]); ]);
$subjectType = $request->input('subject_type'); $check = WorkflowCheck::where('subject_type', $request->input('subject_type'))->where('subject_id', $id)->firstOrFail();
if ($subjectType == (new TaskHygiene)->getMorphClass()) {
$task = Task::findOrFail($id);
$taskable = $task->taskable;
if (!$taskable) {
throw new RuntimeException('任务不存在');
}
$check = $taskable->workflow;
if (!$check) {
throw new RuntimeException('审核记录不存在');
}
} else {
$check = WorkflowCheck::where('subject_type', $subjectType)->where('subject_id', $id)->firstOrFail();
}
try { try {
DB::beginTransaction(); DB::beginTransaction();
if (!$workFlowService->cancel($check)) { if (!$workFlowService->cancel($check)) {
@ -168,21 +143,8 @@ class WorkflowController extends Controller
], [ ], [
'remarks.required_if' => '未通过原因必填', 'remarks.required_if' => '未通过原因必填',
]); ]);
$subjectType = $request->input('subject_type'); $check = WorkflowCheck::where('subject_type', $request->input('subject_type'))->where('subject_id', $id)->firstOrFail();
if ($subjectType == (new TaskHygiene)->getMorphClass()) { $user = $request->user();
$task = Task::findOrFail($id);
$taskable = $task->taskable;
if (!$taskable) {
throw new RuntimeException('任务不存在');
}
$check = $taskable->workflow;
if (!$check) {
throw new RuntimeException('审核记录不存在');
}
} else {
$check = WorkflowCheck::where('subject_type', $subjectType)->where('subject_id', $id)->firstOrFail();
}
$user = $this->guard()->user();
try { try {
DB::beginTransaction(); DB::beginTransaction();
$log = $check->logs()->where('check_status', CheckStatus::Processing)->first(); $log = $check->logs()->where('check_status', CheckStatus::Processing)->first();