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