0489da5e40
- 新增 user_feishu_apps 表支持用户绑定多个飞书应用 - users 表添加唯一约束(公司内邮箱/手机唯一) - 迁移现有飞书数据到 user_feishu_apps 表 - 清理冗余表(users_bak, user_feishu_binding) - 废弃 users 表中的 feishu_user_id/feishu_open_id/tenant_key 字段 - 更新 FeishuNotificationService 使用新的数据获取方式 - User 模型新增 getFeishuUserId() 等便捷方法 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use support\Model;
|
|
|
|
class FeishuLoginSession extends Model
|
|
{
|
|
protected $table = 'feishu_login_session';
|
|
|
|
protected $fillable = [
|
|
'company_id',
|
|
'tenant_key',
|
|
'feishu_app_id',
|
|
'status',
|
|
'user_id',
|
|
'expires_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'status' => 'string',
|
|
'user_id' => 'integer',
|
|
'company_id' => 'integer',
|
|
'expires_at' => 'datetime',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
const STATUS_PENDING = 'pending'; // 待扫码
|
|
const STATUS_SCANNING = 'scanning'; // 已扫码,待授权
|
|
const STATUS_SUCCESS = 'success'; // 登录成功
|
|
const STATUS_EXPIRED = 'expired'; // 已过期
|
|
|
|
/**
|
|
* 关联公司
|
|
*/
|
|
public function company()
|
|
{
|
|
return $this->belongsTo(Company::class, 'company_id');
|
|
}
|
|
|
|
/**
|
|
* 关联用户
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|