This commit is contained in:
Aether
2025-10-09 14:01:58 +08:00
parent 1c0989d52d
commit 3415f75673
6 changed files with 12 additions and 11 deletions

2
.env
View File

@@ -1,5 +1,5 @@
APP_NAME=hyperf-data APP_NAME=hyperf-data
APP_ENV=dev APP_ENV=prod
DB_DRIVER=mysql DB_DRIVER=mysql
DB_HOST=localhost DB_HOST=localhost

View File

@@ -7,5 +7,5 @@ use Aether\Exception\AetherException;
class CampusNotFound extends AetherException class CampusNotFound extends AetherException
{ {
protected $code = 404001; protected $code = 404001;
protected $message = '文章不存在'; protected $message = '校区不存在或已禁用';
} }

View File

@@ -8,7 +8,8 @@ use Aether\Exception\AetherException;
class TeacherNotFound extends AetherException class TeacherNotFound extends AetherException
{ {
protected $code = 40400; protected $code = 140401;
protected $message = '教师不存在或已禁用';
protected $message = '教师不存在';
} }

View File

@@ -47,7 +47,7 @@ class DataService implements DataServiceInterface
{ {
$campus = $this->campusModel->find($id); $campus = $this->campusModel->find($id);
if (! $campus || $campus->status != 1) { if (! $campus || $campus->status != 1) {
throw new CampusNotFound('校区不存在或已禁用'); throw new CampusNotFound(9999, 'Campus not found', ['id' => $id]);
} }
return $campus->toArray(); return $campus->toArray();
} }

View File

@@ -83,7 +83,7 @@ class Campus extends AetherModel
*/ */
public function scopeProvince(Builder $query, string $province): Builder 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 public function scopeCity(Builder $query, string $city): Builder
{ {
return $query->where('city', $city); return $query->where('city', 'like', '%' . $city . '%');
} }
/** /**

8
composer.lock generated
View File

@@ -12,7 +12,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://gitee.com/devAether666/aether-hyperf.git", "url": "https://gitee.com/devAether666/aether-hyperf.git",
"reference": "11a16d4cb0693ebdb5beb291777395132c001ef4" "reference": "7dd9644f6b393eb3b9943b78bf8c3b4012c6b6cf"
}, },
"require": { "require": {
"hyperf/db-connection": "~3.1.0", "hyperf/db-connection": "~3.1.0",
@@ -52,7 +52,7 @@
} }
], ],
"description": "Aether Hyperf Common Components", "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", "name": "carbonphp/carbon-doctrine-types",
@@ -10704,6 +10704,6 @@
"platform": { "platform": {
"php": ">=8.1" "php": ">=8.1"
}, },
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.0.0" "plugin-api-version": "2.6.0"
} }