83 lines
2.6 KiB
PHP
Executable File
83 lines
2.6 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console\Commands\Zq;
|
|
|
|
use App\Enums\LottType;
|
|
use App\Jobs\RefreshOrderBjdcSfggResult;
|
|
use App\Model\LotteryType;
|
|
use App\Model\Zq\BjdcOdds;
|
|
use App\Model\Zq\BjdcSfggOdds;
|
|
use App\Model\Zq\BjdcSfggResult;
|
|
use App\Service\External\AlStatService;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Arr;
|
|
|
|
class SyncBjdcSfggResult extends Command
|
|
{
|
|
/**
|
|
* 这个就是命令名称
|
|
*/
|
|
protected $signature = 'zq:sync_bjdc_sfgg_result';
|
|
|
|
/**
|
|
* 命令的说明描述
|
|
* @var string
|
|
*/
|
|
protected $description = '';
|
|
|
|
/**
|
|
* 创建命令的构造方法。
|
|
* @param string $words 传入的字符参数
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* 命令的具体执行触发方法
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
/** @var AlStatService $alStatService */
|
|
$alStatService = app(AlStatService::class);
|
|
$odds = $alStatService->getZqBjdcSfggResult();
|
|
if (!$odds) {
|
|
return;
|
|
}
|
|
|
|
foreach ($odds as $item) {
|
|
$id = $item['bjdcSfggOddId'];
|
|
$result = BjdcSfggResult::where('odds_id',$id)->first();
|
|
if ($result) {
|
|
continue;
|
|
}
|
|
$bjdcOdds = BjdcSfggOdds::where('odds_id', $id)->first();
|
|
|
|
$result = new BjdcSfggResult();
|
|
$result->bjdc_sfgg_odds_id = $bjdcOdds ? $bjdcOdds->id : 0;
|
|
$result->odds_id = strval(Arr::get($item, 'bjdcSfggOddId'));
|
|
$result->match_id = strval(Arr::get($item, 'matchId'));
|
|
$result->issue_num = strval(Arr::get($item, 'issueNum'));
|
|
$result->play_num = strval(Arr::get($item, 'playNum'));
|
|
$result->half_time_score = strval(Arr::get($item, 'halfTimeScore'));
|
|
$result->full_time_score = strval(Arr::get($item, 'fullTimeScore'));
|
|
$result->is_reverse = strval(Arr::get($item, 'isReverse'));
|
|
$result->lottery_state = strval(Arr::get($item, 'lottState'));
|
|
$result->lottery_time = strval(Arr::get($item, 'lotteryTime'));
|
|
|
|
$result->sfgg_odds = floatval(Arr::get($item, 'sfggResult.resultOdds'));
|
|
$result->sfgg_handicap = floatval(Arr::get($item, 'sfggResult.handicap'));
|
|
$result->sfgg_name = strval(Arr::get($item, 'sfggResult.resultName'));
|
|
$result->sfgg_field = strval(Arr::get($item, 'sfggResult.resultField'));
|
|
|
|
$result->save();
|
|
|
|
RefreshOrderBjdcSfggResult::dispatch($result->id);
|
|
}
|
|
}
|
|
|
|
}
|