init: 项目初始代码

This commit is contained in:
2026-10-14 14:00:29 +08:00
commit cc434cf89f
464 changed files with 66984 additions and 0 deletions

49
app/api/model/Role.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace app\api\model;
/**
* 角色类
* @mixin \think\Model
*/
class Role extends BaseModel
{
protected $schema = [
'id' => 'int',
'name' => 'string',
'desc' => 'string',
'create_time' => 'int',
'update_time' => 'int',
];
protected $disuse = [
'desc'
];
/**
* 角色菜单关联
* @return \think\model\relation\HasMany
*/
public function RoleToMenu()
{
return $this->hasMany(RoleToMenu::class);
}
/**
* 获取详情
* @param array $data
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getInfo(array $data):array
{
$result = $this->find($data['role_id']);
return $result ? $result->toArray() : [];
}
}