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

View File

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

View File

@@ -8,7 +8,8 @@ use Aether\Exception\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);
if (! $campus || $campus->status != 1) {
throw new CampusNotFound('校区不存在或已禁用');
throw new CampusNotFound(9999, 'Campus not found', ['id' => $id]);
}
return $campus->toArray();
}

View File

@@ -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 . '%');
}
/**