From 3415f756733ba6991df2162dfb3428a62358e98f Mon Sep 17 00:00:00 2001 From: Aether Date: Thu, 9 Oct 2025 14:01:58 +0800 Subject: [PATCH] .. --- .env | 2 +- app/Exception/CampusNotFound.php | 2 +- app/Exception/TeacherNotFound.php | 5 +++-- app/JsonRpc/Service/DataService.php | 2 +- app/Model/Campus.php | 4 ++-- composer.lock | 8 ++++---- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.env b/.env index 17d1a18..5270587 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ APP_NAME=hyperf-data -APP_ENV=dev +APP_ENV=prod DB_DRIVER=mysql DB_HOST=localhost diff --git a/app/Exception/CampusNotFound.php b/app/Exception/CampusNotFound.php index 2472bc9..4574460 100644 --- a/app/Exception/CampusNotFound.php +++ b/app/Exception/CampusNotFound.php @@ -7,5 +7,5 @@ use Aether\Exception\AetherException; class CampusNotFound extends AetherException { protected $code = 404001; - protected $message = '文章不存在'; + protected $message = '校区不存在或已禁用'; } \ No newline at end of file diff --git a/app/Exception/TeacherNotFound.php b/app/Exception/TeacherNotFound.php index 2d33fe1..b4a0ba1 100644 --- a/app/Exception/TeacherNotFound.php +++ b/app/Exception/TeacherNotFound.php @@ -8,7 +8,8 @@ use Aether\Exception\AetherException; class TeacherNotFound extends AetherException { - protected $code = 40400; + protected $code = 140401; + + protected $message = '教师不存在或已禁用'; - protected $message = '教师不存在'; } diff --git a/app/JsonRpc/Service/DataService.php b/app/JsonRpc/Service/DataService.php index b7931c9..bf26f0c 100644 --- a/app/JsonRpc/Service/DataService.php +++ b/app/JsonRpc/Service/DataService.php @@ -47,7 +47,7 @@ class DataService implements DataServiceInterface { $campus = $this->campusModel->find($id); if (! $campus || $campus->status != 1) { - throw new CampusNotFound('校区不存在或已禁用'); + throw new CampusNotFound(9999, 'Campus not found', ['id' => $id]); } return $campus->toArray(); } diff --git a/app/Model/Campus.php b/app/Model/Campus.php index 2cc3735..cee9dca 100644 --- a/app/Model/Campus.php +++ b/app/Model/Campus.php @@ -83,7 +83,7 @@ class Campus extends AetherModel */ public function scopeProvince(Builder $query, string $province): Builder { - return $query->where('province', $province); + return $query->where('province', 'like', '%' . $province . '%'); } /** @@ -91,7 +91,7 @@ class Campus extends AetherModel */ public function scopeCity(Builder $query, string $city): Builder { - return $query->where('city', $city); + return $query->where('city', 'like', '%' . $city . '%'); } /** diff --git a/composer.lock b/composer.lock index ce99a5b..1d163a8 100755 --- a/composer.lock +++ b/composer.lock @@ -12,7 +12,7 @@ "source": { "type": "git", "url": "https://gitee.com/devAether666/aether-hyperf.git", - "reference": "11a16d4cb0693ebdb5beb291777395132c001ef4" + "reference": "7dd9644f6b393eb3b9943b78bf8c3b4012c6b6cf" }, "require": { "hyperf/db-connection": "~3.1.0", @@ -52,7 +52,7 @@ } ], "description": "Aether Hyperf Common Components", - "time": "2025-09-30T07:14:33+00:00" + "time": "2025-10-09T05:51:23+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -10704,6 +10704,6 @@ "platform": { "php": ">=8.1" }, - "platform-dev": [], - "plugin-api-version": "2.0.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" }