mirror of
https://devops.lemonos.cn/lawson/FendxPHP.git
synced 2026-06-15 15:02:49 +08:00
- 创建用户表(users)包含基本信息和认证字段 - 创建角色表(roles)用于权限控制 - 创建权限表(permissions)定义系统权限 - 创建用户角色关联表(user_roles)建立用户与角色关系 - 创建角色权限关联表(role_permissions)建立角色与权限关系 - 创建迁移记录表(migrations)追踪数据库变更 - 添加AdminController提供管理员面板功能 - 实现系统监控、配置管理、缓存清理等功能 - 添加AOP切面编程支持的各种通知类型 - 实现告警管理AlertManager支持多渠道告警 - 添加文档注解接口规范
67 lines
1.3 KiB
PHP
67 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use Fendx\Db\Annotation\Table;
|
|
use Fendx\Db\Annotation\Id;
|
|
use Fendx\Db\Annotation\Column;
|
|
use Fendx\Db\ORM\Model;
|
|
|
|
#[Table('users')]
|
|
class User extends Model
|
|
{
|
|
#[Id]
|
|
public int $id;
|
|
|
|
#[Column('username')]
|
|
public string $username;
|
|
|
|
#[Column('email')]
|
|
public string $email;
|
|
|
|
#[Column('password')]
|
|
public string $password;
|
|
|
|
#[Column('status', 'tinyint')]
|
|
public int $status = 1;
|
|
|
|
#[Column('created_at', 'datetime')]
|
|
public string $createdAt;
|
|
|
|
#[Column('updated_at', 'datetime')]
|
|
public string $updatedAt;
|
|
|
|
public function getCreatedAt(): string
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function setCreatedAt(string $createdAt): void
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
}
|
|
|
|
public function getUpdatedAt(): string
|
|
{
|
|
return $this->updatedAt;
|
|
}
|
|
|
|
public function setUpdatedAt(string $updatedAt): void
|
|
{
|
|
$this->updatedAt = $updatedAt;
|
|
}
|
|
|
|
public function isActive(): bool
|
|
{
|
|
return $this->status === 1;
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
$data = parent::toArray();
|
|
unset($data['password']); // 不返回密码
|
|
return $data;
|
|
}
|
|
}
|