diff --git a/application/index/controller/Install.php b/application/index/controller/Install.php index 67602355..e8a49b18 100644 --- a/application/index/controller/Install.php +++ b/application/index/controller/Install.php @@ -242,9 +242,12 @@ EOT; } } - if (!$mysqli->multi_query($file)) { - throw new Exception('数据写入失败'); + foreach (explode(';', $file) as $item) { + if ($item && !$mysqli->query($item . ';')) { + throw new Exception('数据写入失败'); + } } + $mysqli->commit(); $mysqli->autocommit(true); $mysqli->close(); diff --git a/application/index/controller/admin/Images.php b/application/index/controller/admin/Images.php index 5428c124..05924148 100644 --- a/application/index/controller/admin/Images.php +++ b/application/index/controller/admin/Images.php @@ -48,7 +48,7 @@ class Images extends Base ] ])->each(function ($item) { $item->username = Users::where('id', $item->user_id)->value('username'); - $item->strategyStr = $this->strategyList[$item->strategy]['name']; + $item->strategyStr = isset($this->strategyList[$item->strategy]) ? $this->strategyList[$item->strategy]['name'] : '未知'; return $item; }); $this->assign([