From 2b121804d0419ea965ed1c0a30f0c36722c86a5e Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 23 Mar 2023 14:24:13 +0800 Subject: [PATCH] 1 --- app/Controller/BasicDataController.php | 5 +++++ app/Model/BasicJob.php | 17 ++++++++++++----- app/Model/BasicNation.php | 17 ++++++++++++----- config/routes.php | 4 ++-- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/app/Controller/BasicDataController.php b/app/Controller/BasicDataController.php index 708764a..c4af027 100644 --- a/app/Controller/BasicDataController.php +++ b/app/Controller/BasicDataController.php @@ -145,4 +145,9 @@ class BasicDataController extends AbstractController $data = $BasicDataService->getDiseaseIcdSearch(); return $this->response->json($data); } + + public function getNation(){ + $params = array(); +// $basic_nation = BasicNation:: + } } \ No newline at end of file diff --git a/app/Model/BasicJob.php b/app/Model/BasicJob.php index 58b9547..43a9b9b 100644 --- a/app/Model/BasicJob.php +++ b/app/Model/BasicJob.php @@ -6,6 +6,7 @@ namespace App\Model; +use Hyperf\Database\Model\Collection; use Hyperf\Snowflake\Concern\Snowflake; /** @@ -28,11 +29,6 @@ class BasicJob extends Model */ protected array $fillable = ['job_id', 'job_name', 'created_at', 'updated_at']; - /** - * The attributes that should be cast to native types. - */ - protected array $casts = ['job_id' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime']; - protected string $primaryKey = "job_id"; /** @@ -45,4 +41,15 @@ class BasicJob extends Model { return self::where($params)->first($fields); } + + /** + * 获取信息-多条 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params, array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } } diff --git a/app/Model/BasicNation.php b/app/Model/BasicNation.php index eb07278..8b06e96 100644 --- a/app/Model/BasicNation.php +++ b/app/Model/BasicNation.php @@ -6,6 +6,7 @@ namespace App\Model; +use Hyperf\Database\Model\Collection; use Hyperf\Snowflake\Concern\Snowflake; /** @@ -28,11 +29,6 @@ class BasicNation extends Model */ protected array $fillable = ['nation_id', 'nation_name', 'created_at', 'updated_at']; - /** - * The attributes that should be cast to native types. - */ - protected array $casts = ['nation_id' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime']; - protected string $primaryKey = "nation_id"; /** @@ -45,4 +41,15 @@ class BasicNation extends Model { return self::where($params)->first($fields); } + + /** + * 获取信息-多条 + * @param array $params + * @param array $fields + * @return Collection|array + */ + public static function getList(array $params, array $fields = ['*']): Collection|array + { + return self::where($params)->get($fields); + } } diff --git a/config/routes.php b/config/routes.php index 92d4699..1c1b761 100644 --- a/config/routes.php +++ b/config/routes.php @@ -483,8 +483,8 @@ Router::addGroup('/basic', function () { Router::get('/search', [BasicDataController::class, 'getProductSearch']); }); - // 获取民族列表数据 - Router::get('/operation/manual', [BasicDataController::class, 'getOperationManual']); + // 获取民族数据 + Router::get('/nation', [BasicDataController::class, 'getNation']); }); // 获取医生评价