debug: 增强自审批检测日志,排查为什么没有生效
This commit is contained in:
@@ -124,6 +124,10 @@ class FeishuNotificationService
|
||||
public function sendApprovalNotification(array $params): bool
|
||||
{
|
||||
$userId = $params['user_id'] ?? null;
|
||||
$applicantId = $params['applicant_id'] ?? null;
|
||||
|
||||
error_log("📧 sendApprovalNotification 被调用: user_id={$userId}, applicant_id=" . ($applicantId ?? 'null'));
|
||||
|
||||
if (!$userId) {
|
||||
error_log('❌ sendApprovalNotification: 缺少 user_id');
|
||||
return false;
|
||||
@@ -144,14 +148,14 @@ class FeishuNotificationService
|
||||
}
|
||||
|
||||
// 检查是否是申请人自己 - 发送文本消息而不是卡片
|
||||
$applicantId = $params['applicant_id'] ?? null;
|
||||
error_log("🔍 自审批检查: applicant_id=" . ($applicantId ?? 'null') . ", user_id={$userId}, match=" . (($applicantId == $userId) ? 'true' : 'false'));
|
||||
error_log("🔍 自审批检查前: applicant_id=" . var_export($applicantId, true) . ", user_id=" . var_export($userId, true));
|
||||
|
||||
if ($applicantId && (int)$applicantId === (int)$userId) {
|
||||
error_log("🔄 检测到自审批,发送文本通知而不是卡片");
|
||||
return $this->sendTextNotification($feishuUserId, $params);
|
||||
}
|
||||
|
||||
error_log("📨 发送卡片消息: 不是自审批");
|
||||
$card = $this->buildApprovalCard($params, $user->company_id);
|
||||
return $this->sendMessage($feishuUserId, $card);
|
||||
} catch (Exception $e) {
|
||||
@@ -342,7 +346,7 @@ class FeishuNotificationService
|
||||
'size' => 'medium',
|
||||
'value' => [
|
||||
'action_type' => 'approve',
|
||||
'order_id' => $orderId,
|
||||
'order_id' => (int)$orderId,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -357,7 +361,7 @@ class FeishuNotificationService
|
||||
'size' => 'medium',
|
||||
'value' => [
|
||||
'action_type' => 'reject',
|
||||
'order_id' => $orderId,
|
||||
'order_id' => (int)$orderId,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user