141 lines
4.5 KiB
PHP
Executable File
141 lines
4.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console\Commands\Zq;
|
|
|
|
use App\Jobs\RefreshOrderJczqResult;
|
|
use App\Model\Zq\JczqOdds;
|
|
use App\Model\Zq\JczqResult;
|
|
use App\Service\External\AlStatService;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class SyncJczqResult extends Command
|
|
{
|
|
/**
|
|
* 这个就是命令名称
|
|
*/
|
|
protected $signature = 'zq:sync_jczq_result';
|
|
|
|
/**
|
|
* 命令的说明描述
|
|
* @var string
|
|
*/
|
|
protected $description = '';
|
|
|
|
/**
|
|
* 创建命令的构造方法。
|
|
* @param string $words 传入的字符参数
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* 命令的具体执行触发方法
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
Log::info('SyncJczqOdds 足球开奖结果');
|
|
/** @var AlStatService $alStatService */
|
|
$alStatService = app(AlStatService::class);
|
|
$odds = $alStatService->getJczqResult();
|
|
if (!$odds) {
|
|
return;
|
|
}
|
|
|
|
foreach ($odds as $item) {
|
|
$id = $item['jczqOddId'];
|
|
$result = JczqResult::where('odds_id',$id)->first();
|
|
if ($result) {
|
|
continue;
|
|
}
|
|
$jczqOdds = JczqOdds::where('odds_id', $id)->first();
|
|
|
|
$issueNum = strval(Arr::get($item, 'issueNum'));
|
|
$issueNumArr = explode('/', $issueNum);
|
|
|
|
$result = new JczqResult();
|
|
$result->jczq_odds_id = $jczqOdds ? $jczqOdds->id : 0;
|
|
$result->odds_id = strval(Arr::get($item, 'jczqOddId'));
|
|
$result->match_id = strval(Arr::get($item, 'matchId'));
|
|
$result->issue_num = $issueNum;
|
|
$result->issue_date = strval(Arr::get($issueNumArr, 0));
|
|
$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->spf_odds = floatval(Arr::get($item, 'spfResult.resultOdds'));
|
|
$result->spf_name = strval(Arr::get($item, 'spfResult.resultName'));
|
|
$result->spf_field = strval(Arr::get($item, 'spfResult.resultField'));
|
|
|
|
$result->rq_odds = floatval(Arr::get($item, 'rqResult.resultOdds'));
|
|
$result->rq_handicap = floatval(Arr::get($item, 'rqResult.handicap'));
|
|
$result->rq_field = strval(Arr::get($item, 'rqResult.resultField'));
|
|
$result->rq_name = strval(Arr::get($item, 'rqResult.resultName'));
|
|
|
|
$result->bf_odds = floatval(Arr::get($item, 'bfResult.resultOdds'));
|
|
$result->bf_field = strval(Arr::get($item, 'bfResult.resultField'));
|
|
$result->bf_name = strval(Arr::get($item, 'bfResult.resultName'));
|
|
|
|
$result->jq_odds = floatval(Arr::get($item, 'jqResult.resultOdds'));
|
|
$result->jq_field = strval(Arr::get($item, 'jqResult.resultField'));
|
|
$result->jq_name = strval(Arr::get($item, 'jqResult.resultName'));
|
|
|
|
$result->bqc_odds = floatval(Arr::get($item, 'bqcResult.resultOdds'));
|
|
$result->bqc_field = strval(Arr::get($item, 'bqcResult.resultField'));
|
|
$result->bqc_name = strval(Arr::get($item, 'bqcResult.resultName'));
|
|
|
|
$result->save();
|
|
|
|
RefreshOrderJczqResult::dispatch($result->id);
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
"jczqOddId" => 132484
|
|
"matchId" => 432216
|
|
"issueNum" => "2023-05-03/周三"
|
|
"playNum" => 1
|
|
"isReverse" => 0
|
|
"halfTimeScore" => "0 : 1"
|
|
"fullTimeScore" => "2 : 2"
|
|
"lottState" => "hasLottery"
|
|
"lotteryTime" => "2023-05-03 16:34:00"
|
|
"spfResult" => array:3 [▼
|
|
"resultField" => "draw"
|
|
"resultName" => "平"
|
|
"resultOdds" => 3.0
|
|
]
|
|
"rqResult" => array:4 [▼
|
|
"handicap" => -1
|
|
"resultField" => "loss"
|
|
"resultName" => "负"
|
|
"resultOdds" => 1.51
|
|
]
|
|
"bfResult" => array:3 [▼
|
|
"resultField" => "dh2a2"
|
|
"resultName" => "2:2"
|
|
"resultOdds" => 16.0
|
|
]
|
|
"jqResult" => array:3 [▼
|
|
"resultField" => "g4"
|
|
"resultName" => "4"
|
|
"resultOdds" => 7.15
|
|
]
|
|
"bqcResult" => array:3 [▼
|
|
"resultField" => "ld"
|
|
"resultName" => "负平"
|
|
"resultOdds" => 16.0
|
|
]
|
|
*/
|
|
|
|
}
|