wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementProvider;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class ElementIcons
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$min_id = 1;
|
||||
while ($min_id > 0) {
|
||||
|
||||
if ($min_id == 1) {
|
||||
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1';
|
||||
} else {
|
||||
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1&max_id='.$min_id;
|
||||
}
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! $data['success']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$min_id = $data['pager']['min_id'];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("MinId: $min_id");
|
||||
}
|
||||
|
||||
foreach ($data['results'] as $value) {
|
||||
|
||||
if (! isset($value['is_esports']) && $value['image_id'] > 0 && $value['cc'] != '') {
|
||||
|
||||
$res = ElementProvider::where('provider_id', 2)->where('provider_element_id', (int) $value['id'])->first();
|
||||
|
||||
if ($res) {
|
||||
if ($debug) {
|
||||
Notice::note($value, 'b');
|
||||
}
|
||||
Element::where('id', $res->element_id)->update(['betsapi_image_id' => $value['image_id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user