From 20adfcb09cd9548ff8ce56283413df6660a162ca Mon Sep 17 00:00:00 2001 From: Slime-hatena Date: Mon, 15 Apr 2024 15:35:00 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E3=82=AA=E3=83=BC=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=83=80=E3=83=A1=E3=83=BC=E3=82=B8=E3=82=92=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/ViewUserController.php | 61 ++++++++++++++++ OngekiScoreLog/app/ScoreData.php | 13 ++++ .../resources/assets/js/sortTable.js | 4 +- .../user/song_status_overdamage.blade.php | 55 +++++++++++++++ .../resources/views/user_overdamage.blade.php | 69 +++++++++++++++++++ OngekiScoreLog/routes/web.php | 1 + 6 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 OngekiScoreLog/resources/views/layouts/components/user/song_status_overdamage.blade.php create mode 100644 OngekiScoreLog/resources/views/user_overdamage.blade.php diff --git a/OngekiScoreLog/app/Http/Controllers/ViewUserController.php b/OngekiScoreLog/app/Http/Controllers/ViewUserController.php index f592fddf..0f8bf200 100644 --- a/OngekiScoreLog/app/Http/Controllers/ViewUserController.php +++ b/OngekiScoreLog/app/Http/Controllers/ViewUserController.php @@ -363,4 +363,65 @@ public function getUserPage($id, $mode = null){ } return view('user', compact('id', 'status', 'score', 'stat', 'mode', 'submenuActive', 'sidemark')); } + + public function getOverDamegePage($id){ + $userStatus = new UserStatus(); + $user = User::where('id' ,$id)->first(); + $status = $userStatus->getRecentUserData($id); + if(count($status) === 0){ + if(is_null($user)){ + abort(404); + }else{ + return view("user_error", ['message' => '

このユーザーはOngekiScoreLogに登録していますが、オンゲキNETからスコア取得を行っていません。(UserID: ' . $id . ')

スコアの取得方法はこちらをお読みください。

']); + } + } + $status[0]->badge = ""; + if($user->role == 7){ + $status[0]->badge .= ' ProjectPrimera Developer'; + } + if(\App\UserInformation::IsPremiumPlan($user->id)){ + $status[0]->badge .= ' OngekiNet Premium'; + }else if(\App\UserInformation::IsStandardPlan($user->id)){ + $status[0]->badge .= ' OngekiNet Standard'; + } + + // トップランカーのスコアを取得してkey: song_id, difficulty, value: over_damage_high_score の配列を作る + $topRankerScore = []; + { + $temp = (new ScoreData)->getTopRankerScore()->getValue(); + foreach ($temp as $value) { + $key = $value->song_id . "_" . $value->difficulty; + if(!isset($topRankerScore[$key])){ + $topRankerScore[$key] = $value->max_over_damage_high_score; + } + } + } + + // 自分のスコアを取得 + $score = (new ScoreData)->getRecentUserScore($id)->addMusicData()->getValue(); + + // 難易度を通常難易度1つ+LUNATICだけに絞る + // FIXME: こんなのコード側でやっちゃいけない... けどテーブル設計的にどうしようもなく... + $temp = []; + $scoreDatas = []; + { + foreach ($score as $value) { + $key = $value->song_id; + if($value->difficulty === 10){ + $scoreDatas[] = $value; + }else{ + $temp[$key][] = $value; + } + } + + foreach ($temp as $value) { + array_multisort(array_column($value, 'over_damage_high_score'), SORT_DESC, $value); + if($value[0]->over_damage_high_score !== "0.00"){ + $scoreDatas[] = $value[0]; + } + } + } + + return view('user_overdamage', compact('id', 'status', 'scoreDatas', 'topRankerScore')); + } } diff --git a/OngekiScoreLog/app/ScoreData.php b/OngekiScoreLog/app/ScoreData.php index 96779ab4..8b239c4b 100644 --- a/OngekiScoreLog/app/ScoreData.php +++ b/OngekiScoreLog/app/ScoreData.php @@ -193,6 +193,19 @@ function getRecentUserScore($id){ return $this; } + function getTopRankerScore(){ + $sql = DB::table($this->table) + ->select('song_id', 'difficulty', + DB::raw('MAX(over_damage_high_score) as max_over_damage_high_score'), + DB::raw('MAX(battle_high_score) as max_battle_high_score'), + DB::raw('MAX(technical_high_score) as max_technical_high_score'),) + ->from($this->table) + ->groupBy('song_id', 'difficulty') + ; + $this->value = $sql->get(); + return $this; + } + /** * 指定した世代のスコアデータを取得します。 * diff --git a/OngekiScoreLog/resources/assets/js/sortTable.js b/OngekiScoreLog/resources/assets/js/sortTable.js index aed27c2b..452a967e 100644 --- a/OngekiScoreLog/resources/assets/js/sortTable.js +++ b/OngekiScoreLog/resources/assets/js/sortTable.js @@ -1,5 +1,5 @@ var options = { - valueNames: ['sort_title', 'sort_genre', 'sort_difficulty', 'sort_lv', 'sort_lamp', 'sort_fb', 'sort_fc', 'sort_ab', 'sort_rank0', 'sort_rank1', 'sort_bs', 'sort_od', 'sort_ts', 'sort_nod', 'sort_nts', 'sort_rate', 'sort_update', 'sort_raw_battle_rank', 'sort_raw_technical_rank', 'sort_raw_lamp', 'sort_raw_difficulty'] + valueNames: ['sort_title', 'sort_genre', 'sort_difficulty', 'sort_lv', 'sort_lamp', 'sort_fb', 'sort_fc', 'sort_ab', 'sort_rank0', 'sort_rank1', 'sort_bs', 'sort_od', 'sort_topod', 'sort_ts', 'sort_nod', 'sort_nts', 'sort_rate', 'sort_update', 'sort_raw_battle_rank', 'sort_raw_technical_rank', 'sort_raw_lamp', 'sort_raw_difficulty', 'sort_key1', 'sort_key2', 'sort_key3'] }; var sortTable = new List('sort_table', options); @@ -163,4 +163,4 @@ $('.filter_lamp_button').on('click',function(){ SortTable(); }); -SortTable(); \ No newline at end of file +SortTable(); diff --git a/OngekiScoreLog/resources/views/layouts/components/user/song_status_overdamage.blade.php b/OngekiScoreLog/resources/views/layouts/components/user/song_status_overdamage.blade.php new file mode 100644 index 00000000..93694b5d --- /dev/null +++ b/OngekiScoreLog/resources/views/layouts/components/user/song_status_overdamage.blade.php @@ -0,0 +1,55 @@ +
+

登録されている全ユーザーのオーバーダメージのうち、一番高いものと比較することが出来ます。
+ OD埋めなどにご活用ください。

+

プレイしている楽曲内で、一番ODが高い難易度のみ表示されます。全難易度のODが0の曲は表示されません。なお削除楽曲等も表示されます。ご了承下さい。

+
+ +
+

+ 表示倍率の変更
+ + + + +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + @foreach ($score as $s) + + + + + + + + + + @endforeach + +
TitleDifODTopdiff達成度Update
TitleDifODTopdiff達成度Update
{{$s->title}}song_id . "/" . strtolower($s->difficulty_str))}}">{{$s->title}}{{$s->difficulty}}{{substr($s->difficulty_str, 0, 3)}}{{$s->over_damage_high_score . "%"}}{{$topRankerScore[$s->song_id . "_" . $s->difficulty] . "%"}}{{$s->over_damage_high_score - $topRankerScore[$s->song_id . "_" . $s->difficulty]}}%{{($topRankerScore[$s->song_id . "_" . $s->difficulty] != 0) ? ($s->over_damage_high_score / $topRankerScore[$s->song_id . "_" . $s->difficulty]) * 100 : 100}}%{{date('Y-m-d', strtotime($s->updated_at))}}
+
+ +
diff --git a/OngekiScoreLog/resources/views/user_overdamage.blade.php b/OngekiScoreLog/resources/views/user_overdamage.blade.php new file mode 100644 index 00000000..a96e01c0 --- /dev/null +++ b/OngekiScoreLog/resources/views/user_overdamage.blade.php @@ -0,0 +1,69 @@ +@extends('layouts.app') + +@section('title', $status[0]->name) +@section('hero_subtitle', $status[0]->trophy) +@section('hero_title', $status[0]->name) +@section('additional_footer') + + +@endsection +@section('sidemark_mypage_overdamage', "is-active") + +@section('submenu') +
  • 簡易
  • +
  • 詳細
  • +
  • Technical
  • +
  • Battle
  • +
  • OverDamage
  • +
  • 称号
  • +
  • Rating
  • +
  • 更新差分
  • +@endsection + +@section('content') + @component('layouts/components/user/user_status') + @slot('badge') + {!!$status[0]->badge!!} + @endslot + @slot('name') + {{$status[0]->name}} + @endslot + @slot('trophy') + {{$status[0]->trophy}} + @endslot + @slot('level') + {{$status[0]->level}} + @endslot + @slot('battle_point') + {{$status[0]->battle_point}} + @endslot + @slot('rating') + {{$status[0]->rating}} + @endslot + @slot('rating_max') + {{$status[0]->rating_max}} + @endslot + @slot('money') + {{$status[0]->money}} + @endslot + @slot('money_max') + {{$status[0]->total_money}} + @endslot + @slot('total_play') + {{$status[0]->total_play}} + @endslot + @slot('friend_code') + {{$status[0]->friend_code}} + @endslot + @slot('comment') + {!! nl2br(e($status[0]->comment)) !!} + @endslot + @endcomponent + + {{-- @component('layouts/components/user/song_filter') + @endcomponent --}} + + @component('layouts/components/user/song_status_overdamage', ['score' => $scoreDatas, 'topRankerScore' => $topRankerScore, 'id' => $id]) + @endcomponent + +@endsection diff --git a/OngekiScoreLog/routes/web.php b/OngekiScoreLog/routes/web.php index 6ba09f0c..71d08cc5 100644 --- a/OngekiScoreLog/routes/web.php +++ b/OngekiScoreLog/routes/web.php @@ -20,6 +20,7 @@ Route::get('/user/{id}/trophy', 'ViewUserTrophyController@getIndex')->where(['id' => '\d+']); Route::get('/user/{id}/music/{music}/{difficulty}', 'ViewUserMusicController@getIndex')->where(['id' => '\d+', 'music' => '\d+', 'difficulty' => '\w+']); Route::get('/user/{id}/music/{music}', 'ViewUserMusicController@getRedirect')->where(['id' => '\d+', 'music' => '\d+']); +Route::get('/user/{id}/overdamage', 'ViewUserController@getOverDamegePage')->where(['id' => '\d+']); Route::get('/user/{id}/{mode?}', 'ViewUserController@getUserPage')->where(['id' => '\d+']); Route::middleware('throttle:3,1')->group(function () { From ec1e8d3fcbf320ef7112b5c8764d6cea1e441f17 Mon Sep 17 00:00:00 2001 From: Slime-hatena Date: Mon, 15 Apr 2024 15:35:10 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E3=83=A1=E3=83=8B=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=81=AB=E6=96=B0=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/views/layouts/components/sidebar.blade.php | 5 +++-- OngekiScoreLog/resources/views/user.blade.php | 5 +++-- OngekiScoreLog/resources/views/user_progress.blade.php | 3 ++- OngekiScoreLog/resources/views/user_rating.blade.php | 3 ++- OngekiScoreLog/resources/views/user_rating_error.blade.php | 3 ++- OngekiScoreLog/resources/views/user_trophy.blade.php | 5 +++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/OngekiScoreLog/resources/views/layouts/components/sidebar.blade.php b/OngekiScoreLog/resources/views/layouts/components/sidebar.blade.php index e0ec49c4..27d1e40f 100644 --- a/OngekiScoreLog/resources/views/layouts/components/sidebar.blade.php +++ b/OngekiScoreLog/resources/views/layouts/components/sidebar.blade.php @@ -18,8 +18,9 @@