Betaspi Grapper Bet365 per sport
This commit is contained in:
1 parent
1ac74e3e4f
commit
676eecd3ca
15 files changed
+513
-356
No files matched your search
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Services\DbMapper;
|
||||
|
||||
use App\Console\Commands\DbMapper\Store\StoreElement;
|
||||
use App\Console\Commands\DbMapper\Store\StoreGroup;
|
||||
use App\Console\Commands\DbMapper\Tasks\Helper\FindElement;
|
||||
use App\Console\Commands\DbMapper\Tasks\Helper\FindGroup;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Utilities\Notice;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Bet365Tennis
|
||||
{
|
||||
/**
|
||||
* Provider ID 2
|
||||
*/
|
||||
public static function run()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g');
|
||||
}
|
||||
|
||||
$mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->where('starttime', '>', Carbon::now())->get()->toArray();
|
||||
|
||||
foreach ($mappers as $mapper) {
|
||||
|
||||
FindElement::run($mapper);
|
||||
|
||||
FindGroup::run($mapper);
|
||||
|
||||
print_r($mapper);
|
||||
|
||||
if ($mapper['txodds_home_id'] && $mapper['txodds_away_id'] && $mapper['txodds_group_id']) {
|
||||
|
||||
$from = Carbon::createFromDate($mapper['starttime'])->subDay();
|
||||
$to = Carbon::createFromDate($mapper['starttime'])->addDay();
|
||||
|
||||
$event = Event::whereDate('starttime', '>', $from)
|
||||
->whereDate('starttime', '<', $to)
|
||||
->where('home_id', $mapper['txodds_home_id'])
|
||||
->where('away_id', $mapper['txodds_away_id'])
|
||||
->where('competition_group_id', $mapper['txodds_group_id'])
|
||||
->first()->toArray();
|
||||
|
||||
if ($event) {
|
||||
StoreElement::store($mapper);
|
||||
|
||||
StoreGroup::store($mapper);
|
||||
|
||||
$arr = [];
|
||||
if ($mapper['bet365_id']) {
|
||||
$arr['bet365_id'] = $mapper['bet365_id'];
|
||||
}
|
||||
if ($mapper['betradar_id']) {
|
||||
$arr['betradar_id'] = $mapper['betradar_id'];
|
||||
}
|
||||
if ($mapper['betsapi_id']) {
|
||||
$arr['betsapi_id'] = $mapper['betsapi_id'];
|
||||
}
|
||||
if ($arr) {
|
||||
Event::where('id', $event['id'])->update($arr);
|
||||
}
|
||||
dd($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user