- Draw相关控制器添加provider_code和provider_name字段支持 - 允许手动录入开奖批次时指定provider_code - RNG开奖批次生成支持多provider,分别生成对应批次数据 - DrawPublishService和DrawManualResultService中支持基于provider_code管理开奖版本和发布流程 - DrawResultViewService调整,支持按provider汇总及筛选开奖结果 - Settlement处理逻辑调整,按provider区分待结算票据及批次,分开结算 - 结算期间管理相关服务支持使用站点本地结算时区计算开账建议和日期处理 - 增加AdminSite的settlement_timezone字段及相关请求验证和数据存取支持 - 优化AdminSettlementPeriod相关代码,防止存在未结清票据时关账 - Ticket明细返回接口添加结算时区信息,提升用户时间体验 - 多处查询排序和版本号处理改进,保证多provider数据正确顺序与一致性
75 lines
1.7 KiB
PHP
75 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 后台站点 / 主站接入配置({@see $table admin_sites})。
|
|
*
|
|
* `code` 对外即 JWT 与钱包回调中的 `site_code`,创建后不可修改。
|
|
*/
|
|
final class AdminSite extends Model
|
|
{
|
|
protected $table = 'admin_sites';
|
|
|
|
protected $fillable = [
|
|
'code',
|
|
'name',
|
|
'currency_code',
|
|
'settlement_timezone',
|
|
'status',
|
|
'is_default',
|
|
'extra_json',
|
|
'wallet_api_url',
|
|
'wallet_debit_path',
|
|
'wallet_credit_path',
|
|
'wallet_balance_path',
|
|
'wallet_api_key_encrypted',
|
|
'sso_jwt_secret_encrypted',
|
|
'wallet_timeout_seconds',
|
|
'iframe_allowed_origins',
|
|
'lottery_h5_base_url',
|
|
'notes',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => 'integer',
|
|
'is_default' => 'boolean',
|
|
'extra_json' => 'array',
|
|
'iframe_allowed_origins' => 'array',
|
|
'wallet_timeout_seconds' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function isEnabled(): bool
|
|
{
|
|
return (int) $this->status === 1;
|
|
}
|
|
|
|
public function decryptedSsoJwtSecret(): ?string
|
|
{
|
|
return $this->decryptSecret($this->sso_jwt_secret_encrypted);
|
|
}
|
|
|
|
public function decryptedWalletApiKey(): ?string
|
|
{
|
|
return $this->decryptSecret($this->wallet_api_key_encrypted);
|
|
}
|
|
|
|
private function decryptSecret(?string $encrypted): ?string
|
|
{
|
|
if (! is_string($encrypted) || $encrypted === '') {
|
|
return null;
|
|
}
|
|
|
|
try {
|
|
return decrypt($encrypted);
|
|
} catch (\Throwable) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|