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']); } } }