wip
This commit is contained in:
1 parent
46eb3767f9
commit
148d201d82
13 files changed
+243
-16
No files matched your search
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper;
|
||||
use App\Console\Commands\Grapper\Sofascore\Grapper;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
|
||||
use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason;
|
||||
use App\Console\Commands\Grapper\Sofascore\Rose;
|
||||
use App\Console\Commands\Grapper\Sofascore\SendMail;
|
||||
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
|
||||
use App\Console\Commands\Nuh;
|
||||
@@ -47,6 +48,10 @@ class Sofascore
|
||||
SendMail::run();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Rose::run();
|
||||
break;
|
||||
|
||||
default:
|
||||
Notice::note('id not valid', 'br', 1);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class Grapper
|
||||
$day = $d['day'];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($day . ' - ' . $tournament->tournament->name, 'b');
|
||||
Notice::note('Start ' . $tournament->tournament->name, 'b');
|
||||
}
|
||||
|
||||
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
|
||||
@@ -101,7 +101,7 @@ class Grapper
|
||||
Sleeper::rand(1);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('New ' . $day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'bg');
|
||||
Notice::note($day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'bg');
|
||||
}
|
||||
|
||||
$grapped = SofaScoreEventGrapped::firstOrNew(['id' => $event['id']]);
|
||||
|
||||
@@ -17,41 +17,40 @@ class PlayerPerSeason
|
||||
$res = StatistikoDetail::query()->select('tm_player_id', 'txodds_id')->get();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('process '.$res->count() ." player", 'bb');
|
||||
Notice::note('process ' . $res->count() . " player", 'bb');
|
||||
}
|
||||
|
||||
foreach ($res as $val) {
|
||||
|
||||
|
||||
$collection = [];
|
||||
|
||||
$res2 = StatistikoPlayer::with('event')->where('tm_player_id', $val->tm_player_id)->get();
|
||||
|
||||
|
||||
foreach ($res2 as $val2) {
|
||||
|
||||
if(!isset($collection[$val2->event->season])){
|
||||
|
||||
if (!isset($collection[$val2->event->season])) {
|
||||
$collection[$val2->event->season]['events_played_home'] = 0;
|
||||
$collection[$val2->event->season]['events_played_away'] = 0;
|
||||
$collection[$val2->event->season]['minutes_played_home'] = 0;
|
||||
$collection[$val2->event->season]['minutes_played_away'] = 0;
|
||||
}
|
||||
if($val2->minutes_played > 0){
|
||||
if($val->txodds_id == $val2->event->home_id){
|
||||
if ($val2->minutes_played > 0) {
|
||||
if ($val->txodds_id == $val2->event->home_id) {
|
||||
$collection[$val2->event->season]['events_played_home'] += 1;
|
||||
$collection[$val2->event->season]['minutes_played_home'] += $val2->minutes_played;
|
||||
}
|
||||
else if($val->txodds_id == $val2->event->away_id){
|
||||
} else if ($val->txodds_id == $val2->event->away_id) {
|
||||
$collection[$val2->event->season]['events_played_away'] += 1;
|
||||
$collection[$val2->event->season]['minutes_played_away'] += $val2->minutes_played;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($collection as $season => $row) {
|
||||
if($val->txodds_id && $val->tm_player_id){
|
||||
if ($val->txodds_id && $val->tm_player_id) {
|
||||
SofaScorePlayerPerSeason::updateOrCreate(
|
||||
[
|
||||
'tm_player_id' => $val->tm_player_id,
|
||||
'tx_team_id' => $val->txodds_id,
|
||||
'tm_player_id' => $val->tm_player_id,
|
||||
'tx_team_id' => $val->txodds_id,
|
||||
'season' => $season
|
||||
],
|
||||
[
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreDayTournament;
|
||||
use App\Models\SofaScoreEventGrapped;
|
||||
use App\Models\SofaScoreTaskDay;
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Rose
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$task_id = Nuh::$options['task'] ?? 0;
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/team/4937/players";
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
dd($data);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user