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\Base\CatchController;
|
||||||
use Catch\CatchAdmin;
|
use Catch\CatchAdmin;
|
||||||
|
use Catch\Contracts\ModuleRepositoryInterface;
|
||||||
|
use Catch\Exceptions\FailedException;
|
||||||
use Catch\Support\Module\ModuleRepository;
|
use Catch\Support\Module\ModuleRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -97,10 +99,15 @@ class ModuleController extends CatchController
|
|||||||
* install
|
* install
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
|
* @param ModuleRepositoryInterface $moduleRepository
|
||||||
* @return true
|
* @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 = new ModuleInstall($request->get('type'));
|
||||||
|
|
||||||
$moduleInstall->install($request->all());
|
$moduleInstall->install($request->all());
|
||||||
|
@ -51,7 +51,7 @@ class ModuleInstall
|
|||||||
|
|
||||||
$installer->install();
|
$installer->install();
|
||||||
} catch (\Exception|\Throwable $e) {
|
} catch (\Exception|\Throwable $e) {
|
||||||
CatchAdmin::deleteModulePath($title);
|
// CatchAdmin::deleteModulePath($title);
|
||||||
|
|
||||||
throw new FailedException('安装失败: ' . $e->getMessage());
|
throw new FailedException('安装失败: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,6 @@ onMounted(() => {
|
|||||||
onEnd({ newIndex, oldIndex }) {
|
onEnd({ newIndex, oldIndex }) {
|
||||||
const newStructures = []
|
const newStructures = []
|
||||||
const s = structures.splice(oldIndex, newIndex - oldIndex)
|
const s = structures.splice(oldIndex, newIndex - oldIndex)
|
||||||
console.log(s, structures, oldIndex, newIndex)
|
|
||||||
s.concat(structures).forEach(item => {
|
s.concat(structures).forEach(item => {
|
||||||
newStructures.push(item)
|
newStructures.push(item)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user