更新命名问题

This commit is contained in:
2025-06-25 11:52:01 +08:00
parent 9f374011ae
commit 6b78ee29cf
57 changed files with 3295 additions and 1288 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class BusinessInfo extends BaseController
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$phone = isset($_POST['phone']) ? $_POST['phone'] : '';
$ip = isset($_POST['IP']) ? $_POST['IP'] : '';
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';
$product = isset($_POST['product']) ? $_POST['product'] : '';
$company = isset($_POST['company']) ? $_POST['company'] : '';
+73 -4
View File
@@ -92,6 +92,74 @@ class Index extends BaseController
}
}
// 上传程序
public function upload_files()
{
if (request()->file('file')) {
// 获取文件信息
$file = request()->file('file');
$file_name = $file->getOriginalName();
$file_size = $file->getSize();
$file_extension = pathinfo($file->getOriginalName(), PATHINFO_EXTENSION);
// 文件大小限制(单位:字节)
$max_file_size = 500 * 1024 * 1024; // 500MB
// 检查文件大小
if ($file_size > $max_file_size) {
return json([
'code' => 2,
'msg' => '文件过大,已经超过500MB,请联系管理员!',
'max_size' => $max_file_size,
'file_size' => $file_size
]);
}
// 创建文件夹
$upload_dir = 'upload/programes/' . date('Y-m-d') . '/';
if (!is_dir($upload_dir)) {
if (!mkdir($upload_dir, 0777, true) && !is_dir($upload_dir)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
}
}
// 生成新文件名
$new_name = $this->generateRandomName(5) . '.' . $file_extension;
// 保存文件
$file->move($upload_dir, $new_name);
// 添加数据到数据库
$data = [
'path' => $upload_dir . $new_name,
'uid' => $this->uid,
'create_time' => date('Y-m-d H:i:s', time())
];
Db::name('DownloadFiles')->insert($data);
// 获取文件上传域名
$fileDomain = $_SERVER['HTTP_HOST'];
// 构建文件访问地址
$url = $fileDomain . '/upload/programes/' . date('Y-m-d') . '/' . $new_name;
// 返回 JSON 数据
return json([
'code' => 200,
'msg' => '文件上传成功!',
'fileDomain' => $fileDomain,
'filename' => $file_name,
'filepath' => $upload_dir . $new_name,
'file_size'=> $file_size,
'file_extension'=> $file_extension,
'url' => $url,
'admin_id' => $this->uid
]);
} else {
return json(['code' => 400, 'msg' => '未选择上传文件!']);
}
}
// 图床上传
public function upload_picbed()
{
@@ -563,7 +631,7 @@ class Index extends BaseController
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
$images = Db::name('PicbedImages')->order('id', 'desc')->select()->toArray();
$images = Db::name('PicbedImages')->order('id', 'desc')->select()->toArray();
// 获取当前请求的域名
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
@@ -574,14 +642,15 @@ class Index extends BaseController
$images = array_map(function ($image) use ($baseUrl) {
return [
'name' => htmlspecialchars($image['name'], ENT_QUOTES),
'path' => $baseUrl . '/' . $image['path'],
'path' => $baseUrl . '/' . $image['path'],
];
}, $images);
return json(['code' => 0, 'msg' => '', 'data' => $images]);
return json(['code' => 0, 'msg' => '', 'data' => $images]);
}
public function getallstaff(){
public function getallstaff()
{
$employees = Db::name('admin')
->field('id, name, status') // 根据需要选择字段
->where('status', 1) // 只获取在职员工
-2
View File
@@ -5,6 +5,4 @@ return [
//'think\middleware\SessionInit',
//验证勾股cms是否完成安装
\app\home\middleware\Install::class,
// 跳过登录验证 AuthMiddleware
\app\api\middleware\Auth::class,
];
+2 -1
View File
@@ -1,6 +1,7 @@
<div class="table-content" id="scheduleList">
<div class="layui-form-bar border-t border-x">
<form class="layui-form">
<input id="loginusers" type="hidden" value="{$user_info.id}" />
<div class="layui-input-inline" style="width:110px;">
<input type="text" name="username" placeholder="请选择员工" class="layui-input" readonly
data-event="select" />
@@ -24,7 +25,7 @@
title: '工作记录列表',
cellMinWidth: 200,
url: "/api/schedule/index", //数据接口
where: { 'tid': project_id },
where: { 'tid': project_id},
page: true, //开启分页
limit: 20,
cols: [[ //表头
+2 -2
View File
@@ -19,7 +19,6 @@
<script>
function pageInit() {
var project_id = document.getElementById('project_id').value;
console.log('项目id:' + project_id);
var table = layui.table, tool = layui.tool;
layui.taskTable = table.render({
elem: '#test',
@@ -97,6 +96,7 @@
//只看我按钮代码
$("#taskForm").on("click", '[lay-filter="onlyme"]', function () {
let loginuser = $("#loginusers").val();
let project_id = $("#project_id").val();
let postData = {
type: $("#taskForm").find('[name="type"]').val(),
flow_status: $("#taskForm").find('[name="flow_status"]').val(),
@@ -104,7 +104,7 @@
cate: $("#taskForm").find('[name="cate"]').val(),
delay: $("#taskForm").find('[name="delay"]').val(),
// director_uid: $("#taskForm").find('[name="director_uid"]').val(),
project_id: $("#taskForm").find('[name="project_id"]').val(),
project_id: project_id,
keywords: $("#taskForm").find('[name="keywords"]').val(),
belong_project: $("#taskForm").find('[name="belong_project"]').val(),
creater_name: $("#taskForm").find('[name="creater_name"]').val(),