fix: 防止自审批并优化飞书响应

- 添加自审批检查(申请人不能审批自己的申请)
- 使用 response() 函数替代 new Response() 确保飞书回调正确
This commit is contained in:
root
2026-02-28 14:19:58 +08:00
parent 95e150b65f
commit 1b0be5918d
2 changed files with 16 additions and 14 deletions
+10
View File
@@ -67,6 +67,11 @@ class ApprovalService
return $this->db->transaction(function () use ($orderId, $approverId, $comment) {
$order = ApprovalOrder::with(['flow.nodes'])->findOrFail($orderId);
// 检查是否为自己审批自己的申请
if ($order->applicant_id === $approverId) {
throw new \Exception('不能审批自己提交的申请');
}
if (!$order->canApprove()) {
throw new \Exception('当前状态无法审批');
}
@@ -137,6 +142,11 @@ class ApprovalService
return $this->db->transaction(function () use ($orderId, $approverId, $comment) {
$order = ApprovalOrder::findOrFail($orderId);
// 检查是否为自己审批自己的申请
if ($order->applicant_id === $approverId) {
throw new \Exception('不能审批自己提交的申请');
}
if (!$order->canApprove()) {
throw new \Exception('当前状态无法审批');
}