45 lines
923 B
PHP
Executable File
45 lines
923 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Model;
|
|
|
|
use App\Enums\BoolEnum;
|
|
use App\Enums\LottType;
|
|
use App\Utils\Helps;
|
|
use App\Utils\ThrowException;
|
|
|
|
|
|
class Dlt extends BaseModel
|
|
{
|
|
protected $casts = [
|
|
'qian' => 'array',
|
|
'hou' => 'array',
|
|
];
|
|
|
|
protected $appends = [
|
|
'result_time',
|
|
];
|
|
|
|
public function getResultTimeAttribute($key)
|
|
{
|
|
if ($this->updated_at) {
|
|
return $this->updated_at;
|
|
}
|
|
return '';
|
|
}
|
|
|
|
public function getCloseTime($earlySecond) {
|
|
$time = strtotime($this->close_time);
|
|
return date('Y-m-d H:i:s', $time - $earlySecond);
|
|
}
|
|
|
|
function getPrizePool() {
|
|
// 匹配"亿"单位的数字,支持"7.99亿"格式
|
|
$pattern = '/(\d+(?:\.\d+)?)亿/';
|
|
$matches = [];
|
|
if (preg_match($pattern, $this->prize, $matches)) {
|
|
return floatval($matches[1]);
|
|
}
|
|
return 0;
|
|
}
|
|
}
|