2025-07-17 10:42:43 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\common\controller;
|
|
|
|
|
|
2025-08-14 20:08:57 +08:00
|
|
|
use app\admin\service\RoleService;
|
2025-09-16 10:53:57 +08:00
|
|
|
use app\common\service\BrandSeriesService;
|
|
|
|
|
use app\common\service\BrandService;
|
|
|
|
|
use app\common\service\SysAccountService;
|
|
|
|
|
use app\common\service\SysCurrencyService;
|
|
|
|
|
use app\common\service\SysDictItemService;
|
|
|
|
|
use app\common\service\SysDictService;
|
|
|
|
|
use app\common\service\SysPortService;
|
|
|
|
|
use app\common\service\VehColorService;
|
|
|
|
|
use app\common\service\VehModificationService;
|
2025-07-17 10:42:43 +08:00
|
|
|
use support\Request;
|
|
|
|
|
use app\common\service\CorpService;
|
|
|
|
|
use app\common\service\CorpFeishuAppService;
|
2025-07-21 16:58:22 +08:00
|
|
|
use app\common\service\SystemsService;
|
2025-07-23 17:06:48 +08:00
|
|
|
use app\common\service\UserService;
|
2025-08-14 20:08:57 +08:00
|
|
|
use support\Cache;
|
|
|
|
|
use app\common\service\PermService;
|
2025-07-17 10:42:43 +08:00
|
|
|
|
|
|
|
|
class PresetController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
|
2025-07-21 16:58:22 +08:00
|
|
|
protected $noNeedLogin = ['corps', 'feishuApp', 'systems'];
|
|
|
|
|
|
|
|
|
|
protected $noNeedHeaderData = ['corps', 'feishuApp', 'systems'];
|
2025-07-17 10:42:43 +08:00
|
|
|
|
|
|
|
|
public function corps()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new CorpService())->getList();
|
|
|
|
|
return $this->success($result, '获取公司列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function feishuApp(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$corpId = $request->get('corp_id');
|
2025-07-25 16:10:59 +08:00
|
|
|
$systemId = $request->get('system_id');
|
|
|
|
|
$result = (new CorpFeishuAppService())->getFeishuApp($corpId, $systemId);
|
2025-07-17 10:42:43 +08:00
|
|
|
return $this->success($result, '获取飞书应用信息');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-21 16:58:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function systems()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new SystemsService())->getList();
|
|
|
|
|
return $this->success($result, '获取系统列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-23 17:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public function users()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new UserService())->getList();
|
|
|
|
|
return $this->success($result, '获取用户列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-08-14 20:08:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public function roles()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new RoleService)->getList();
|
|
|
|
|
return $this->success($result, '获取角色列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-16 10:53:57 +08:00
|
|
|
public function currency()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new SysCurrencyService)->getList();
|
|
|
|
|
return $this->success($result, '获取货币列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function brand()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new BrandService)->getList();
|
|
|
|
|
return $this->success($result, '获取品牌列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function series(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$params = $request->all();
|
|
|
|
|
$result = (new BrandSeriesService)->getList($params);
|
|
|
|
|
return $this->success($result, '获取车系列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function account()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new SysAccountService)->getList();
|
|
|
|
|
return $this->success($result, '获取账号列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dict()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new SysDictService)->getList();
|
|
|
|
|
return $this->success($result, '获取字典列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function dictItem(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$params = $request->all();
|
|
|
|
|
$result = (new SysDictItemService)->getList($params);
|
|
|
|
|
return $this->success($result, '获取字典项列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function port(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$params = $request->all();
|
|
|
|
|
$result = (new SysPortService)->getList($params);
|
|
|
|
|
return $this->success($result, '获取港口列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function color(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$params = $request->all();
|
|
|
|
|
$result = (new VehColorService)->getList($params);
|
|
|
|
|
return $this->success($result, '获取颜色列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function modification()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$result = (new VehModificationService)->getList();
|
|
|
|
|
return $this->success($result, '获取货币列表');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-14 20:08:57 +08:00
|
|
|
|
|
|
|
|
public function cacheClear()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
Cache::clear();
|
|
|
|
|
return $this->success([], '操作成功');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function menus(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$uid = $request->user->uid;
|
|
|
|
|
$systemCode = $request->system_code;
|
|
|
|
|
$permService = new PermService();
|
|
|
|
|
$menuTree = $permService->getMenuTree($uid, $systemCode);
|
|
|
|
|
$permissionCodes = $permService->getPermissionCodes($uid, $systemCode);
|
|
|
|
|
$result = [
|
|
|
|
|
'menu' => $menuTree,
|
|
|
|
|
'permissions' => $permissionCodes
|
|
|
|
|
];
|
|
|
|
|
return $this->success($result, '获取菜单权限');
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-17 10:42:43 +08:00
|
|
|
}
|