wip
This commit is contained in:
1 parent
46eb3767f9
commit
148d201d82
13 files changed
+237
-10
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,7 +17,7 @@ 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) {
|
||||
@@ -28,18 +28,17 @@ class PlayerPerSeason
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -47,7 +46,7 @@ class PlayerPerSeason
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSofaScoreRosa extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSofaScoreRosa extends EditRecord
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\SofaScoreRosaResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSofaScoreRosas extends ListRecords
|
||||
{
|
||||
protected static string $resource = SofaScoreRosaResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SofaScoreRosaForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages\CreateSofaScoreRosa;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages\EditSofaScoreRosa;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Pages\ListSofaScoreRosas;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Schemas\SofaScoreRosaForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables\SofaScoreRosasTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SofaScoreRosaResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SofaScoreRosa::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SofaScoreRosaForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SofaScoreRosasTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSofaScoreRosas::route('/'),
|
||||
'create' => CreateSofaScoreRosa::route('/create'),
|
||||
'edit' => EditSofaScoreRosa::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SofaScoreRosasTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
//
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SofaScoreRose extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sofa_score_roses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
|
||||
$table->integer('ssteam_id');
|
||||
$table->string('ssteam_name');
|
||||
$table->boolean('is_active')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sofa_score_roses');
|
||||
}
|
||||
};
|
||||
+3
-1
@@ -4,7 +4,9 @@ case "$1" in
|
||||
echo "--------------------------"
|
||||
echo "GRAPPER SOFASCORE"
|
||||
echo "--------------------------"
|
||||
echo "parameter sofa_score_tasks ID"
|
||||
echo "parameter ID"
|
||||
echo "--fun = Sofascore.php switch() "
|
||||
echo "--task = sofa_score_tasks_id"
|
||||
echo "yesterday 1"
|
||||
echo "dates 2"
|
||||
echo "--------------------------"
|
||||
|
||||
Reference in new issue
Block a user