mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
修改获取接口
This commit is contained in:
parent
a89d90e81e
commit
ba1a6e593e
@ -13,6 +13,7 @@ namespace app\adminapi\controller\v1\setting;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\services\system\SystemMenusServices;
|
||||
use app\services\system\SystemRouteServices;
|
||||
use think\facade\App;
|
||||
use think\facade\Route;
|
||||
|
||||
@ -254,25 +255,14 @@ class SystemMenus extends AuthController
|
||||
public function ruleList()
|
||||
{
|
||||
//获取所有的路由
|
||||
$this->app = app();
|
||||
$this->app->route->setTestMode(true);
|
||||
$this->app->route->clear();
|
||||
$path = $this->app->getRootPath() . 'app' . DS . 'adminapi' . DS . 'route' . DS;
|
||||
$files = is_dir($path) ? scandir($path) : [];
|
||||
foreach ($files as $file) {
|
||||
if (strpos($file, '.php')) {
|
||||
include $path . $file;
|
||||
}
|
||||
}
|
||||
$ruleList = $this->app->route->getRuleList();
|
||||
$ruleList = app()->make(SystemRouteServices::class)->selectList(['app_name' => 'adminapi'], 'name,path,method,type');
|
||||
$menuApiList = $this->services->getColumn(['auth_type' => 2, 'is_del' => 0], "concat(`api_url`,'_',lower(`methods`)) as rule");
|
||||
if ($menuApiList) $menuApiList = array_column($menuApiList, 'rule');
|
||||
$list = [];
|
||||
foreach ($ruleList as $item) {
|
||||
$item['rule'] = str_replace('adminapi/', '', $item['rule']);
|
||||
if (!in_array($item['rule'] . '_' . $item['method'], $menuApiList)) {
|
||||
$item['real_name'] = $item['option']['real_name'] ?? '';
|
||||
unset($item['option']);
|
||||
$item['path'] = str_replace('adminapi/', '', $item['path']);
|
||||
if (!in_array($item['path'] . '_' . $item['method'], $menuApiList)) {
|
||||
$item['real_name'] = $item['name'] ?? '';
|
||||
$item['method'] = strtoupper($item['method']);
|
||||
$list[] = $item;
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ use think\Model;
|
||||
* @method mixed delete($id, ?string $key = null) 删除
|
||||
* @method mixed save(array $data) 保存数据
|
||||
* @method mixed saveAll(array $data) 批量保存数据
|
||||
* @method Model selectList(array $where, string $field = '*', int $page = 0, int $limit = 0, string $order = '', array $with = [], bool $search = false) 获取列表
|
||||
* @method bool bcInc($key, string $incField, string $inc, string $keyField = null, int $acc = 2) 高精度加法
|
||||
* @method bool bcDec($key, string $decField, string $dec, string $keyField = null, int $acc = 2) 高精度 减法
|
||||
* @method mixed decStockIncSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 减库存加销量
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user