add groups and major groups direct from txodds for auto mapping names

This commit is contained in:
salam committed 2026-02-25 19:50:40 +01:00
1 parent ba83e1a12d
commit 859038cc8c
21 files changed
+299 -40

No files matched your search

+2 -2
View File
@@ -2,8 +2,8 @@
namespace App\Console\Commands\DbMapper;
use App\Console\Commands\DbMapper\Helper\FindCompetitionGroup;
use App\Console\Commands\DbMapper\Helper\FindElement;
use App\Console\Commands\DbMapper\Helper\FindGroup;
use App\Console\Commands\DbMapper\Store\StoreElement;
use App\Console\Commands\DbMapper\Store\StoreGroup;
use App\Console\Commands\Nuh;
@@ -36,7 +36,7 @@ class Bet365All
FindElement::run($mapper);
FindGroup::run($mapper);
FindCompetitionGroup::run($mapper);
if ($debug) {
Notice::note($mapper, 'b');
@@ -0,0 +1,53 @@
<?php
namespace App\Console\Commands\DbMapper\Helper;
class ArrayFunction
{
public static function remove($array, $value = [])
{
$tmp = str_replace(',', ' ', $str);
// $tmp = str_replace('-', ' ', $tmp);
$tmp = str_replace('/', ' ', $tmp);
$tmp = preg_replace('"\([^\)]*\)"', '', $tmp);
$tmp = preg_replace('/[^a-zA-Z0-9 ] /', '', $tmp);
$tmp = str_replace(' ', ' ', $tmp);
$elements = explode(' ', $tmp);
$_return = [];
foreach ($elements as $value) {
if (\strlen($value) > 3) {
$_return[] = $value;
}
}
usort($_return, function ($a, $b) {
return strlen($b) <=> strlen($a);
});
$remove = [
'fc',
'city',
'new',
'real',
'united',
'dinamo',
'town',
'club',
'union',
'sport',
'sports',
'basket',
'hapoel',
'maccabi',
'east'];
return array_diff($_return, $remove);
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Console\Commands\DbMapper\Helper;
use App\Models\CompetitionGroup;
use App\Models\CompetitionGroupProvider;
class FindCompetitionGroup
{
public static function run(&$mapper)
{
if (isset($mapper['group_id'])) {
$mapper['txodds_group_id'] = CompetitionGroupProvider::where('provider_id', $mapper['provider_id'])
->where('provider_group_id', $mapper['group_id'])->value('competition_group_id');
}
if (! $mapper['txodds_group_id']) {
$arr = ExplodeString::grap($mapper['group']);
$mapper['txodds_group_id'] = CompetitionGroup::where('sport_id', $mapper['sport_id'])
->where(function ($query) use ($arr) {
foreach ($arr as $str) {
$query->where('name', 'like', '%'.$str.'%');
}
})->value('id');
}
}
}
@@ -2,8 +2,8 @@
namespace App\Console\Commands\DbMapper\Helper;
use App\Models\CompetitionGroup;
use App\Models\CompetitionGroupProvider;
use App\Models\Group;
class FindGroup
{
@@ -17,12 +17,16 @@ class FindGroup
if (! $mapper['txodds_group_id']) {
$arr = ExplodeString::grap($mapper['group']);
$mapper['txodds_group_id'] = CompetitionGroup::where('sport_id', $mapper['sport_id'])
$arr = array_diff($arr, ['Singles', 'ATP', 'WTA']);
print_r($arr);
$mapper['competition_group_id'] = Group::where('sport_id', $mapper['sport_id'])
->where(function ($query) use ($arr) {
foreach ($arr as $str) {
$query->where('name', 'like', '%'.$str.'%');
}
})->value('id');
})->value('competition_group_id');
}
}
}
@@ -2,8 +2,8 @@
namespace App\Console\Commands\DbMapper;
use App\Console\Commands\DbMapper\Helper\FindCompetitionGroup;
use App\Console\Commands\DbMapper\Helper\FindElement;
use App\Console\Commands\DbMapper\Helper\FindGroup;
use App\Console\Commands\DbMapper\Store\StoreElement;
use App\Console\Commands\DbMapper\Store\StoreGroup;
use App\Console\Commands\Nuh;
@@ -31,7 +31,7 @@ class LogifutureColombiaAll
FindElement::run($mapper);
FindGroup::run($mapper);
FindCompetitionGroup::run($mapper);
if ($debug) {
Notice::note($mapper, 'b');
@@ -4,8 +4,6 @@ namespace App\Console\Commands\DbMapper;
use App\Console\Commands\DbMapper\Helper\FindElement;
use App\Console\Commands\DbMapper\Helper\FindGroup;
use App\Console\Commands\DbMapper\Store\StoreElement;
use App\Console\Commands\DbMapper\Store\StoreGroup;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Mapper;
@@ -15,17 +13,19 @@ use Carbon\Carbon;
class LogifutureNigeriaAll
{
/**
* Provider ID 2
* Provider ID 5
* LOGIFUTURE NIGERA
*/
public static function run()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note(Nuh::$options['name'].' '.Nuh::$options['sport'], 'g');
Notice::note(Nuh::$options['name'], 'g');
}
$mappers = Mapper::where('provider_id', 2)->where('sport_id', 5)->where('starttime', '>=', Carbon::now())->get()->toArray();
$mappers = Mapper::where('provider_id', 5)->where('sport_id', 5)->where('starttime', '>=', Carbon::now())->get()->toArray();
foreach ($mappers as $mapper) {
@@ -50,9 +50,6 @@ class LogifutureNigeriaAll
->first();
if ($event) {
StoreElement::store($mapper);
StoreGroup::store($mapper);
$arr = [];
if ($mapper['bet365_id']) {
@@ -71,7 +68,7 @@ class LogifutureNigeriaAll
}
if ($debug) {
Notice::note($event->toArray(), 'g');
Notice::note($event->toArray(), 'g', 1);
}
}
}
@@ -2,8 +2,8 @@
namespace App\Console\Commands\DbMapper;
use App\Console\Commands\DbMapper\Helper\FindCompetitionGroup;
use App\Console\Commands\DbMapper\Helper\FindElement;
use App\Console\Commands\DbMapper\Helper\FindGroup;
use App\Console\Commands\DbMapper\Store\StoreElement;
use App\Console\Commands\DbMapper\Store\StoreGroup;
use App\Console\Commands\Nuh;
@@ -38,7 +38,7 @@ class MaglooKeniaAll
FindElement::run($mapper);
FindGroup::run($mapper);
FindCompetitionGroup::run($mapper);
if ($debug) {
Notice::note($mapper, 'b');
@@ -2,8 +2,8 @@
namespace App\Console\Commands\DbMapper;
use App\Console\Commands\DbMapper\Helper\FindCompetitionGroup;
use App\Console\Commands\DbMapper\Helper\FindElement;
use App\Console\Commands\DbMapper\Helper\FindGroup;
use App\Console\Commands\DbMapper\Store\StoreElement;
use App\Console\Commands\DbMapper\Store\StoreGroup;
use App\Console\Commands\Nuh;
@@ -34,7 +34,7 @@ class MaglooNigeriaAll
FindElement::run($mapper);
FindGroup::run($mapper);
FindCompetitionGroup::run($mapper);
if ($debug) {
Notice::note($mapper, 'b');