refactor: 删除 users 表中的冗余飞书字段

- 删除 feishu_user_id, feishu_open_id, tenant_key 字段
- JWT token 改用 feishu_app_id 代替 feishu_user_id
- 删除废弃的 FeishuService::sendApprovalMessage() 方法
- 更新 User 模型移除废弃字段和 scope 方法

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-26 16:33:58 +08:00
parent 0489da5e40
commit fdbe2e837a
4 changed files with 36 additions and 110 deletions
-72
View File
@@ -230,76 +230,4 @@ class FeishuService
error_log("✨ 创建飞书绑定: user_id={$userId}, app_id={$appId}, feishu_user_id={$feishuUserId}");
}
}
/**
* 发送审批消息通知
* @deprecated 请使用 FeishuNotificationService::sendApprovalNotification() 代替
*/
public function sendApprovalMessage(int $userId, string $title, string $url): bool
{
try {
$user = User::findOrFail($userId);
$company = Company::findOrFail($user->company_id);
$this->setCompany($company->id);
$token = $this->getAccessToken();
// 构建消息内容
$message = [
'msg_type' => 'interactive',
'card' => [
'header' => [
'title' => [
'content' => '审批通知',
'tag' => 'plain_text',
],
'template' => 'blue',
],
'elements' => [
[
'tag' => 'div',
'text' => [
'content' => $title,
'tag' => 'plain_text',
],
],
[
'tag' => 'action',
'actions' => [
[
'tag' => 'button',
'text' => [
'content' => '查看详情',
'tag' => 'plain_text',
],
'type' => 'default',
'url' => $url,
],
],
],
],
],
];
// 发送消息
$response = HttpClient::httpPost(
"https://open.feishu.cn/open-apis/message/v4/send_messages",
[
'receive_id_type' => 'user_id',
'receive_id' => $user->feishu_user_id,
'msg_type' => 'interactive',
'content' => json_encode(['card' => $message['card']]),
],
[
'Authorization: Bearer ' . $token,
]
);
return ($response['code'] ?? -1) === 0;
} catch (Exception $e) {
// 记录错误但不中断流程
error_log('发送飞书消息失败: ' . $e->getMessage());
return false;
}
}
}