Merge branch 'develop_bm' into feature/mzl_dev

# Conflicts:
#	app/controller/IndexController.php
#	config/route.php
This commit is contained in:
mzl
2025-09-01 14:06:34 +08:00
parent 29f573a467
commit b3d8029e6d
69 changed files with 3283 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
<?php
namespace app\admin\service;
use app\admin\validate\BrandSeriesValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\BrandSeries;
use support\Request;
class BrandSeriesService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = BrandSeries::class;
/**
* 验证器
*/
protected $validator = BrandSeriesValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
$config['where']['brand_id'] = $p['brand_id'];
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['series_code','series_name'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
//$config['where']['status'] = 1;
break;
case 'show':
$config['where']['id'] = $p['id'];
//$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}
+79
View File
@@ -0,0 +1,79 @@
<?php
namespace app\admin\service;
use app\admin\validate\BrandValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\Brand;
use support\Request;
class BrandService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = Brand::class;
/**
* 验证器
*/
protected $validator = BrandValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['brand_code','brand_name'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
//$config['where']['status'] = 1;
break;
case 'show':
$config['where']['id'] = $p['id'];
//$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}
+82
View File
@@ -0,0 +1,82 @@
<?php
namespace app\admin\service;
use app\admin\validate\SysAccountValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\SysAccount;
use support\Request;
class SysAccountService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = SysAccount::class;
/**
* 验证器
*/
protected $validator = SysAccountValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 状态
if (isset($p['type']) && $p['type']) {
$config['where']['type'] = $p['type'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['account_name','account_number','bank_name','bank_branch','description'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
//$config['where']['status'] = 1;
break;
case 'show':
$config['where']['id'] = $p['id'];
//$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace app\admin\service;
use app\admin\validate\SysCurrencyValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\SysCurrency;
use support\Request;
class SysCurrencyService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = SysCurrency::class;
/**
* 验证器
*/
protected $validator = SysCurrencyValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构造 CrudUtil 查询配置
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'default':
$config['order']['id'] = 'desc';
case 'index':
break;
case 'show':
$config['where']['id'] = $p['id'];
break;
case 'store':
break;
case 'update':
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace app\admin\service;
use app\admin\validate\SysDictItemValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\SysDictItem;
use support\Request;
class SysDictItemService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = SysDictItem::class;
/**
* 验证器
*/
protected $validator = SysDictItemValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
// ====== ====== 筛选 ====== ======
$config['where']['dict_id'] = $p['id'];
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['item_label','item_value','remark'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
break;
case 'show':
$config['where']['id'] = $p['id'];
break;
case 'update':
case 'destroy':
$config['where']['id'] = $p['id'];
break;
case 'store':
break;
}
return $config;
}
}
+81
View File
@@ -0,0 +1,81 @@
<?php
namespace app\admin\service;
use app\admin\validate\SysDictValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\SysDict;
use support\Request;
class SysDictService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = SysDict::class;
/**
* 验证器
*/
protected $validator = SysDictValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['dict_name','dict_code','description'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
// ====== ====== 关联 ====== ======
$config['with']['sysDictItem'][] = 'item_label';
$config['with']['sysDictItem'][] = 'item_value';
break;
case 'show':
$config['where']['id'] = $p['id'];
// ====== ====== 关联 ====== ======
$config['with']['sysDictItem'][] = 'item_label';
$config['with']['sysDictItem'][] = 'item_value';
break;
case 'update':
case 'destroy':
$config['where']['id'] = $p['id'];
break;
case 'store':
break;
}
return $config;
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php
namespace app\admin\service;
use app\admin\validate\SysPortValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\SysPort;
use support\Request;
class SysPortService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = SysPort::class;
/**
* 验证器
*/
protected $validator = SysPortValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['port_code','port_name'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
//$config['where']['status'] = 1;
break;
case 'show':
$config['where']['id'] = $p['id'];
//$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
/**
* 添加前置处理
*/
public function beforeServiceStore($data, Request $request)
{
if(empty($data['lat']))
unset($data['lat']);
if(empty($data['lng']))
unset($data['lng']);
return $data;
}
/**
* 添加前置处理
*/
public function beforeServiceUpdate($data, Request $request)
{
if(empty($data['lat']))
unset($data['lat']);
if(empty($data['lng']))
unset($data['lng']);
return $data;
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace app\admin\service;
use app\admin\validate\VehColorValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\VehColor;
class VehColorService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = VehColor::class;
/**
* 验证器
*/
protected $validator = VehColorValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
}
@@ -0,0 +1,83 @@
<?php
namespace app\admin\service;
use app\admin\validate\VehModificationValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\VehModification;
use support\Request;
class VehModificationService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = VehModification::class;
/**
* 验证器
*/
protected $validator = VehModificationValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
/**
* 构建查询条件
*/
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'index':
// ====== ====== 排序 ====== ======
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
// ====== ====== 筛选 ====== ======
// 状态
if (isset($p['status']) && in_array($p['status'], [0,1])) {
$config['where']['status'] = $p['status'];
}
// 状态
if (isset($p['type']) && $p['type']) {
$config['where']['type'] = $p['type'];
}
// 关键字
if (isset($p['keyword']) && $p['keyword']) {
$k = '%' . $p['keyword'] . '%';
foreach (['code','name'] as $col) {
$config['orWhere'][] = [$col, 'like', $k];
}
}
//$config['where']['status'] = 1;
break;
case 'show':
$config['where']['id'] = $p['id'];
//$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
}
return $config;
}
}