feat: 实现TCP Server
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\repository\bean;
|
||||
|
||||
class User
|
||||
{
|
||||
/**
|
||||
* @var int auto id
|
||||
*/
|
||||
public int $user_id {
|
||||
get => $this->user_id;
|
||||
}
|
||||
/**
|
||||
* @var string user name
|
||||
*/
|
||||
public string $name {
|
||||
get => $this->name;
|
||||
}
|
||||
/**
|
||||
* @var int role id
|
||||
*/
|
||||
public int $roleId {
|
||||
get => $this->role->value;
|
||||
}
|
||||
|
||||
public UserRole $role{
|
||||
get => $this->role;
|
||||
}
|
||||
/**
|
||||
* @var int department id
|
||||
*/
|
||||
public int $departmentId {
|
||||
get => $this->departmentId;
|
||||
}
|
||||
/**
|
||||
* @var string 人员卡编码
|
||||
*/
|
||||
public string $rfidCode {
|
||||
get => $this->rfidCode;
|
||||
}
|
||||
|
||||
public function __construct(int $user_id, string $name, int $roleId, int $departmentId, string $rfid)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->name = $name;
|
||||
$this->role = UserRole::from($roleId);
|
||||
$this->departmentId = $departmentId;
|
||||
$this->rfidCode = $rfid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\repository\bean;
|
||||
|
||||
// 枚举
|
||||
enum UserRole: int
|
||||
{
|
||||
case ADMIN = 1;
|
||||
/**
|
||||
* 医生
|
||||
*/
|
||||
case DOCTOR = 2;
|
||||
/**
|
||||
* 清洗工
|
||||
*/
|
||||
case CLEANER = 3;
|
||||
/**
|
||||
* 护士
|
||||
*/
|
||||
case NURSE = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user