feat: 增加模块已安装判断
This commit is contained in:
parent
b2408075c5
commit
4e104961d2
@ -4,6 +4,8 @@ namespace Modules\Develop\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController;
|
||||
use Catch\CatchAdmin;
|
||||
use Catch\Contracts\ModuleRepositoryInterface;
|
||||
use Catch\Exceptions\FailedException;
|
||||
use Catch\Support\Module\ModuleRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
@ -97,10 +99,15 @@ class ModuleController extends CatchController
|
||||
* install
|
||||
*
|
||||
* @param Request $request
|
||||
* @param ModuleRepositoryInterface $moduleRepository
|
||||
* @return true
|
||||
*/
|
||||
public function install(Request $request)
|
||||
public function install(Request $request, ModuleRepositoryInterface $moduleRepository)
|
||||
{
|
||||
if ($moduleRepository->all()->pluck('name')->contains($request->get('title'))) {
|
||||
throw new FailedException('模块已安装,无法再次安装');
|
||||
}
|
||||
|
||||
$moduleInstall = new ModuleInstall($request->get('type'));
|
||||
|
||||
$moduleInstall->install($request->all());
|
||||
|
@ -51,7 +51,7 @@ class ModuleInstall
|
||||
|
||||
$installer->install();
|
||||
} catch (\Exception|\Throwable $e) {
|
||||
CatchAdmin::deleteModulePath($title);
|
||||
// CatchAdmin::deleteModulePath($title);
|
||||
|
||||
throw new FailedException('安装失败: ' . $e->getMessage());
|
||||
}
|
||||
|
@ -129,7 +129,6 @@ onMounted(() => {
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const newStructures = []
|
||||
const s = structures.splice(oldIndex, newIndex - oldIndex)
|
||||
console.log(s, structures, oldIndex, newIndex)
|
||||
s.concat(structures).forEach(item => {
|
||||
newStructures.push(item)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user