mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 02:50:52 +08:00
feat: multiple improvements and bug fixes
- Add gift card redemption feature - Resolve custom range selection issue in overview - Allow log page size to be modified - Add subscription path change notification - Improve dynamic node rate feature - Support markdown documentation display for plugins - Reduce power reset service logging - Fix backend version number not updating after update
This commit is contained in:
@@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
* @property string|null $network 网络类型
|
||||
* @property int|null $parent_id 父节点ID
|
||||
* @property float|null $rate 倍率
|
||||
* @property array|null $rate_time_ranges 倍率时间范围
|
||||
* @property int|null $sort 排序
|
||||
* @property array|null $protocol_settings 协议设置
|
||||
* @property int $created_at
|
||||
@@ -114,7 +115,9 @@ class Server extends Model
|
||||
'last_push_at' => 'integer',
|
||||
'show' => 'boolean',
|
||||
'created_at' => 'timestamp',
|
||||
'updated_at' => 'timestamp'
|
||||
'updated_at' => 'timestamp',
|
||||
'rate_time_ranges' => 'array',
|
||||
'rate_time_enable' => 'boolean',
|
||||
];
|
||||
|
||||
private const PROTOCOL_CONFIGURATIONS = [
|
||||
@@ -449,4 +452,16 @@ class Server extends Model
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function getCurrentRate(): float
|
||||
{
|
||||
$now = date('H:i');
|
||||
$ranges = $this->rate_time_ranges ?? [];
|
||||
foreach ($ranges as $range) {
|
||||
if ($now >= $range['start'] && $now <= $range['end']) {
|
||||
return (float) $range['rate'];
|
||||
}
|
||||
}
|
||||
return (float) $this->rate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user