From ef3295165bf32f138e8b979452666ad9634b3a38 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Mon, 23 Sep 2024 17:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/BusinessSchoolLogic.php | 9 +++++- .../view/business_school/edit_content.html | 28 ++++++++----------- app/api/logic/BusinessSchoolLogic.php | 5 ++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/admin/logic/BusinessSchoolLogic.php b/app/admin/logic/BusinessSchoolLogic.php index f7993931..b033603b 100644 --- a/app/admin/logic/BusinessSchoolLogic.php +++ b/app/admin/logic/BusinessSchoolLogic.php @@ -155,7 +155,14 @@ class BusinessSchoolLogic extends Logic public static function detail_content($id) { $res = BusinessSchool::field(true)->findOrEmpty($id)->toArray(); - $res['file'] = BusinessSchoolFile::where('bsid', $id)->select()->toArray(); + $file = BusinessSchoolFile::where('bsid', $id)->select()->toArray(); + foreach ($file as &$v) { + if ($v['type'] == 1) { + $res['image'][] = $v['src']; + } else if($v['type'] == 2) { + $res['file'][] = $v['src']; + } + } return $res; } diff --git a/app/admin/view/business_school/edit_content.html b/app/admin/view/business_school/edit_content.html index fc8f633e..ac6a6578 100755 --- a/app/admin/view/business_school/edit_content.html +++ b/app/admin/view/business_school/edit_content.html @@ -75,15 +75,13 @@
- {if !empty($detail.file)} - {foreach $detail.file as $val} - {if $val.type == 1} -
- img - -
x
-
- {/if} + {if !empty($detail.image)} + {foreach $detail.image as $val} +
+ img + +
x
+
{/foreach} {/if} @@ -99,13 +97,11 @@
{if !empty($detail.file)} {foreach $detail.file as $val} - {if $val.type == 2} - - {/if} +
+ {$val|basename} + +
x
+
{/foreach} {/if}
diff --git a/app/api/logic/BusinessSchoolLogic.php b/app/api/logic/BusinessSchoolLogic.php index 0ac5e693..6e6593c2 100644 --- a/app/api/logic/BusinessSchoolLogic.php +++ b/app/api/logic/BusinessSchoolLogic.php @@ -83,12 +83,13 @@ class BusinessSchoolLogic extends Logic $article = []; }else{ $article = $article->toArray(); - $file = BusinessSchoolFile::where('bsid', $id)->select()->toArray(); + $file = BusinessSchoolFile::where('bsid', $id)->select()->toArray(); foreach ($file as &$v) { if ($v['type'] == 1) { $article['image'][] = $v['src']; } else if($v['type'] == 2) { - $article['file'][] = $v['src']; + $article['file']['src'] = $v['src']; + $article['file']['name'] = basename($v['src']); } } }