Files
biss 454d9d32c4 feat: 升级 ThinkPHP 8 与 PHP 8.2+ 兼容性
升级框架及稳定依赖,修复路由、鉴权、种子、动态属性和 PHP 8.5 弃用问题。

固化 ThinkCaptcha 和 ORM 的 PHP 8.5 兼容补丁;Composer 安装会自动应用并由 patches.lock.json 锁定。

验证:45 条迁移、依赖校验与安全审计、验证码 PNG 响应及关键页面/API 回归通过。
2026-10-04 14:07:24 +08:00

80 lines
2.4 KiB
PHP
Executable File

<?php
use think\migration\Seeder;
class Admin 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
{
// 计算帐号禁用时间
$jyshijian = config('shangma.mimaguoqi');
$now = date("Y-m-d", time());
$jinyong = strtotime("$now+".$jyshijian." day");
// 定义表的名称
$rows = [
[
'id' => 1,
'xingming' => '超级管理员一',
'sex' => 1,
'shengri' => strtotime("-25 year"),
'username' => 'admin',
'password' => '$apr1$oz6tgaAl$ix4GBv0VxcnVJPIiodXUY/',
'school_id' => 1,
'phone' => "13190180000",
'worktime' => time(),
'zhicheng_id' => "10603",
"xueli_id" => "10503",
"quanpin" => "chaojiyi",
"shoupin" => "cjy",
"tuixiu" => 0,
"lasttime" => time(),
"thistime" => time(),
"guoqi" => $jinyong,
"create_time" => time(),
"update_time" => time()
],
[
'id' => 2,
'xingming' => '超级管理员二',
'sex' => 1,
'shengri' => strtotime("-25 year"),
'username' => 'admin1',
'password' => '$apr1$oz6tgaAl$ix4GBv0VxcnVJPIiodXUY/',
'school_id' => 1,
'phone' => "13190180001",
'worktime' => time(),
'zhicheng_id' => "10603",
"xueli_id" => "10503",
"quanpin" => "chaojier",
"shoupin" => "cje",
"tuixiu" => 0,
"lasttime" => time(),
"thistime" => time(),
"guoqi" => $jinyong,
"create_time" => time(),
"update_time" => time()
],
];
$serRows = $this->fetchAll('select * from cj_admin');
if(is_array($serRows) && count($serRows) > 0)
{
$rows = array();
return;
}
// 保存数据
$this->table('admin')->insert($rows)->update();
}
}