升级框架及稳定依赖,修复路由、鉴权、种子、动态属性和 PHP 8.5 弃用问题。 固化 ThinkCaptcha 和 ORM 的 PHP 8.5 兼容补丁;Composer 安装会自动应用并由 patches.lock.json 锁定。 验证:45 条迁移、依赖校验与安全审计、验证码 PNG 响应及关键页面/API 回归通过。
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
use think\migration\Seeder;
|
|
|
|
class ZauthGroup extends Seeder
|
|
{
|
|
/**
|
|
* Run Method.
|
|
*
|
|
* Write your database seeder using this method.
|
|
*
|
|
* More information on writing seeders is available here:
|
|
* http://docs.phinx.org/en/latest/seeding.html
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$authList = $this->fetchAll('select * from cj_auth_rule where status = 1');
|
|
$authList = array_column($authList, 'id');
|
|
$authList = implode(',', $authList);
|
|
|
|
// 设置数据
|
|
$rows= [
|
|
[
|
|
'title' => '管理员'
|
|
,'rules' => $authList
|
|
,'miaoshu' => '拥有所有权限'
|
|
,'create_time' => time()
|
|
,'update_time' => time()
|
|
]
|
|
];
|
|
|
|
$serRows = $this->fetchAll('select * from cj_auth_group');
|
|
if($rows[0]['rules'] == '' || (is_array($serRows) && count($serRows) > 0))
|
|
{
|
|
$rows = array();
|
|
return;
|
|
}
|
|
|
|
// 保存数据
|
|
$this->table('auth_group')->insert($rows)->save();
|
|
}
|
|
}
|