Finish mzl_dev_curd
This commit is contained in:
@@ -5,11 +5,14 @@ namespace app\common\controller;
|
||||
use support\Request;
|
||||
use app\common\service\CorpService;
|
||||
use app\common\service\CorpFeishuAppService;
|
||||
use app\common\service\SystemsService;
|
||||
|
||||
class PresetController extends BaseController
|
||||
{
|
||||
|
||||
protected $noNeedLogin = ['corps', 'feishuApp'];
|
||||
protected $noNeedLogin = ['corps', 'feishuApp', 'systems'];
|
||||
|
||||
protected $noNeedHeaderData = ['corps', 'feishuApp', 'systems'];
|
||||
|
||||
public function corps()
|
||||
{
|
||||
@@ -33,4 +36,16 @@ class PresetController extends BaseController
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function systems()
|
||||
{
|
||||
try {
|
||||
$result = (new SystemsService())->getList();
|
||||
return $this->success($result, '获取系统列表');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\model\Systems;
|
||||
|
||||
class SystemsLogic
|
||||
{
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return Systems::where('status', 1)->orderBy('sort', 'asc')->get(['id', 'name', 'code', 'icon', 'type']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\logic\SystemsLogic;
|
||||
|
||||
class SystemsService
|
||||
{
|
||||
|
||||
protected $logic;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->logic = (new SystemsLogic());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统list
|
||||
*/
|
||||
public function getList()
|
||||
{
|
||||
return $this->logic->getList();
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@ Route::group('/common', function () {
|
||||
Route::group('/preset', function () {
|
||||
Route::any('/corps', [app\common\controller\PresetController::class, 'corps']);
|
||||
Route::any('/feishu/app', [app\common\controller\PresetController::class, 'feishuApp']);
|
||||
Route::any('/systems', [app\common\controller\PresetController::class, 'systems']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user