From cbb07d1f4c8ae428e7d080468530ec33d1016f42 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 12 Sep 2025 14:25:02 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B1=BD=E8=BD=A6=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/VehColorService.php | 20 +++++++ app/common/controller/VehColorController.php | 56 ++++++++++++++++++++ app/common/model/VehColor.php | 2 +- config/route.php | 9 ++++ 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 app/common/controller/VehColorController.php diff --git a/app/admin/service/VehColorService.php b/app/admin/service/VehColorService.php index a701ef4..acc5309 100644 --- a/app/admin/service/VehColorService.php +++ b/app/admin/service/VehColorService.php @@ -5,6 +5,7 @@ namespace app\admin\service; use app\admin\validate\VehColorValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\VehColor; +use support\Request; class VehColorService { @@ -28,4 +29,23 @@ class VehColorService { return new $this->validator; } + + /** + * 添加前置处理 + */ + public function beforeServiceStore($data, Request $request) + { + $data['created_by'] = $request->user->uid; + $data['updated_by'] = $request->user->uid; + return $data; + } + + /** + * 添加前置处理 + */ + public function beforeServiceUpdate($data, Request $request) + { + $data['updated_by'] = $request->user->uid; + return $data; + } } \ No newline at end of file diff --git a/app/common/controller/VehColorController.php b/app/common/controller/VehColorController.php new file mode 100644 index 0000000..4473c44 --- /dev/null +++ b/app/common/controller/VehColorController.php @@ -0,0 +1,56 @@ +service = new VehColorService(); + } + + /** + * 列表页数据格式化 + * + * @param array $data + * @return array + */ + protected function indexFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + if (isset($data['created_by']) && $data['created_by']) + $data['created_by_name'] = User::where('id', $data['created_by'])->value('name'); + if (isset($data['updated_by']) && $data['updated_by']) + $data['updated_by_name'] = User::where('id', $data['updated_by'])->value('name'); + return $data; + } + + /** + * 数据格式化 + * + * @param array $data + * @return array + */ + protected function showFormat($data) + { + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + if (isset($data['created_by']) && $data['created_by']) + $data['created_by_name'] = User::where('id', $data['created_by'])->value('name'); + if (isset($data['updated_by']) && $data['updated_by']) + $data['updated_by_name'] = User::where('id', $data['updated_by'])->value('name'); + return $data; + } +} \ No newline at end of file diff --git a/app/common/model/VehColor.php b/app/common/model/VehColor.php index 9554aa5..ee7220a 100644 --- a/app/common/model/VehColor.php +++ b/app/common/model/VehColor.php @@ -40,7 +40,7 @@ class VehColor extends Model /** * 允许自动填充模型字段 */ - protected $fillable = ['id', 'color_code', 'color_text', 'type', 'hex_code', 'rgb_code', 'status', 'sort', 'created_at', 'updated_at']; + protected $fillable = ['id', 'color_code', 'color_text', 'type', 'hex_code', 'rgb_code', 'status', 'sort', 'created_at', 'updated_by', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 diff --git a/config/route.php b/config/route.php index 69c2d56..cc117fd 100644 --- a/config/route.php +++ b/config/route.php @@ -87,6 +87,15 @@ Route::group('/common', function () { Route::any('/unread', [app\common\controller\MessageUserStatusController::class, 'listUnRead']); }); + + // 汽车颜色 + Route::group('/color', function () { + Route::any('/list', [app\common\controller\VehColorController::class, 'index']); + Route::any('/show', [app\common\controller\VehColorController::class, 'show']); + Route::any('/store', [app\common\controller\VehColorController::class, 'store']); + Route::any('/update', [app\common\controller\VehColorController::class, 'update']); + Route::any('/destroy', [app\common\controller\VehColorController::class, 'destroy']); + }); }); // 后台管理 From 3ad05165bd5479c92f05ed32a074d2d8ff9c3178 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 12 Sep 2025 14:49:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B4=A6=E6=88=B7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=BD=92=E5=B1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/SysAccountController.php | 9 +++++++-- app/admin/validate/SysAccountValidate.php | 10 ++++++---- app/common/model/SysAccount.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/admin/controller/SysAccountController.php b/app/admin/controller/SysAccountController.php index aa4b132..9343a84 100644 --- a/app/admin/controller/SysAccountController.php +++ b/app/admin/controller/SysAccountController.php @@ -2,6 +2,7 @@ namespace app\admin\controller; use app\common\controller\BaseController; +use app\common\model\Corp; use app\common\model\SysCurrency; use app\common\traits\crud\CrudControllerTrait; use app\admin\service\SysAccountService; @@ -30,8 +31,10 @@ class SysAccountController extends BaseController $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); - if (isset($data['currency_name'])) + if (isset($data['currency_id']) && $data['currency_id']) $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name'); + if (isset($data['corp_id']) && $data['corp_id']) + $data['corp_name'] = Corp::where('id', $data['corp_id'])->value('name'); return $data; } @@ -47,8 +50,10 @@ class SysAccountController extends BaseController $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); if (isset($data['updated_at'])) $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); - if (isset($data['currency_name'])) + if (isset($data['currency_id'])) $data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name'); + if (isset($data['corp_id']) && $data['corp_id']) + $data['corp_name'] = Corp::where('id', $data['corp_id'])->value('name'); return $data; } } \ No newline at end of file diff --git a/app/admin/validate/SysAccountValidate.php b/app/admin/validate/SysAccountValidate.php index 65cc1d7..093ebb1 100644 --- a/app/admin/validate/SysAccountValidate.php +++ b/app/admin/validate/SysAccountValidate.php @@ -8,22 +8,24 @@ class SysAccountValidate extends Validate { // 规则 protected $rule = [ - + 'corp_id' => 'require|integer|gt:0', ]; // 提示 protected $message = [ - + 'corp_id.require' => 'ID不能为空', + 'corp_id.integer' => 'ID必须是整数', + 'corp_id.gt' => 'ID必须大于0', ]; // 场景 protected $scene = [ 'store' => [ - + 'corp_id' ], 'update' => [ - + 'corp_id' ] ]; } \ No newline at end of file diff --git a/app/common/model/SysAccount.php b/app/common/model/SysAccount.php index 693e823..92d660b 100644 --- a/app/common/model/SysAccount.php +++ b/app/common/model/SysAccount.php @@ -40,7 +40,7 @@ class SysAccount extends Model /** * 允许自动填充模型字段 */ - protected $fillable = ['id', 'currency_id', 'account_name', 'account_number', 'account_holder', 'bank_name', 'bank_branch', 'daily_limit', 'single_limit', 'description', 'status', 'sort', 'created_at', 'updated_at']; + protected $fillable = ['id', 'corp_id', 'currency_id', 'account_name', 'account_number', 'account_holder', 'bank_name', 'bank_branch', 'daily_limit', 'single_limit', 'description', 'status', 'sort', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 From 59b64c4f3c63a5c5d511324e84c54740cbdfb5eb Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 12 Sep 2025 15:16:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=B8=8E=E8=BD=A6=E8=BE=86=E9=A2=9C=E8=89=B2=E6=94=BE=E5=88=B0?= =?UTF-8?q?crm=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/config/route.php b/config/route.php index 7f97d12..54e9afb 100644 --- a/config/route.php +++ b/config/route.php @@ -87,15 +87,6 @@ Route::group('/common', function () { Route::any('/unread', [app\common\controller\MessageUserStatusController::class, 'listUnRead']); }); - - // 汽车颜色 - Route::group('/color', function () { - Route::any('/list', [app\common\controller\VehColorController::class, 'index']); - Route::any('/show', [app\common\controller\VehColorController::class, 'show']); - Route::any('/store', [app\common\controller\VehColorController::class, 'store']); - Route::any('/update', [app\common\controller\VehColorController::class, 'update']); - Route::any('/destroy', [app\common\controller\VehColorController::class, 'destroy']); - }); }); // 后台管理 @@ -404,4 +395,25 @@ Route::group('/crm', function () { Route::any('/logs', [app\crm\controller\ApprovalRecordsController::class, 'logs']); Route::any('/action', [app\crm\controller\ApprovalRecordsController::class, 'approve']); }); + + // 汽车颜色 + Route::group('/color', function () { + Route::any('/list', [app\common\controller\VehColorController::class, 'index']); + Route::any('/show', [app\common\controller\VehColorController::class, 'show']); + Route::any('/store', [app\common\controller\VehColorController::class, 'store']); + Route::any('/update', [app\common\controller\VehColorController::class, 'update']); + Route::any('/destroy', [app\common\controller\VehColorController::class, 'destroy']); + }); + + // 车辆 + Route::group('/vehicle', function () { + // 基础信息 + Route::group('/sku', function () { + Route::any('/list', [app\common\controller\VehVehicleSkuController::class, 'index']); + Route::any('/show', [app\common\controller\VehVehicleSkuController::class, 'show']); + Route::any('/store', [app\common\controller\VehVehicleSkuController::class, 'store']); + Route::any('/update', [app\common\controller\VehVehicleSkuController::class, 'update']); + Route::any('/destroy', [app\common\controller\VehVehicleSkuController::class, 'destroy']); + }); + }); }); \ No newline at end of file