From a763bfc84cc47df906e5f981a8841ebc04513405 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 29 Aug 2025 17:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/PresetController.php | 91 +++++++++++++++++++ app/common/logic/BrandLogic.php | 22 +++++ app/common/logic/BrandSeriesLogic.php | 22 +++++ app/common/logic/SysAccountLogic.php | 22 +++++ app/common/logic/SysDictItemLogic.php | 22 +++++ app/common/logic/SysDictLogic.php | 27 ++++++ app/common/logic/SysPortLogic.php | 22 +++++ app/common/logic/VehColorLogic.php | 22 +++++ app/common/logic/VehModificationLogic.php | 22 +++++ app/common/service/BrandSeriesService.php | 34 +++++++ app/common/service/BrandService.php | 24 +++++ app/common/service/SysAccountService.php | 28 ++++++ app/common/service/SysDictItemService.php | 42 +++++++++ app/common/service/SysDictService.php | 28 ++++++ app/common/service/SysPortService.php | 28 ++++++ app/common/service/VehColorService.php | 33 +++++++ app/common/service/VehModificationService.php | 28 ++++++ config/route.php | 8 ++ 18 files changed, 525 insertions(+) create mode 100644 app/common/logic/BrandLogic.php create mode 100644 app/common/logic/BrandSeriesLogic.php create mode 100644 app/common/logic/SysAccountLogic.php create mode 100644 app/common/logic/SysDictItemLogic.php create mode 100644 app/common/logic/SysDictLogic.php create mode 100644 app/common/logic/SysPortLogic.php create mode 100644 app/common/logic/VehColorLogic.php create mode 100644 app/common/logic/VehModificationLogic.php create mode 100644 app/common/service/BrandSeriesService.php create mode 100644 app/common/service/BrandService.php create mode 100644 app/common/service/SysAccountService.php create mode 100644 app/common/service/SysDictItemService.php create mode 100644 app/common/service/SysDictService.php create mode 100644 app/common/service/SysPortService.php create mode 100644 app/common/service/VehColorService.php create mode 100644 app/common/service/VehModificationService.php diff --git a/app/common/controller/PresetController.php b/app/common/controller/PresetController.php index afc24cb..0d3ebf1 100644 --- a/app/common/controller/PresetController.php +++ b/app/common/controller/PresetController.php @@ -3,7 +3,15 @@ namespace app\common\controller; use app\admin\service\RoleService; +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; use support\Request; use app\common\service\CorpService; use app\common\service\CorpFeishuAppService; @@ -87,6 +95,89 @@ class PresetController extends BaseController } } + 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() + { + try { + $result = (new SysPortService)->getList(); + 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()); + } + } + public function cacheClear() { diff --git a/app/common/logic/BrandLogic.php b/app/common/logic/BrandLogic.php new file mode 100644 index 0000000..3040572 --- /dev/null +++ b/app/common/logic/BrandLogic.php @@ -0,0 +1,22 @@ +orderBy('sort','desc')->get(['id', 'brand_code', 'brand_name', 'logo', 'description']); + } + +} \ No newline at end of file diff --git a/app/common/logic/BrandSeriesLogic.php b/app/common/logic/BrandSeriesLogic.php new file mode 100644 index 0000000..956ca55 --- /dev/null +++ b/app/common/logic/BrandSeriesLogic.php @@ -0,0 +1,22 @@ +where($where)->orderBy('sort','desc')->get(['id', 'series_code', 'series_name', 'description']); + } + +} \ No newline at end of file diff --git a/app/common/logic/SysAccountLogic.php b/app/common/logic/SysAccountLogic.php new file mode 100644 index 0000000..2f43410 --- /dev/null +++ b/app/common/logic/SysAccountLogic.php @@ -0,0 +1,22 @@ +orderBy('sort','desc')->get(['id', 'account_name', 'currency_id', 'account_number', 'bank_name', 'bank_branch', 'description']); + } + +} \ No newline at end of file diff --git a/app/common/logic/SysDictItemLogic.php b/app/common/logic/SysDictItemLogic.php new file mode 100644 index 0000000..d6efc72 --- /dev/null +++ b/app/common/logic/SysDictItemLogic.php @@ -0,0 +1,22 @@ +where($where)->orderBy('sort','desc')->get(['id', 'item_label', 'item_value', 'remark', 'dict_id']); + } + +} \ No newline at end of file diff --git a/app/common/logic/SysDictLogic.php b/app/common/logic/SysDictLogic.php new file mode 100644 index 0000000..6447ed3 --- /dev/null +++ b/app/common/logic/SysDictLogic.php @@ -0,0 +1,27 @@ +where('code', $code)->orderBy('sort','desc')->first(['id']); + } + + public function getList() + { + return SysDict::where('status', 1)->get(['id', 'dict_name', 'dict_code', 'description']); + } + +} \ No newline at end of file diff --git a/app/common/logic/SysPortLogic.php b/app/common/logic/SysPortLogic.php new file mode 100644 index 0000000..a2e78a8 --- /dev/null +++ b/app/common/logic/SysPortLogic.php @@ -0,0 +1,22 @@ +orderBy('sort','desc')->get(['id', 'port_code', 'port_name', 'country_id', 'description']); + } + +} \ No newline at end of file diff --git a/app/common/logic/VehColorLogic.php b/app/common/logic/VehColorLogic.php new file mode 100644 index 0000000..7a36811 --- /dev/null +++ b/app/common/logic/VehColorLogic.php @@ -0,0 +1,22 @@ +where($where)->orderBy('sort','desc')->get(['id', 'color_code', 'color_text']); + } + +} \ No newline at end of file diff --git a/app/common/logic/VehModificationLogic.php b/app/common/logic/VehModificationLogic.php new file mode 100644 index 0000000..3317235 --- /dev/null +++ b/app/common/logic/VehModificationLogic.php @@ -0,0 +1,22 @@ +orderBy('sort','desc')->get(['id', 'code', 'name', 'type', 'price']); + } + +} \ No newline at end of file diff --git a/app/common/service/BrandSeriesService.php b/app/common/service/BrandSeriesService.php new file mode 100644 index 0000000..ae91723 --- /dev/null +++ b/app/common/service/BrandSeriesService.php @@ -0,0 +1,34 @@ +logic = (new BrandSeriesLogic()); + } + + /** + * 获取系统list + */ + public function getList($params) + { + if (empty($params['brand_id'])) + throw new BusinessException('品牌id不能为空'); + $where = []; + if(isset($params['brand_id']) && $params['brand_id']) + $where[] = ['brand_id', '=', $params['brand_id']]; + return $this->logic->getList($where); + } +} \ No newline at end of file diff --git a/app/common/service/BrandService.php b/app/common/service/BrandService.php new file mode 100644 index 0000000..c3430fe --- /dev/null +++ b/app/common/service/BrandService.php @@ -0,0 +1,24 @@ +logic = (new BrandLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/app/common/service/SysAccountService.php b/app/common/service/SysAccountService.php new file mode 100644 index 0000000..b9c59ad --- /dev/null +++ b/app/common/service/SysAccountService.php @@ -0,0 +1,28 @@ +logic = (new SysAccountLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/app/common/service/SysDictItemService.php b/app/common/service/SysDictItemService.php new file mode 100644 index 0000000..c1e51ed --- /dev/null +++ b/app/common/service/SysDictItemService.php @@ -0,0 +1,42 @@ +logic = (new SysDictItemLogic()); + } + + /** + * 获取系统list + */ + public function getList($params) + { + if (empty($params['dict_id']) && empty($params['dict_code'])) + throw new BusinessException('未明确要查询的字典组'); + $where = []; + if(isset($params['dict_id']) && $params['dict_id']) + $where[] = ['dict_id', '=', $params['dict_id']]; + if(isset($params['dict_code']) && $params['dict_code']){ + $dict = (new SysDictLogic)->getDictByCode($params['dict_code']); + if (empty($dict['id'])) + throw new BusinessException('字典组code错误'); + $where[] = ['dict_id', '=', $dict['id']]; + } + + return $this->logic->getList($where); + } +} \ No newline at end of file diff --git a/app/common/service/SysDictService.php b/app/common/service/SysDictService.php new file mode 100644 index 0000000..57ab33c --- /dev/null +++ b/app/common/service/SysDictService.php @@ -0,0 +1,28 @@ +logic = (new SysDictLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/app/common/service/SysPortService.php b/app/common/service/SysPortService.php new file mode 100644 index 0000000..2918a96 --- /dev/null +++ b/app/common/service/SysPortService.php @@ -0,0 +1,28 @@ +logic = (new SysPortLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/app/common/service/VehColorService.php b/app/common/service/VehColorService.php new file mode 100644 index 0000000..2060efe --- /dev/null +++ b/app/common/service/VehColorService.php @@ -0,0 +1,33 @@ +logic = (new VehColorLogic()); + } + + /** + * 获取系统list + */ + public function getList($params) + { + if (empty($params['type'])) + throw new BusinessException('类型不能为空'); + $where = []; + if(isset($params['type']) && $params['type']) + $where[] = ['type', '=', $params['type']]; + return $this->logic->getList($where); + } +} \ No newline at end of file diff --git a/app/common/service/VehModificationService.php b/app/common/service/VehModificationService.php new file mode 100644 index 0000000..31c7119 --- /dev/null +++ b/app/common/service/VehModificationService.php @@ -0,0 +1,28 @@ +logic = (new VehModificationLogic()); + } + + /** + * 获取系统list + */ + public function getList() + { + return $this->logic->getList(); + } +} \ No newline at end of file diff --git a/config/route.php b/config/route.php index c5eba9a..c1fcfc1 100644 --- a/config/route.php +++ b/config/route.php @@ -64,6 +64,14 @@ Route::group('/common', function () { Route::any('/currency', [app\common\controller\PresetController::class, 'currency']); Route::any('/cache/clear', [app\common\controller\PresetController::class, 'cacheClear']); Route::any('/menus', [app\common\controller\PresetController::class, 'menus']); + Route::any('/brand', [app\common\controller\PresetController::class, 'brand']); + Route::any('/brand/series', [app\common\controller\PresetController::class, 'series']); + Route::any('/account', [app\common\controller\PresetController::class, 'account']); + Route::any('/dict', [app\common\controller\PresetController::class, 'dict']); + Route::any('/dictItem', [app\common\controller\PresetController::class, 'dictItem']); + Route::any('/port', [app\common\controller\PresetController::class, 'port']); + Route::any('/color', [app\common\controller\PresetController::class, 'color']); + Route::any('/modification', [app\common\controller\PresetController::class, 'modification']); });