From 3500b6b5bb0030778361dbd4542e9a6c2245bbe9 Mon Sep 17 00:00:00 2001 From: liutk <961510893@qq.com> Date: Fri, 24 May 2024 07:59:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/SettingController.php | 12 ++++++++++-- app/Http/Requests/SettingRequest.php | 2 +- ...2024_05_16_114837_create_activity_games_table.php | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/SettingController.php b/app/Http/Controllers/Api/SettingController.php index f12c76a..d37e163 100644 --- a/app/Http/Controllers/Api/SettingController.php +++ b/app/Http/Controllers/Api/SettingController.php @@ -12,7 +12,15 @@ class SettingController extends ApiController public function info(SettingRequest $request) { $key = $request->input('key', null); - - return $this->success([$key=> settings()->get($key)]); + $data = []; + // if(strpos(',', $key) !== false){ + $keys = explode(',', $key); + // } + foreach($keys as $key){ + if(!empty($key)){ + $data[$key] = settings()->get($key); + } + } + return $this->success($data); } } \ No newline at end of file diff --git a/app/Http/Requests/SettingRequest.php b/app/Http/Requests/SettingRequest.php index a868d83..5a58d62 100644 --- a/app/Http/Requests/SettingRequest.php +++ b/app/Http/Requests/SettingRequest.php @@ -26,7 +26,7 @@ class SettingRequest extends FormRequest public function rules() { return [ - 'key' => 'required|string|max:100', + 'key' => 'required|string|max:255', ]; } diff --git a/database/migrations/2024_05_16_114837_create_activity_games_table.php b/database/migrations/2024_05_16_114837_create_activity_games_table.php index 15aaadb..6909b2f 100644 --- a/database/migrations/2024_05_16_114837_create_activity_games_table.php +++ b/database/migrations/2024_05_16_114837_create_activity_games_table.php @@ -22,7 +22,7 @@ return new class extends Migration $table->string('away_logo')->comment('客场logo'); $table->timestamp('game_at')->comment('比赛时间'); $table->unsignedTinyInteger('state')->default(0)->comment('状态:0未发布,1已发布,2已公布'); - $table->unsignedInteger('mark')->comment('分数'); + $table->unsignedInteger('mark')->default(0)->comment('分数'); $table->enum('score', Score::options())->nullable()->comment('比赛结果'); $table->timestamps(); });