From 10d5d90dd58d7a0d1035a93e2cb2c8165790ed3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Thu, 19 Jun 2025 17:40:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/game/detail.php | 66 +++++++---- app/index/view/resources/detail.php | 177 ++++++++++++++++++---------- app/index/view/resources/list.php | 17 ++- 3 files changed, 166 insertions(+), 94 deletions(-) diff --git a/app/index/view/game/detail.php b/app/index/view/game/detail.php index 52f6dda..34893bd 100644 --- a/app/index/view/game/detail.php +++ b/app/index/view/game/detail.php @@ -44,11 +44,17 @@
Free
-
更新时间:
-
所属分类:
-
程序编号:
-
查看:
-
下载:
+
更新时间: +
+
所属分类:
+
程序编号:
+
查看:
+
下载:
@@ -143,7 +149,7 @@ + + + +{include file="public/tail" /} diff --git a/app/admin/view/yunzeradmin/contentpushsettingadd.php b/app/admin/view/yunzeradmin/contentpushsettingadd.php new file mode 100644 index 0000000..cba0435 --- /dev/null +++ b/app/admin/view/yunzeradmin/contentpushsettingadd.php @@ -0,0 +1,75 @@ +{include file="public/header" /} +
+
+ {if isset($info.id)} + + {/if} +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+
+
+
+ + + +{include file="public/tail" /} \ No newline at end of file From 7f7ff6be06de6655e582b47964cd5de004d53669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=BD=E7=BD=91?= <”357099073@qq.com“> Date: Thu, 3 Jul 2025 19:31:52 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/ResourcesController.php | 32 ++- app/admin/view/resources/add.php | 282 +++++++++++++++++-- app/admin/view/resources/edit.php | 84 +++--- app/index/view/program/detail.php | 3 +- 4 files changed, 322 insertions(+), 79 deletions(-) diff --git a/app/admin/controller/ResourcesController.php b/app/admin/controller/ResourcesController.php index 02e43a4..e4a79f7 100644 --- a/app/admin/controller/ResourcesController.php +++ b/app/admin/controller/ResourcesController.php @@ -119,6 +119,7 @@ class ResourcesController extends BaseController $data = [ 'title' => input('post.title'), 'cate' => input('post.cate'), + 'desc' => input('post.desc'), 'icon' => input('post.icon'), 'images' => input('post.images'), 'url' => input('post.url'), @@ -126,30 +127,43 @@ class ResourcesController extends BaseController 'code' => input('post.code'), 'zipcode' => input('post.zipcode'), 'uploader' => input('post.uploader'), - 'desc' => input('post.desc'), 'content' => input('post.content'), 'number' => input('post.number'), 'status' => input('post.status', 1), - 'create_time' => time() ]; $insert = Resource::insert($data); if (empty($insert)) { Log::record('添加资源', 0, '添加资源失败', '资源管理'); - return json(['code' => 1, 'msg' => '添加失败', 'data' => []]); + $this->error('添加失败'); } Log::record('添加资源', 1, '', '资源管理'); - return json(['code' => 0, 'msg' => '添加成功', 'data' => []]); - } else { + return View::fetch('lists'); + } + + try { + // 获取资源列表 $lists = Resource::where('delete_time', null) ->where('status', '<>', 3) ->select() ->toArray(); + + // 确保变量存在且不为空 + if (!isset($lists) || empty($lists)) { + $lists = []; + } + + // 传递数据到视图 View::assign([ - 'lists' => $lists + 'lists' => $lists, + 'categories' => [] // 添加空的分类数组 ]); + return View::fetch(); + } catch (\Exception $e) { + Log::record('添加资源页面加载', 0, $e->getMessage(), '资源管理'); + $this->error('页面加载失败:' . $e->getMessage()); } } @@ -213,9 +227,9 @@ class ResourcesController extends BaseController if (!empty($resource['images'])) { $domain = request()->domain(); $images = explode(',', $resource['images']); - $images = array_map(function ($image) use ($domain) { - return $domain . $image; - }, $images); + // $images = array_map(function ($image) use ($domain) { + // return $domain . $image; + // }, $images); $resource['images'] = implode(',', $images); } diff --git a/app/admin/view/resources/add.php b/app/admin/view/resources/add.php index a93c6e7..356cf0a 100644 --- a/app/admin/view/resources/add.php +++ b/app/admin/view/resources/add.php @@ -14,7 +14,7 @@
-
@@ -22,7 +22,7 @@
-
@@ -31,8 +31,8 @@
- +
@@ -46,7 +46,7 @@
-
@@ -75,7 +75,7 @@
-
@@ -100,7 +100,7 @@
-
@@ -108,7 +108,7 @@
-
@@ -116,7 +116,7 @@
-
@@ -131,19 +131,17 @@
-
- -
- 预览图: -
-
-
+
+ +
+
+ +
-
-
-
-
@@ -432,11 +430,29 @@ return false; } var loadIndex = layer.load(2); - data.field.content = content; + + // 使用 FormData 提交数据 + var formData = new FormData(); + formData.append('title', $('input[name="title"]').val()); + formData.append('cate', $('select[name="cate"]').val()); + formData.append('number', $('input[name="number"]').val()); + formData.append('desc', $('textarea[name="desc"]').val()); + formData.append('uploader', $('input[name="uploader"]').val()); + formData.append('icon', $('input[name="icon"]').val()); + formData.append('images', $('input[name="images"]').val()); + formData.append('url', $('input[name="url"]').val()); + formData.append('fileurl', $('input[name="fileurl"]').val()); + formData.append('code', $('input[name="code"]').val()); + formData.append('zipcode', $('input[name="zipcode"]').val()); + formData.append('sort', $('input[name="sort"]').val()); + formData.append('content', content); + $.ajax({ url: '{:url("resources/add")}', type: 'POST', - data: data.field, + data: formData, + processData: false, + contentType: false, success: function (res) { layer.close(loadIndex); if (res.code == 0) { @@ -447,6 +463,10 @@ } else { layer.msg(res.msg, { icon: 2 }); } + }, + error: function () { + layer.close(loadIndex); + layer.msg('提交失败,请重试', { icon: 2 }); } }); return false; @@ -549,4 +569,220 @@ function goBack() { window.location.href = '{:url("resources/lists")}'; } + + + + + \ No newline at end of file diff --git a/app/admin/view/resources/edit.php b/app/admin/view/resources/edit.php index dda34f8..6243b7c 100644 --- a/app/admin/view/resources/edit.php +++ b/app/admin/view/resources/edit.php @@ -107,48 +107,6 @@
-
- -
-
- -
- {if condition="isset($resource.images) && !empty($resource.images)"} - {if condition="strpos($resource.images, ',') !== false"} - {volist name="resource.images|explode=',',true" id="image"} -
- 已上传图片 -
- -
-

{$image|basename}

-
- {/volist} - {else} -
- 已上传图片 -
- -
-

{$resource.images|basename}

-
- {/if} - {/if} -
- - -
-
-
-
@@ -173,6 +131,42 @@
+
+ +
+
+ +
+ {if condition="isset($resource.images) && !empty($resource.images)"} + {php} + $images = is_array($resource['images']) ? $resource['images'] : explode(',', $resource['images']); + if(empty($images[0])) { + $images = [$resource['images']]; + } + {/php} + {volist name="images" id="image"} +
+ 已上传图片 +
+ +
+

{$image|basename}

+
+ {/volist} + {/if} +
+ + +
+
+
+
@@ -777,8 +771,8 @@ } .delete-image { - background: #dc3545; - color: white; + /* background: #dc3545; */ + /* color: white; */ border: none; border-radius: 4px; padding: 8px 12px; @@ -792,7 +786,7 @@ } .delete-image i { - font-size: 14px; + font-size: 40px; margin-right: 4px; /* 添加图标右边距 */ } diff --git a/app/index/view/program/detail.php b/app/index/view/program/detail.php index b42030e..d504048 100644 --- a/app/index/view/program/detail.php +++ b/app/index/view/program/detail.php @@ -734,8 +734,7 @@ .disclaimers { color: #b1b1b1; - width: 80%; - margin: 20px auto; + margin: 20px 0; margin-bottom: 60px; } From 3a20b76d4ac3c8db5525e678a2f4da73de997515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Fri, 4 Jul 2025 11:56:25 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=EF=BC=8C=E5=89=8D=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/YunzeradminController.php | 8 ++ app/admin/view/resources/edit.php | 95 +++++++++---- app/index/view/component/main.php | 4 +- app/index/view/resources/detail.php | 126 +++++++++++++++--- .../temp/606cb5a28477c3a4a33c90fc473c4624.php | 14 +- .../temp/cb3abdcb36407244b9b613766f30573b.php | 6 +- .../temp/f8995f34639557c9f17f79801bc58d25.php | 13 +- 7 files changed, 210 insertions(+), 56 deletions(-) diff --git a/app/admin/controller/YunzeradminController.php b/app/admin/controller/YunzeradminController.php index 0c15039..bce79c7 100644 --- a/app/admin/controller/YunzeradminController.php +++ b/app/admin/controller/YunzeradminController.php @@ -1053,4 +1053,12 @@ class YunzeradminController extends Base } return json(['code' => 1, 'msg' => '请求方法无效']); } + + //获取推送内容Articles和Resources + //https://www.yunzer.cn/index/articles/detail?id=30 + //https://www.yunzer.cn/index/program/index?cateid=2 + //https://www.yunzer.cn/index/game/index?cateid=8 + //https://www.yunzer.cn/index/resources/detail?id=3 + + } \ No newline at end of file diff --git a/app/admin/view/resources/edit.php b/app/admin/view/resources/edit.php index 5ad9f4c..27bb18d 100644 --- a/app/admin/view/resources/edit.php +++ b/app/admin/view/resources/edit.php @@ -97,29 +97,41 @@
{if condition="isset($resource.images) && !empty($resource.images)"} - {if condition="strpos($resource.images, ',') !== false"} - {volist name="resource.images|explode=',',true" id="image"} -
- 已上传图片 -
- -
-

{$image|basename}

+
+ + + + + + + + + {php} + // 处理图片字符串,正确拆分逗号分隔的路径 + $imageArray = []; + if (isset($resource['images']) && !empty($resource['images'])) { + $imageArray = explode(',', $resource['images']); + $imageArray = array_map('trim', $imageArray); // 去除每个路径的前后空格 + $imageArray = array_filter($imageArray); // 过滤空值 + } + {/php} + {volist name="imageArray" id="image"} + + + + + {/volist} + +
缩略图操作
+
+ 缩略图 +
+
+ +
- {/volist} - {else} -
- 已上传图片 -
- -
-

{$resource.images|basename}

-
- {/if} {/if}
- +
@@ -685,6 +697,19 @@ updateImagesInput(); } }); + + // 图片预览功能 + window.previewImage = function(imageUrl) { + layer.photos({ + photos: { + "data": [{ + "src": imageUrl, + "alt": "图片预览" + }] + }, + anim: 5 + }); + }; }); @@ -820,4 +845,28 @@ .container-right { width: 65%; } + + /* 图片列表表格样式 */ + .image-list-table { + margin-top: 15px; + } + + .image-thumbnail { + width: 60px; + height: 60px; + border-radius: 4px; + overflow: hidden; + cursor: pointer; + transition: transform 0.2s; + } + + .image-thumbnail:hover { + transform: scale(1.05); + } + + .image-thumbnail img { + width: 100%; + height: 100%; + object-fit: cover; + } \ No newline at end of file diff --git a/app/index/view/component/main.php b/app/index/view/component/main.php index 77c5980..ac02e67 100644 --- a/app/index/view/component/main.php +++ b/app/index/view/component/main.php @@ -496,7 +496,7 @@ }); return ` -
+
@@ -576,7 +576,7 @@ if (!game) return ''; return ` -
+
diff --git a/app/index/view/resources/detail.php b/app/index/view/resources/detail.php index 8f94b60..8c58686 100644 --- a/app/index/view/resources/detail.php +++ b/app/index/view/resources/detail.php @@ -1,4 +1,9 @@ {include file="component/head" /} + + + + + {include file="component/header-simple" /}
@@ -24,8 +29,35 @@
- - +
+
+ {php} + // 兼容字符串和数组 + $images = isset($game['images']) ? $game['images'] : []; + if (is_string($images)) { + $images = explode(',', $images); + } + $images = array_filter($images); // 移除空值 + if (empty($images) && !empty($game['icon'])) { + $images = [$game['icon']]; + } + {/php} + {volist name="images" id="image"} +
+ + <?php echo $game['title']; ?> + +
+ {/volist} +
+
+
+
+
@@ -92,7 +124,7 @@
-这里放个人信息 + 这里放个人信息
@@ -135,7 +167,7 @@