Merge feature/mzl-dev: 添加飞书回调调试
This commit is contained in:
@@ -192,17 +192,22 @@ class FeishuCardController extends BaseController
|
|||||||
// 检查用户是否有权限审批
|
// 检查用户是否有权限审批
|
||||||
$order = \app\model\ApprovalOrder::find($orderId);
|
$order = \app\model\ApprovalOrder::find($orderId);
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
|
error_log('❌ 审批单不存在: order_id=' . $orderId);
|
||||||
return $this->errorCard('审批单不存在');
|
return $this->errorCard('审批单不存在');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_log('📝 开始审批通过: order_id=' . $orderId . ', user_id=' . $user->id . ', remark=' . $remark);
|
||||||
|
|
||||||
// 执行审批通过
|
// 执行审批通过
|
||||||
$approvalService->approve($orderId, $user->id, $remark);
|
$approvalService->approve($orderId, $user->id, $remark);
|
||||||
|
|
||||||
error_log('✅ 审批通过成功: order_id=' . $orderId . ', remark=' . $remark);
|
error_log('✅ 审批通过成功,准备返回卡片');
|
||||||
return $this->successCard('审批通过', $this->buildApproveContent($user, $order, $remark));
|
$response = $this->successCard('审批通过', $this->buildApproveContent($user, $order, $remark));
|
||||||
|
error_log('✅ 卡片响应已生成');
|
||||||
|
return $response;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
error_log('❌ 审批通过异常: ' . $e->getMessage());
|
error_log('❌ 审批通过异常: ' . $e->getMessage() . ', file: ' . $e->getFile() . ', line: ' . $e->getLine());
|
||||||
return $this->errorCard('审批失败: ' . $e->getMessage());
|
return $this->errorCard('审批失败: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,17 +278,22 @@ class FeishuCardController extends BaseController
|
|||||||
// 检查用户是否有权限审批
|
// 检查用户是否有权限审批
|
||||||
$order = \app\model\ApprovalOrder::find($orderId);
|
$order = \app\model\ApprovalOrder::find($orderId);
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
|
error_log('❌ 审批单不存在: order_id=' . $orderId);
|
||||||
return $this->errorCard('审批单不存在');
|
return $this->errorCard('审批单不存在');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_log('📝 开始审批拒绝: order_id=' . $orderId . ', user_id=' . $user->id . ', reason=' . $reason);
|
||||||
|
|
||||||
// 执行审批拒绝
|
// 执行审批拒绝
|
||||||
$approvalService->reject($orderId, $user->id, $reason);
|
$approvalService->reject($orderId, $user->id, $reason);
|
||||||
|
|
||||||
error_log('✅ 审批拒绝成功: order_id=' . $orderId . ', reason=' . $reason);
|
error_log('✅ 审批拒绝成功,准备返回卡片');
|
||||||
return $this->successCard('已拒绝', $this->buildRejectContent($user, $order, $reason));
|
$response = $this->successCard('已拒绝', $this->buildRejectContent($user, $order, $reason));
|
||||||
|
error_log('✅ 卡片响应已生成');
|
||||||
|
return $response;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
error_log('❌ 审批拒绝异常: ' . $e->getMessage());
|
error_log('❌ 审批拒绝异常: ' . $e->getMessage() . ', file: ' . $e->getFile() . ', line: ' . $e->getLine());
|
||||||
return $this->errorCard('审批失败: ' . $e->getMessage());
|
return $this->errorCard('审批失败: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,10 +427,16 @@ class FeishuCardController extends BaseController
|
|||||||
*/
|
*/
|
||||||
private function json(array $data): Response
|
private function json(array $data): Response
|
||||||
{
|
{
|
||||||
|
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
|
||||||
|
error_log('📤 飞书卡片响应: ' . $json);
|
||||||
|
|
||||||
return new \Webman\Http\Response(
|
return new \Webman\Http\Response(
|
||||||
200,
|
200,
|
||||||
['Content-Type' => 'application/json; charset=utf-8'],
|
[
|
||||||
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
'Content-Type' => 'application/json; charset=utf-8',
|
||||||
|
],
|
||||||
|
$json
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user