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

60 lines
1.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use think\migration\Seeder;
class Xueqi 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
{
$y = date('Y');
$m = date('m');
if ($m >= 8)
{
$title = $y . '~' . ($y + 1) . '学年度第一学期';
$niandu = $y . '~' . ($y + 1) . '学年度';
$c = 10801;
$b = $y . '-08-01';
$e = ($y + 1) . '-01-31';
} else {
$title = ($y - 1) . '~' . $y . '学年度第二学期';
$niandu = ($y - 1) . '~' . $y . '学年度';
$c = 10802;
$b = ($y - 1) . '-02-01';
$e = $y . '-07-31';
}
// 设置数据
$rows= [
[
'title' => $title
,'xuenian' => $y
,'category_id' => $c
,'bfdate' => strtotime($b)
,'enddate' => strtotime($e)
,'create_time' => time()
,'update_time' => time()
]
];
$serRows = $this->fetchAll('select * from cj_xueqi');
if(is_array($serRows) && count($serRows) > 0)
{
$rows = [];
return;
}
// 保存数据
$this->table('xueqi')->insert($rows)->save();
}
}