$get = $_GET['system'];
//根据任务表的id差导师的名字和公司顾问名字
$task = new \app\model\Rw();
$data = $task->where('rw_id', $get)->find()->toArray();
#只能上传后缀名pdf的文件
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$file = $_FILES['file'];
$targetDir = './public/'; // 目标目录
//没有目录则创建
if (!is_dir($targetDir)) {
mkdir($targetDir, 0777, true);
}
$targetFile = $targetDir . basename($file['name']); // 目标文件路径
$fileExtension = strtolower(pathinfo($targetFile, PATHINFO_EXTENSION));
if ($fileExtension !== 'pdf') {
tzts(3, fh(), '只能上传后缀名为pdf的文件!');
exit;
}
// 继续处理文件上传逻辑...
if (move_uploaded_file($file['tmp_name'], $targetFile)) {
//只保留文件名不要目录
$data['xstjwj'] = basename($file['name']);
//获取当前时间日期格式
$data['xstjsj'] = date('Y-m-d', time());
//把两个时间转换为时间戳
$data['jzrq'] = strtotime($data['jzrq']);
$data['xstjsj'] = strtotime($data['xstjsj']);
#对比有没有超过截止时间
//截止时间是否小于当前时间
if ($data['jzrq'] < $data['xstjsj']) {
//设置标红
$data['sfbh'] = '标红';
} else {
$data['sfbh'] = '未标红';
}
//获取当前时间日期格式
$data['xstjsj'] = date('Y-m-d', time());
unset($data['jzrq']);
} else {
tzts(3, fh(), 'File upload failed!');
}
}
$task = new \app\model\Xsrw();
try {
$task->save($data);
} catch (\Exception $e) {
tzts(3, fh(), 'Release file name duplicate Please change it and submit it');
}
tzts(2, fh(), 'Release success');
05-23
10-02