80 lines
2.6 KiB
PHP
Executable File
80 lines
2.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console\Commands\Lq;
|
|
|
|
use App\Enums\LottType;
|
|
use App\Model\LotteryType;
|
|
use App\Model\Lq\JclqOdds;
|
|
use App\Model\Lq\JclqScore;
|
|
use App\Service\External\AlStatService;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class SyncJclqScore extends Command
|
|
{
|
|
/**
|
|
* 这个就是命令名称
|
|
*/
|
|
protected $signature = 'lq:sync_jclq_score';
|
|
|
|
/**
|
|
* 命令的说明描述
|
|
* @var string
|
|
*/
|
|
protected $description = '';
|
|
|
|
/**
|
|
* 创建命令的构造方法。
|
|
* @param string $words 传入的字符参数
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* 命令的具体执行触发方法
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
Log::info('SyncJclqScore 篮球比分数据');
|
|
|
|
/** @var AlStatService $alStatService */
|
|
$alStatService = app(AlStatService::class);
|
|
$odds = $alStatService->getLqScore();
|
|
if (!$odds) {
|
|
return;
|
|
}
|
|
foreach ($odds as $item) {
|
|
|
|
$odd = JclqScore::where('score_id', $item['id'])->first();
|
|
if (!$odd) {
|
|
$odd = new JclqScore();
|
|
}
|
|
$odd->score_id = $item['id'];
|
|
$odd->match_id = intval(Arr::get($item, 'matchId'));
|
|
$odd->timestamp = strval(Arr::get($item, 'timeStamp'));
|
|
$odd->status = intval(Arr::get($item, 'status'));
|
|
$odd->period = intval(Arr::get($item, 'period'));
|
|
$odd->quarter_remain_time = strval(Arr::get($item, 'quarterRemainTime'));
|
|
$odd->quarter_num = intval(Arr::get($item, 'quarterNum'));
|
|
$odd->home_score = intval(Arr::get($item, 'homeScore'));
|
|
$odd->away_score = intval(Arr::get($item, 'awayScore'));
|
|
$odd->q1home_score = intval(Arr::get($item, 'q1homeScore'));
|
|
$odd->q1away_score = intval(Arr::get($item, 'q1awayScore'));
|
|
$odd->q2home_score = intval(Arr::get($item, 'q2homeScore'));
|
|
$odd->q2away_score = intval(Arr::get($item, 'q2awayScore'));
|
|
$odd->q3home_score = intval(Arr::get($item, 'q3homeScore'));
|
|
$odd->q3away_score = intval(Arr::get($item, 'q3awayScore'));
|
|
$odd->q4home_score = intval(Arr::get($item, 'q4homeScore'));
|
|
$odd->q4away_score = intval(Arr::get($item, 'q4awayScore'));
|
|
$odd->over_time_num = intval(Arr::get($item, 'overTimeNum'));
|
|
$odd->over_time_score = Arr::get($item, 'overTimeScore');
|
|
$odd->save();
|
|
}
|
|
}
|
|
}
|