Browse Source

feat: linear dynamic rate method

M1Screw 1 year ago
parent
commit
6b8fb95414

+ 43 - 45
composer.lock

@@ -123,16 +123,16 @@
         },
         },
         {
         {
             "name": "aws/aws-sdk-php",
             "name": "aws/aws-sdk-php",
-            "version": "3.293.3",
+            "version": "3.293.5",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "a4b5523d5bde20fbaa35f439f8ca57ab2b4a753d"
+                "reference": "f2002e52b382b45231da3f9552033f769acfebd8"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a4b5523d5bde20fbaa35f439f8ca57ab2b4a753d",
-                "reference": "a4b5523d5bde20fbaa35f439f8ca57ab2b4a753d",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f2002e52b382b45231da3f9552033f769acfebd8",
+                "reference": "f2002e52b382b45231da3f9552033f769acfebd8",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -212,9 +212,9 @@
             "support": {
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.293.3"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.293.5"
             },
             },
-            "time": "2023-12-04T19:09:01+00:00"
+            "time": "2023-12-06T19:09:15+00:00"
         },
         },
         {
         {
             "name": "bacon/bacon-qr-code",
             "name": "bacon/bacon-qr-code",
@@ -1200,7 +1200,7 @@
         },
         },
         {
         {
             "name": "illuminate/collections",
             "name": "illuminate/collections",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/collections.git",
                 "url": "https://github.com/illuminate/collections.git",
@@ -1255,7 +1255,7 @@
         },
         },
         {
         {
             "name": "illuminate/conditionable",
             "name": "illuminate/conditionable",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/conditionable.git",
                 "url": "https://github.com/illuminate/conditionable.git",
@@ -1301,7 +1301,7 @@
         },
         },
         {
         {
             "name": "illuminate/container",
             "name": "illuminate/container",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/container.git",
                 "url": "https://github.com/illuminate/container.git",
@@ -1352,7 +1352,7 @@
         },
         },
         {
         {
             "name": "illuminate/contracts",
             "name": "illuminate/contracts",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/contracts.git",
                 "url": "https://github.com/illuminate/contracts.git",
@@ -1400,16 +1400,16 @@
         },
         },
         {
         {
             "name": "illuminate/database",
             "name": "illuminate/database",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/database.git",
                 "url": "https://github.com/illuminate/database.git",
-                "reference": "0a6c86fb795f28dc5656f2a7b38348d5b1a0a64d"
+                "reference": "3368e28e7ecc5b66fc749104ce75982971823216"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/database/zipball/0a6c86fb795f28dc5656f2a7b38348d5b1a0a64d",
-                "reference": "0a6c86fb795f28dc5656f2a7b38348d5b1a0a64d",
+                "url": "https://api.github.com/repos/illuminate/database/zipball/3368e28e7ecc5b66fc749104ce75982971823216",
+                "reference": "3368e28e7ecc5b66fc749104ce75982971823216",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -1465,11 +1465,11 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
                 "source": "https://github.com/laravel/framework"
             },
             },
-            "time": "2023-11-28T14:31:58+00:00"
+            "time": "2023-12-04T22:26:42+00:00"
         },
         },
         {
         {
             "name": "illuminate/macroable",
             "name": "illuminate/macroable",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/macroable.git",
                 "url": "https://github.com/illuminate/macroable.git",
@@ -1515,7 +1515,7 @@
         },
         },
         {
         {
             "name": "illuminate/pagination",
             "name": "illuminate/pagination",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/pagination.git",
                 "url": "https://github.com/illuminate/pagination.git",
@@ -1565,16 +1565,16 @@
         },
         },
         {
         {
             "name": "illuminate/support",
             "name": "illuminate/support",
-            "version": "v10.34.2",
+            "version": "v10.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/illuminate/support.git",
                 "url": "https://github.com/illuminate/support.git",
-                "reference": "88960c790553fb24aa0c52b9a0b58fab04ea6fc3"
+                "reference": "84fd6e3a041c93bf8dca1349caf994023ee5c9e0"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/support/zipball/88960c790553fb24aa0c52b9a0b58fab04ea6fc3",
-                "reference": "88960c790553fb24aa0c52b9a0b58fab04ea6fc3",
+                "url": "https://api.github.com/repos/illuminate/support/zipball/84fd6e3a041c93bf8dca1349caf994023ee5c9e0",
+                "reference": "84fd6e3a041c93bf8dca1349caf994023ee5c9e0",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -1632,7 +1632,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
                 "source": "https://github.com/laravel/framework"
             },
             },
-            "time": "2023-11-27T16:17:31+00:00"
+            "time": "2023-12-04T22:26:42+00:00"
         },
         },
         {
         {
             "name": "irazasyed/telegram-bot-sdk",
             "name": "irazasyed/telegram-bot-sdk",
@@ -4140,28 +4140,27 @@
         },
         },
         {
         {
             "name": "sendgrid/php-http-client",
             "name": "sendgrid/php-http-client",
-            "version": "3.14.4",
+            "version": "4.1.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/sendgrid/php-http-client.git",
                 "url": "https://github.com/sendgrid/php-http-client.git",
-                "reference": "6d589564522be290c7d7c18e51bcd8b03aeaf0b6"
+                "reference": "84fe926f3d2ac3454f088c9a06ebdc398cc3727e"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/6d589564522be290c7d7c18e51bcd8b03aeaf0b6",
-                "reference": "6d589564522be290c7d7c18e51bcd8b03aeaf0b6",
+                "url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/84fe926f3d2ac3454f088c9a06ebdc398cc3727e",
+                "reference": "84fe926f3d2ac3454f088c9a06ebdc398cc3727e",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
                 "ext-curl": "*",
                 "ext-curl": "*",
                 "ext-json": "*",
                 "ext-json": "*",
                 "ext-mbstring": "*",
                 "ext-mbstring": "*",
-                "php": ">=5.6"
+                "php": ">=7.3"
             },
             },
             "require-dev": {
             "require-dev": {
                 "friendsofphp/php-cs-fixer": "^2.16",
                 "friendsofphp/php-cs-fixer": "^2.16",
-                "phpunit/phpunit": "^5.7 || ^6.5",
-                "sebastian/version": "^1.0.6",
+                "phpunit/phpunit": "^9",
                 "squizlabs/php_codesniffer": "~2.0"
                 "squizlabs/php_codesniffer": "~2.0"
             },
             },
             "suggest": {
             "suggest": {
@@ -4197,23 +4196,22 @@
                 "sendgrid"
                 "sendgrid"
             ],
             ],
             "support": {
             "support": {
-                "issues": "https://github.com/sendgrid/php-http-client/issues",
-                "source": "https://github.com/sendgrid/php-http-client/tree/3.14.4"
+                "source": "https://github.com/sendgrid/php-http-client/tree/4.1.0"
             },
             },
-            "time": "2022-03-09T20:21:55+00:00"
+            "time": "2023-12-01T05:16:21+00:00"
         },
         },
         {
         {
             "name": "sendgrid/sendgrid",
             "name": "sendgrid/sendgrid",
-            "version": "8.1.0",
+            "version": "8.1.1",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/sendgrid/sendgrid-php.git",
                 "url": "https://github.com/sendgrid/sendgrid-php.git",
-                "reference": "550c3f606750911a0d8a8d58b7e20b436a2a6180"
+                "reference": "08514e75789f192c034fdcf18efe6d8b1a7c91da"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/550c3f606750911a0d8a8d58b7e20b436a2a6180",
-                "reference": "550c3f606750911a0d8a8d58b7e20b436a2a6180",
+                "url": "https://api.github.com/repos/sendgrid/sendgrid-php/zipball/08514e75789f192c034fdcf18efe6d8b1a7c91da",
+                "reference": "08514e75789f192c034fdcf18efe6d8b1a7c91da",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -4222,7 +4220,7 @@
                 "ext-mbstring": "*",
                 "ext-mbstring": "*",
                 "ext-openssl": "*",
                 "ext-openssl": "*",
                 "php": ">=7.3",
                 "php": ">=7.3",
-                "sendgrid/php-http-client": "~3.10",
+                "sendgrid/php-http-client": "4.1.0",
                 "starkbank/ecdsa": "0.*"
                 "starkbank/ecdsa": "0.*"
             },
             },
             "replace": {
             "replace": {
@@ -4263,9 +4261,9 @@
                 "twilio sendgrid"
                 "twilio sendgrid"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/sendgrid/sendgrid-php/tree/8.1.0"
+                "source": "https://github.com/sendgrid/sendgrid-php/tree/8.1.1"
             },
             },
-            "time": "2023-12-01T05:16:22+00:00"
+            "time": "2023-12-06T07:11:08+00:00"
         },
         },
         {
         {
             "name": "sentry/sdk",
             "name": "sentry/sdk",
@@ -7992,16 +7990,16 @@
         },
         },
         {
         {
             "name": "phpunit/phpunit",
             "name": "phpunit/phpunit",
-            "version": "10.5.1",
+            "version": "10.5.2",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "d5d9dca6a902d05b34c4bcbc7c1636ce1dc25408"
+                "reference": "5aedff46afba98dddecaa12349ec044d9103d4fe"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d5d9dca6a902d05b34c4bcbc7c1636ce1dc25408",
-                "reference": "d5d9dca6a902d05b34c4bcbc7c1636ce1dc25408",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5aedff46afba98dddecaa12349ec044d9103d4fe",
+                "reference": "5aedff46afba98dddecaa12349ec044d9103d4fe",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -8073,7 +8071,7 @@
             "support": {
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.1"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.2"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -8089,7 +8087,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2023-12-01T16:57:05+00:00"
+            "time": "2023-12-05T14:54:33+00:00"
         },
         },
         {
         {
             "name": "psr/cache",
             "name": "psr/cache",

+ 1 - 0
db/migrations/2023020100-init.php

@@ -139,6 +139,7 @@ return new class() implements MigrationInterface {
                 `sort` tinyint(2) unsigned NOT NULL DEFAULT 14 COMMENT '节点类型',
                 `sort` tinyint(2) unsigned NOT NULL DEFAULT 14 COMMENT '节点类型',
                 `traffic_rate` float unsigned NOT NULL DEFAULT 1 COMMENT '流量倍率',
                 `traffic_rate` float unsigned NOT NULL DEFAULT 1 COMMENT '流量倍率',
                 `is_dynamic_rate` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '是否启用动态流量倍率',
                 `is_dynamic_rate` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '是否启用动态流量倍率',
+                `dynamic_rate_type` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '动态流量倍率计算方式',
                 `dynamic_rate_config` longtext NOT NULL DEFAULT '{}' COMMENT '动态流量倍率配置' CHECK (json_valid(`custom_config`)),
                 `dynamic_rate_config` longtext NOT NULL DEFAULT '{}' COMMENT '动态流量倍率配置' CHECK (json_valid(`custom_config`)),
                 `node_class` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT '节点等级',
                 `node_class` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT '节点等级',
                 `node_speedlimit` double unsigned NOT NULL DEFAULT 0 COMMENT '节点限速',
                 `node_speedlimit` double unsigned NOT NULL DEFAULT 0 COMMENT '节点限速',

+ 26 - 0
db/migrations/2023120700-add_node_dynamic_rate.php

@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Interfaces\MigrationInterface;
+use App\Services\DB;
+
+return new class() implements MigrationInterface {
+    public function up(): int
+    {
+        DB::getPdo()->exec("
+            ALTER TABLE node ADD COLUMN IF NOT EXISTS `dynamic_rate_type` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '动态流量倍率计算方式';
+        ");
+
+        return 2023120700;
+    }
+
+    public function down(): int
+    {
+        DB::getPdo()->exec('
+            ALTER TABLE node DROP COLUMN IF EXISTS `dynamic_rate_type`;
+        ');
+
+        return 2023111801;
+    }
+};

+ 9 - 0
resources/views/tabler/admin/node/create.tpl

@@ -96,6 +96,15 @@
                                     </label>
                                     </label>
                                 </span>
                                 </span>
                             </div>
                             </div>
+                            <div class="form-group mb-3 row">
+                                <label class="form-label col-3 col-form-label">动态流量倍率计算方式</label>
+                                <div class="col">
+                                    <select id="dynamic_rate_type" class="col form-select">
+                                        <option value="0">Logistic</option>
+                                        <option value="1">Linear</option>
+                                    </select>
+                                </div>
+                            </div>
                             <div class="form-group mb-3 row">
                             <div class="form-group mb-3 row">
                                 <label class="form-label col-3 col-form-label">最大倍率</label>
                                 <label class="form-label col-3 col-form-label">最大倍率</label>
                                 <div class="col">
                                 <div class="col">

+ 9 - 0
resources/views/tabler/admin/node/edit.tpl

@@ -102,6 +102,15 @@
                                     </label>
                                     </label>
                                 </span>
                                 </span>
                             </div>
                             </div>
+                            <div class="form-group mb-3 row">
+                                <label class="form-label col-3 col-form-label">动态流量倍率计算方式</label>
+                                <div class="col">
+                                    <select id="dynamic_rate_type" class="col form-select" value="{$node->dynamic_rate_type}">
+                                        <option value="0" {if $node->dynamic_rate_type === 0}selected{/if}>Logistic</option>
+                                        <option value="1" {if $node->dynamic_rate_type === 1}selected{/if}>Linear</option>
+                                    </select>
+                                </div>
+                            </div>
                             <div class="form-group mb-3 row">
                             <div class="form-group mb-3 row">
                                 <label class="form-label col-3 col-form-label">最大倍率</label>
                                 <label class="form-label col-3 col-form-label">最大倍率</label>
                                 <div class="col">
                                 <div class="col">

+ 5 - 1
src/Controllers/Admin/NodeController.php

@@ -31,7 +31,8 @@ final class NodeController extends BaseController
             'type' => '状态',
             'type' => '状态',
             'sort' => '类型',
             'sort' => '类型',
             'traffic_rate' => '倍率',
             'traffic_rate' => '倍率',
-            'is_dynamic_rate' => '启用动态流量倍率',
+            'is_dynamic_rate' => '动态倍率',
+            'dynamic_rate_type' => '动态倍率计算方式',
             'node_class' => '等级',
             'node_class' => '等级',
             'node_group' => '组别',
             'node_group' => '组别',
             'node_bandwidth_limit' => '流量限制/GB',
             'node_bandwidth_limit' => '流量限制/GB',
@@ -45,6 +46,7 @@ final class NodeController extends BaseController
         'server',
         'server',
         'traffic_rate',
         'traffic_rate',
         'is_dynamic_rate',
         'is_dynamic_rate',
+        'dynamic_rate_type',
         'max_rate',
         'max_rate',
         'max_rate_time',
         'max_rate_time',
         'min_rate',
         'min_rate',
@@ -97,6 +99,7 @@ final class NodeController extends BaseController
         $node->server = trim($request->getParam('server'));
         $node->server = trim($request->getParam('server'));
         $node->traffic_rate = $request->getParam('traffic_rate') ?? 1;
         $node->traffic_rate = $request->getParam('traffic_rate') ?? 1;
         $node->is_dynamic_rate = $request->getParam('is_dynamic_rate') === 'true' ? 1 : 0;
         $node->is_dynamic_rate = $request->getParam('is_dynamic_rate') === 'true' ? 1 : 0;
+        $node->dynamic_rate_type = $request->getParam('dynamic_rate_type') ?? 0;
         $node->dynamic_rate_config = json_encode([
         $node->dynamic_rate_config = json_encode([
             'max_rate' => $request->getParam('max_rate') ?? 1,
             'max_rate' => $request->getParam('max_rate') ?? 1,
             'max_rate_time' => $request->getParam('max_rate_time') ?? 3,
             'max_rate_time' => $request->getParam('max_rate_time') ?? 3,
@@ -191,6 +194,7 @@ final class NodeController extends BaseController
         $node->server = trim($request->getParam('server'));
         $node->server = trim($request->getParam('server'));
         $node->traffic_rate = $request->getParam('traffic_rate') ?? 1;
         $node->traffic_rate = $request->getParam('traffic_rate') ?? 1;
         $node->is_dynamic_rate = $request->getParam('is_dynamic_rate') === 'true' ? 1 : 0;
         $node->is_dynamic_rate = $request->getParam('is_dynamic_rate') === 'true' ? 1 : 0;
+        $node->dynamic_rate_type = $request->getParam('dynamic_rate_type') ?? 0;
         $node->dynamic_rate_config = json_encode([
         $node->dynamic_rate_config = json_encode([
             'max_rate' => $request->getParam('max_rate') ?? 1,
             'max_rate' => $request->getParam('max_rate') ?? 1,
             'max_rate_time' => $request->getParam('max_rate_time') ?? 0,
             'max_rate_time' => $request->getParam('max_rate_time') ?? 0,

+ 7 - 0
src/Controllers/User/RateController.php

@@ -49,11 +49,18 @@ final class RateController extends BaseController
 
 
         if ($node->is_dynamic_rate) {
         if ($node->is_dynamic_rate) {
             $dynamic_rate_config = json_decode($node->dynamic_rate_config);
             $dynamic_rate_config = json_decode($node->dynamic_rate_config);
+
+            $dynamic_rate_type = match ($node->dynamic_rate_type) {
+                1 => 'linear',
+                default => 'logistic',
+            };
+
             $rates = DynamicRate::getFullDayRates(
             $rates = DynamicRate::getFullDayRates(
                 (float) $dynamic_rate_config?->max_rate,
                 (float) $dynamic_rate_config?->max_rate,
                 (int) $dynamic_rate_config?->max_rate_time,
                 (int) $dynamic_rate_config?->max_rate_time,
                 (float) $dynamic_rate_config?->min_rate,
                 (float) $dynamic_rate_config?->min_rate,
                 (int) $dynamic_rate_config?->min_rate_time,
                 (int) $dynamic_rate_config?->min_rate_time,
+                $dynamic_rate_type
             );
             );
         } else {
         } else {
             $rates = array_fill(0, 24, $node->traffic_rate);
             $rates = array_fill(0, 24, $node->traffic_rate);

+ 8 - 1
src/Controllers/WebAPI/UserController.php

@@ -185,12 +185,19 @@ final class UserController extends BaseController
 
 
         if ($node->is_dynamic_rate) {
         if ($node->is_dynamic_rate) {
             $dynamic_rate_config = json_decode($node->dynamic_rate_config);
             $dynamic_rate_config = json_decode($node->dynamic_rate_config);
+
+            $dynamic_rate_type = match ($node->dynamic_rate_type) {
+                1 => 'linear',
+                default => 'logistic',
+            };
+
             $rate = DynamicRate::getRateByTime(
             $rate = DynamicRate::getRateByTime(
                 (float) $dynamic_rate_config?->max_rate,
                 (float) $dynamic_rate_config?->max_rate,
                 (int) $dynamic_rate_config?->max_rate_time,
                 (int) $dynamic_rate_config?->max_rate_time,
                 (float) $dynamic_rate_config?->min_rate,
                 (float) $dynamic_rate_config?->min_rate,
                 (int) $dynamic_rate_config?->min_rate_time,
                 (int) $dynamic_rate_config?->min_rate_time,
-                (int) date('H')
+                (int) date('H'),
+                $dynamic_rate_type
             );
             );
         } else {
         } else {
             $rate = $node->traffic_rate;
             $rate = $node->traffic_rate;

+ 10 - 0
src/Models/Node.php

@@ -21,6 +21,7 @@ use const DNS_AAAA;
  * @property int    $sort                    节点类型
  * @property int    $sort                    节点类型
  * @property float  $traffic_rate            流量倍率
  * @property float  $traffic_rate            流量倍率
  * @property int    $is_dynamic_rate         是否启用动态流量倍率
  * @property int    $is_dynamic_rate         是否启用动态流量倍率
+ * @property int    $dynamic_rate_type       动态流量倍率计算方式
  * @property string $dynamic_rate_config     动态流量倍率配置
  * @property string $dynamic_rate_config     动态流量倍率配置
  * @property int    $node_class              节点等级
  * @property int    $node_class              节点等级
  * @property float  $node_speedlimit         节点限速
  * @property float  $node_speedlimit         节点限速
@@ -87,6 +88,15 @@ final class Node extends Model
         return $this->is_dynamic_rate ? '是' : '否';
         return $this->is_dynamic_rate ? '是' : '否';
     }
     }
 
 
+    public function dynamicRateType(): string
+    {
+        return match ($this->dynamic_rate_type) {
+            0 => 'Logistic',
+            1 => 'Linear',
+            default => '未知',
+        };
+    }
+
     /**
     /**
      * 获取节点在线状态
      * 获取节点在线状态
      *
      *