wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -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,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
class ExplodeString
|
||||
{
|
||||
public static function grap($str)
|
||||
{
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
|
||||
class FindCompetitionGroupById
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
use App\Models\CountriesItalian;
|
||||
use App\Models\Country;
|
||||
|
||||
class FindCountry
|
||||
{
|
||||
public static function run(&$event)
|
||||
{
|
||||
if ($event['provider_id'] == 10) {
|
||||
// GOLDBET
|
||||
$country = CountriesItalian::where('it', $event['country'])->value('en');
|
||||
|
||||
$event['txodds_country_id'] = Country::where('name', $country)->value('id');
|
||||
} else {
|
||||
|
||||
$country = self::fix_country($event['country']);
|
||||
|
||||
$event['txodds_country_id'] = Country::where('name', $country)->value('id');
|
||||
}
|
||||
}
|
||||
|
||||
public static function fix_country($country)
|
||||
{
|
||||
switch ($country) {
|
||||
case 'Internazionale':
|
||||
case 'International Club':
|
||||
case 'Internazionali Di Club':
|
||||
case 'FIBA Intercontinental Cup':
|
||||
return 'International';
|
||||
case 'Euro Cup':
|
||||
case 'Euro Cup Women':
|
||||
case 'Euroleague':
|
||||
case 'Euroleague Women':
|
||||
return 'Europe';
|
||||
case 'WNBA':
|
||||
return 'USA';
|
||||
default:
|
||||
return $country;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementProvider;
|
||||
|
||||
class FindElement
|
||||
{
|
||||
public static function run(&$mapper)
|
||||
{
|
||||
if (isset($mapper['home_id']) && $mapper['home_id'] > 0) {
|
||||
$mapper['txodds_home_id'] = ElementProvider::where('provider_id', $mapper['provider_id'])
|
||||
->where('provider_element_id', $mapper['home_id'])->value('element_id');
|
||||
}
|
||||
if (! isset($mapper['txodds_home_id'])) {
|
||||
$arr = ExplodeString::grap($mapper['home']);
|
||||
|
||||
$mapper['txodds_home_id'] = Element::where('sport_id', $mapper['sport_id'])
|
||||
->where(function ($query) use ($arr) {
|
||||
foreach ($arr as $str) {
|
||||
$query->where('name', 'like', '%'.$str.'%');
|
||||
}
|
||||
})->value('id');
|
||||
}
|
||||
|
||||
if (isset($mapper['away_id']) && $mapper['away_id'] > 0) {
|
||||
$mapper['txodds_away_id'] = ElementProvider::where('provider_id', $mapper['provider_id'])
|
||||
->where('provider_element_id', $mapper['away_id'])->value('element_id');
|
||||
}
|
||||
if (! isset($mapper['txodds_away_id'])) {
|
||||
$arr = ExplodeString::grap($mapper['away']);
|
||||
|
||||
$mapper['txodds_away_id'] = Element::where('sport_id', $mapper['sport_id'])
|
||||
->where(function ($query) use ($arr) {
|
||||
foreach ($arr as $str) {
|
||||
$query->where('name', 'like', '%'.$str.'%');
|
||||
}
|
||||
})->value('id');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
use App\Models\ElementProvider;
|
||||
|
||||
class FindElementById
|
||||
{
|
||||
public static function run(&$mapper)
|
||||
{
|
||||
if (isset($mapper['home_id']) && $mapper['home_id'] > 0) {
|
||||
$mapper['txodds_home_id'] = ElementProvider::where('provider_id', $mapper['provider_id'])
|
||||
->where('provider_element_id', $mapper['home_id'])->value('element_id');
|
||||
}
|
||||
|
||||
if (isset($mapper['away_id']) && $mapper['away_id'] > 0) {
|
||||
$mapper['txodds_away_id'] = ElementProvider::where('provider_id', $mapper['provider_id'])
|
||||
->where('provider_element_id', $mapper['away_id'])->value('element_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\DbMapper\Helper;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use App\Models\Group;
|
||||
|
||||
class FindGroup
|
||||
{
|
||||
public static function run(&$mapper)
|
||||
{
|
||||
|
||||
if (isset($mapper['group_id'])) {
|
||||
$mapper['competition_group_id'] = CompetitionGroupProvider::where('provider_id', $mapper['provider_id'])
|
||||
->where('provider_group_id', $mapper['group_id'])->value('competition_group_id');
|
||||
}
|
||||
if (! $mapper['competition_group_id']) {
|
||||
$arr = ExplodeString::grap($mapper['group']);
|
||||
|
||||
$arr = array_diff($arr, ['Singles', 'ATP', 'WTA']);
|
||||
|
||||
$mapper['competition_group_id'] = Group::where('sport_id', $mapper['sport_id'])
|
||||
->where('competition_group_id', '>', 0)
|
||||
->where(function ($query) use ($arr) {
|
||||
foreach ($arr as $str) {
|
||||
$query->where('name', 'like', '%'.$str.'%');
|
||||
}
|
||||
})->value('competition_group_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user