Browse Source

perf: optimize config table data type

M1Screw 1 year ago
parent
commit
515ba0168f

+ 14 - 31
README.md

@@ -14,28 +14,16 @@
 ![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/sspanel-uim_SSPanel-Uim-Dev/dev?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)
 ![Sonar Coverage](https://img.shields.io/sonar/coverage/sspanel-uim_SSPanel-Uim-Dev/dev?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)
 
-[![Telegram 通知频道](https://img.shields.io/badge/Telegram-通知频道-blue?style=flat-square)](https://t.me/sspanel_uim)
-[![Telegram 开发频道](https://img.shields.io/badge/Telegram-开发频道-blue?style=flat-square)](https://t.me/sspanel_uim_dev)
+[![Release](https://img.shields.io/badge/Telegram-Release-blue?style=flat-square)](https://t.me/sspanel_uim)
+[![Dev](https://img.shields.io/badge/Telegram-Dev-blue?style=flat-square)](https://t.me/sspanel_uim_dev)
 [![Discord](https://img.shields.io/discord/1049692075085549600?color=5865F2&label=Discord&style=flat-square)](https://discord.gg/A7uFKCvf8V)
 [![Dev Blog](https://img.shields.io/badge/Dev-Blog-blue?style=flat-square)](https://blog.sspanel.org)
 
-## 简介 / TL;DR
+## TL;DR
 
-SSPanel UIM 是一款专为 Shadowsocks(包括 2022 Edition) / V2Ray / Trojan / TUIC 协议设计的多用途代理服务销售管理系统。  
 SSPanel UIM is a multi-purpose proxy service sales management system designed for Shadowsocks / V2Ray / Trojan / TUIC protocol.
 
-## 特性 / Features
-
-- 集成 支付宝当面付,PayPal,Stripe 等多种支付系统
-- 支持多种邮件服务,内置邮件队列功能,无需第三方组件即可使用
-- 内置基于 Bootstrap 5 的 tabler 主题,模板引擎支持
-- 支持 Shadowsocks 2022,TUIC 等最新代理协议
-- 通用订阅接口,一键 json/clash/sip008/sing-box/v2ray-json 格式订阅下发
-- 自定义节点配置,模块化订阅系统,支持多种客户端专用订阅格式
-- 重构的商店系统,支持包括但不限于包年包月,按量计费,接入类型计费等计费模式
-- 重构的定时任务系统,一个命令即可自动完成所有定时任务
-- 深度集成大型语言模型(Large Language Model),支持工单智能回复,文档生成等功能
-- 一键对接 OpenAI,Google AI,Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI 和 Anthropic 等大型语言模型服务
+## Features
 
 - Integrate multiple payment systems such as Alipay F2F, PayPal, Stripe, etc.
 - Support multiple mail services, built-in mail queue function, no third-party components are required to use
@@ -48,34 +36,29 @@ SSPanel UIM is a multi-purpose proxy service sales management system designed fo
 - Deep integration of large language models, support intelligent reply to ticket, document generation and other functions
 - One-click access to OpenAI, Google AI, Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI and Anthropic and other large language model services
 
-## 安装 / Installation
+## Installation
 
-SSPanel UIM 的需要以下程序才能正常的安装和运行:  
 SSPanel UIM requires the following programs to be installed and run normally:
 
 - Git
-- Nginx(必须使用 HTTPS/HTTPS is REQUIRED)
-- PHP 8.2+ (强烈推荐开启 OPcache+JIT /OPcache+JIT is highly recommended)
-- MariaDB 10.11+(关闭严格模式/Disable strict mode)
+- Nginx(HTTPS is REQUIRED)
+- PHP 8.2+ (OPcache+JIT is highly recommended)
+- MariaDB 10.11+(Disable strict mode)
 - Redis 7.0+
 
-## 文档 / Documentation
+## Documentation
 
-> 我们安装,我们更新,我们开发  
 > We install, we update, we develop
 
-[SSPanel UIM Wiki](https://wiki.sspanel.org),在这里你可以找到大部分问题的解答。  
-[SSPanel UIM Wiki](https://wiki.sspanel.org), here you can find answers to most questions.
+[SSPanel UIM Wiki (zh)](https://wiki.sspanel.org), here you can find answers to most questions.
 
-## 项目 / Projects
+## Related Projects
 
-SSPanel-UIM 不单单是一个面板,它还包括了一系列周边项目来帮助你更好的使用它。  
 SSPanel-UIM is not just a panel, it also includes a series of peripheral projects to help you use it better.
 
-你可以在 [SSPanel-UIM 开发团队](https://github.com/sspanel-uim) 的页面查看由我们的开发者维护的其他项目。  
 You can view other projects maintained by our developers on the [SSPanel-UIM Dev Team](https://github.com/sspanel-uim) page.
 
-## 支持开发者 / Support Developers
+## Support Developers
 
 ### M1Screw
 
@@ -86,10 +69,10 @@ You can view other projects maintained by our developers on the [SSPanel-UIM Dev
 <a href="https://www.digitalocean.com/?refcode=50f1a3b6244c"><img src=".github/do.png" width="300"></a>
 
 
-## 赞助商 / Sponsors
+## Sponsors
 
 [![](.github/jetbrains.png)](https://www.jetbrains.com/?from=SSPanel-UIM)
 
-## 协议 / License
+## License
 
 [MIT License](blob/dev/LICENSE)

+ 1 - 1
composer.json

@@ -62,7 +62,7 @@
     "require-dev": {
         "dg/bypass-finals": "^1.6",
         "nunomaduro/phpinsights": "*",
-        "phpunit/phpunit": "^10|^11"
+        "phpunit/phpunit": "^10"
     },
     "scripts": {
         "update-dev-windows": [

+ 70 - 70
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "96d5b940ae14e8988c7d90f216baf01a",
+    "content-hash": "610d76a6a2b0c7ce5ee421d330e55391",
     "packages": [
         {
             "name": "adbario/php-dot-notation",
@@ -622,16 +622,16 @@
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.301.1",
+            "version": "3.301.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "0a910d2b35e7087337cdf3569dc9b6ce232aafba"
+                "reference": "18c0ebd71d3071304f1ea02aa9af75f95863177a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0a910d2b35e7087337cdf3569dc9b6ce232aafba",
-                "reference": "0a910d2b35e7087337cdf3569dc9b6ce232aafba",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/18c0ebd71d3071304f1ea02aa9af75f95863177a",
+                "reference": "18c0ebd71d3071304f1ea02aa9af75f95863177a",
                 "shasum": ""
             },
             "require": {
@@ -711,9 +711,9 @@
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.301.1"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.301.6"
             },
-            "time": "2024-03-15T18:14:42+00:00"
+            "time": "2024-03-22T18:05:21+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
@@ -1703,16 +1703,16 @@
         },
         {
             "name": "illuminate/collections",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/collections.git",
-                "reference": "6a5cd843d209a270587d62c40d797ea35e47ed5d"
+                "reference": "4cbbdae4ef3654378e28e7ebd43cad91adf4a658"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/collections/zipball/6a5cd843d209a270587d62c40d797ea35e47ed5d",
-                "reference": "6a5cd843d209a270587d62c40d797ea35e47ed5d",
+                "url": "https://api.github.com/repos/illuminate/collections/zipball/4cbbdae4ef3654378e28e7ebd43cad91adf4a658",
+                "reference": "4cbbdae4ef3654378e28e7ebd43cad91adf4a658",
                 "shasum": ""
             },
             "require": {
@@ -1754,11 +1754,11 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-03-13T20:54:13+00:00"
+            "time": "2024-03-21T09:12:36+00:00"
         },
         {
             "name": "illuminate/conditionable",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/conditionable.git",
@@ -1804,7 +1804,7 @@
         },
         {
             "name": "illuminate/container",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/container.git",
@@ -1855,7 +1855,7 @@
         },
         {
             "name": "illuminate/contracts",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/contracts.git",
@@ -1903,16 +1903,16 @@
         },
         {
             "name": "illuminate/database",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/database.git",
-                "reference": "c04b70c3a439fbc1ee804b9ce195671d17f3c729"
+                "reference": "b3b8cd87a2271fc9427006dc56710ea9dc55af1c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/database/zipball/c04b70c3a439fbc1ee804b9ce195671d17f3c729",
-                "reference": "c04b70c3a439fbc1ee804b9ce195671d17f3c729",
+                "url": "https://api.github.com/repos/illuminate/database/zipball/b3b8cd87a2271fc9427006dc56710ea9dc55af1c",
+                "reference": "b3b8cd87a2271fc9427006dc56710ea9dc55af1c",
                 "shasum": ""
             },
             "require": {
@@ -1967,11 +1967,11 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-03-15T21:04:19+00:00"
+            "time": "2024-03-19T20:07:36+00:00"
         },
         {
             "name": "illuminate/macroable",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/macroable.git",
@@ -2017,7 +2017,7 @@
         },
         {
             "name": "illuminate/pagination",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/pagination.git",
@@ -2067,16 +2067,16 @@
         },
         {
             "name": "illuminate/support",
-            "version": "v11.0.7",
+            "version": "v11.0.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/support.git",
-                "reference": "79c13b3c068db94563f002b6e49dcb5d03fd19a8"
+                "reference": "9e4c65a95465d6c5d4282c4d2435dc04a2f9f10a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/support/zipball/79c13b3c068db94563f002b6e49dcb5d03fd19a8",
-                "reference": "79c13b3c068db94563f002b6e49dcb5d03fd19a8",
+                "url": "https://api.github.com/repos/illuminate/support/zipball/9e4c65a95465d6c5d4282c4d2435dc04a2f9f10a",
+                "reference": "9e4c65a95465d6c5d4282c4d2435dc04a2f9f10a",
                 "shasum": ""
             },
             "require": {
@@ -2137,7 +2137,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-03-13T15:00:31+00:00"
+            "time": "2024-03-20T20:10:03+00:00"
         },
         {
             "name": "irazasyed/telegram-bot-sdk",
@@ -4854,16 +4854,16 @@
         },
         {
             "name": "smarty/smarty",
-            "version": "v4.4.1",
+            "version": "v4.5.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/smarty-php/smarty.git",
-                "reference": "f4152e9b814ae2369b6e4935c05e1e0c3654318d"
+                "reference": "42b869e3a098b1c8ee07922ccded0e5a5dceadcd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/f4152e9b814ae2369b6e4935c05e1e0c3654318d",
-                "reference": "f4152e9b814ae2369b6e4935c05e1e0c3654318d",
+                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/42b869e3a098b1c8ee07922ccded0e5a5dceadcd",
+                "reference": "42b869e3a098b1c8ee07922ccded0e5a5dceadcd",
                 "shasum": ""
             },
             "require": {
@@ -4914,9 +4914,9 @@
             "support": {
                 "forum": "https://github.com/smarty-php/smarty/discussions",
                 "issues": "https://github.com/smarty-php/smarty/issues",
-                "source": "https://github.com/smarty-php/smarty/tree/v4.4.1"
+                "source": "https://github.com/smarty-php/smarty/tree/v4.5.1"
             },
-            "time": "2024-02-26T13:58:37+00:00"
+            "time": "2024-03-18T14:19:07+00:00"
         },
         {
             "name": "srmklive/paypal",
@@ -5029,16 +5029,16 @@
         },
         {
             "name": "stripe/stripe-php",
-            "version": "v13.14.0",
+            "version": "v13.15.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "d569265e79dc82329dadea1b1088a0a29c7a8a76"
+                "reference": "22963c3596eb198e3dd56fbd95d7de9bc4d44f8f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/d569265e79dc82329dadea1b1088a0a29c7a8a76",
-                "reference": "d569265e79dc82329dadea1b1088a0a29c7a8a76",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/22963c3596eb198e3dd56fbd95d7de9bc4d44f8f",
+                "reference": "22963c3596eb198e3dd56fbd95d7de9bc4d44f8f",
                 "shasum": ""
             },
             "require": {
@@ -5082,9 +5082,9 @@
             ],
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v13.14.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v13.15.0"
             },
-            "time": "2024-03-14T21:12:02+00:00"
+            "time": "2024-03-21T21:05:10+00:00"
         },
         {
             "name": "symfony/clock",
@@ -6915,16 +6915,16 @@
         },
         {
             "name": "composer/pcre",
-            "version": "3.1.2",
+            "version": "3.1.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/pcre.git",
-                "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace"
+                "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace",
-                "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace",
+                "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8",
+                "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8",
                 "shasum": ""
             },
             "require": {
@@ -6966,7 +6966,7 @@
             ],
             "support": {
                 "issues": "https://github.com/composer/pcre/issues",
-                "source": "https://github.com/composer/pcre/tree/3.1.2"
+                "source": "https://github.com/composer/pcre/tree/3.1.3"
             },
             "funding": [
                 {
@@ -6982,7 +6982,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-03-07T15:38:35+00:00"
+            "time": "2024-03-19T10:26:25+00:00"
         },
         {
             "name": "composer/semver",
@@ -7264,16 +7264,16 @@
         },
         {
             "name": "friendsofphp/php-cs-fixer",
-            "version": "v3.51.0",
+            "version": "v3.52.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
-                "reference": "127fa74f010da99053e3f5b62672615b72dd6efd"
+                "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/127fa74f010da99053e3f5b62672615b72dd6efd",
-                "reference": "127fa74f010da99053e3f5b62672615b72dd6efd",
+                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/6e77207f0d851862ceeb6da63e6e22c01b1587bc",
+                "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc",
                 "shasum": ""
             },
             "require": {
@@ -7344,7 +7344,7 @@
             ],
             "support": {
                 "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
-                "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.51.0"
+                "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.52.1"
             },
             "funding": [
                 {
@@ -7352,7 +7352,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2024-02-28T19:50:06+00:00"
+            "time": "2024-03-19T21:02:43+00:00"
         },
         {
             "name": "justinrainbow/json-schema",
@@ -7906,16 +7906,16 @@
         },
         {
             "name": "phpstan/phpdoc-parser",
-            "version": "1.26.0",
+            "version": "1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpdoc-parser.git",
-                "reference": "231e3186624c03d7e7c890ec662b81e6b0405227"
+                "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227",
-                "reference": "231e3186624c03d7e7c890ec662b81e6b0405227",
+                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/86e4d5a4b036f8f0be1464522f4c6b584c452757",
+                "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757",
                 "shasum": ""
             },
             "require": {
@@ -7947,9 +7947,9 @@
             "description": "PHPDoc parser with support for nullable, intersection and generic types",
             "support": {
                 "issues": "https://github.com/phpstan/phpdoc-parser/issues",
-                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0"
+                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.27.0"
             },
-            "time": "2024-02-23T16:05:55+00:00"
+            "time": "2024-03-21T13:14:53+00:00"
         },
         {
             "name": "phpunit/php-code-coverage",
@@ -8274,16 +8274,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "10.5.13",
+            "version": "10.5.15",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7"
+                "reference": "86376e05e8745ed81d88232ff92fee868247b07b"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
-                "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86376e05e8745ed81d88232ff92fee868247b07b",
+                "reference": "86376e05e8745ed81d88232ff92fee868247b07b",
                 "shasum": ""
             },
             "require": {
@@ -8355,7 +8355,7 @@
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.13"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.15"
             },
             "funding": [
                 {
@@ -8371,7 +8371,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-03-12T15:37:41+00:00"
+            "time": "2024-03-22T04:17:47+00:00"
         },
         {
             "name": "psr/cache",
@@ -8794,16 +8794,16 @@
         },
         {
             "name": "sebastian/environment",
-            "version": "6.0.1",
+            "version": "6.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/environment.git",
-                "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951"
+                "reference": "8074dbcd93529b357029f5cc5058fd3e43666984"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951",
-                "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951",
+                "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984",
+                "reference": "8074dbcd93529b357029f5cc5058fd3e43666984",
                 "shasum": ""
             },
             "require": {
@@ -8818,7 +8818,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "6.0-dev"
+                    "dev-main": "6.1-dev"
                 }
             },
             "autoload": {
@@ -8846,7 +8846,7 @@
             "support": {
                 "issues": "https://github.com/sebastianbergmann/environment/issues",
                 "security": "https://github.com/sebastianbergmann/environment/security/policy",
-                "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1"
+                "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0"
             },
             "funding": [
                 {
@@ -8854,7 +8854,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2023-04-11T05:39:26+00:00"
+            "time": "2024-03-23T08:47:14+00:00"
         },
         {
             "name": "sebastian/exporter",

File diff suppressed because it is too large
+ 0 - 126
config/settings.json


+ 22 - 19
db/migrations/2023020100-init.php

@@ -10,21 +10,21 @@ return new class() implements MigrationInterface {
     {
         DB::getPdo()->exec(
             "CREATE TABLE `announcement` (
-                `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '公告ID',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '公告ID',
                 `date` datetime NOT NULL DEFAULT '1989-06-04 00:05:00' COMMENT '公告日期',
-                `content` text NOT NULL DEFAULT '' COMMENT '公告内容',
+                `content` longtext NOT NULL DEFAULT '' COMMENT '公告内容',
                 PRIMARY KEY (`id`)
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `config` (
-                `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
-                `item` varchar(255) DEFAULT NULL COMMENT '配置项',
-                `value` varchar(2048) DEFAULT NULL COMMENT '配置值',
-                `class` varchar(255) DEFAULT 'default' COMMENT '配置类别',
-                `is_public` int(11) DEFAULT 0 COMMENT '是否为公共参数',
-                `type` varchar(255) DEFAULT NULL COMMENT '配置值类型',
-                `default` varchar(255) DEFAULT NULL COMMENT '默认值',
-                `mark` varchar(255) DEFAULT NULL COMMENT '备注',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '配置ID',
+                `item` varchar(255) NOT NULL DEFAULT '' COMMENT '配置项',
+                `value` varchar(2048) NOT NULL DEFAULT '' COMMENT '配置值',
+                `class` varchar(16) NOT NULL DEFAULT '' COMMENT '配置类别',
+                `is_public` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '是否为公共参数',
+                `type` varchar(16) NOT NULL DEFAULT '' COMMENT '配置值类型',
+                `default` varchar(2048) NOT NULL DEFAULT '' COMMENT '默认值',
+                `mark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
                 PRIMARY KEY (`id`),
                 KEY `item` (`item`),
                 KEY `class` (`class`),
@@ -32,7 +32,7 @@ return new class() implements MigrationInterface {
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `detect_ban_log` (
-                `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '封禁记录ID',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '封禁记录ID',
                 `user_id` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '用户ID',
                 `detect_number` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '本次违规次数',
                 `ban_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '封禁时长',
@@ -61,8 +61,8 @@ return new class() implements MigrationInterface {
                 `status` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '状态',
                 PRIMARY KEY (`id`),
                 KEY `user_id` (`user_id`),
-                KEY `node_id` (`node_id`),
-                KEY `list_id` (`list_id`)
+                KEY `list_id` (`list_id`),
+                KEY `node_id` (`node_id`)
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `docs` (
@@ -107,7 +107,7 @@ return new class() implements MigrationInterface {
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `invoice` (
-                `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '账单ID',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '账单ID',
                 `user_id` bigint(20) unsigned DEFAULT 0 COMMENT '归属用户ID',
                 `order_id` bigint(20) unsigned DEFAULT 0 COMMENT '订单ID',
                 `content` longtext DEFAULT '{}' COMMENT '账单内容' CHECK (json_valid(`content`)),
@@ -124,7 +124,7 @@ return new class() implements MigrationInterface {
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `link` (
-                `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '记录ID',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID',
                 `token` varchar(255) NOT NULL DEFAULT '' COMMENT '订阅token',
                 `userid` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '用户ID',
                 PRIMARY KEY (`id`),
@@ -264,10 +264,13 @@ return new class() implements MigrationInterface {
                 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '获取的订阅类型',
                 `request_ip` varchar(255) NOT NULL DEFAULT '' COMMENT '请求IP',
                 `request_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '请求时间',
-                `request_user_agent` varchar(255) NOT NULL DEFAULT '' COMMENT '请求UA',
+                `request_user_agent` varchar(1024) NOT NULL DEFAULT '' COMMENT '请求UA',
                 PRIMARY KEY (`id`),
                 KEY `user_id` (`user_id`),
-                KEY `type` (`type`)
+                KEY `type` (`type`),
+                KEY `request_ip` (`request_ip`),
+                KEY `request_time` (`request_time`),
+                KEY `request_user_agent` (`request_user_agent`)
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `ticket` (
@@ -345,7 +348,7 @@ return new class() implements MigrationInterface {
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
             CREATE TABLE `user_coupon` (
-                `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '优惠码ID',
+                `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '优惠码ID',
                 `code` varchar(255) NOT NULL DEFAULT '' COMMENT '优惠码',
                 `content` longtext NOT NULL DEFAULT '{}' COMMENT '优惠码内容' CHECK (json_valid(`content`)),
                 `limit` longtext NOT NULL DEFAULT '{}' COMMENT '优惠码限制' CHECK (json_valid(`limit`)),
@@ -354,7 +357,7 @@ return new class() implements MigrationInterface {
                 `expire_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '过期时间',
                 PRIMARY KEY (`id`),
                 KEY `id` (`id`),
-                KEY `code` (`code`),
+                UNIQUE KEY `code` (`code`),
                 KEY `expire_time` (`expire_time`)
             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 

+ 1 - 1
db/migrations/2024021900-add_missing_indexes.php

@@ -32,6 +32,6 @@ return new class() implements MigrationInterface {
 
     public function down(): int
     {
-        return 2024012700;
+        return 2024021900;
     }
 };

+ 41 - 0
db/migrations/2024031700-update_data_type.php

@@ -0,0 +1,41 @@
+<?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 announcement MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '公告ID';
+            ALTER TABLE announcement MODIFY COLUMN `content` longtext NOT NULL DEFAULT '' COMMENT '公告内容';
+            ALTER TABLE config MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '配置ID';
+            ALTER TABLE config MODIFY COLUMN `item` varchar(255) NOT NULL DEFAULT '' COMMENT '配置项';
+            ALTER TABLE config MODIFY COLUMN `value` varchar(2048) NOT NULL DEFAULT '' COMMENT '配置值';
+            ALTER TABLE config MODIFY COLUMN `class` varchar(16) NOT NULL DEFAULT '' COMMENT '配置类别';
+            ALTER TABLE config MODIFY COLUMN `is_public` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '是否为公共参数';
+            ALTER TABLE config MODIFY COLUMN `type` varchar(16) NOT NULL DEFAULT '' COMMENT '配置值类型';
+            ALTER TABLE config MODIFY COLUMN `default` varchar(2048) NOT NULL DEFAULT '' COMMENT '默认值';
+            ALTER TABLE config MODIFY COLUMN `mark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注';
+            ALTER TABLE detect_ban_log MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '封禁记录ID';
+            ALTER TABLE invoice MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '账单ID';
+            ALTER TABLE link MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID';
+            ALTER TABLE subscribe_log MODIFY COLUMN `request_user_agent` varchar(1024) NOT NULL DEFAULT '' COMMENT '请求UA';
+            ALTER TABLE subscribe_log ADD KEY IF NOT EXISTS `request_ip` (`request_ip`);
+            ALTER TABLE subscribe_log ADD KEY IF NOT EXISTS `request_time` (`request_time`);
+            ALTER TABLE subscribe_log ADD KEY IF NOT EXISTS `request_user_agent` (`request_user_agent`);
+            ALTER TABLE user_coupon MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '优惠码ID';
+            ALTER TABLE user_coupon DROP KEY IF EXISTS `code`;
+            ALTER TABLE user_coupon ADD UNIQUE KEY IF NOT EXISTS `code` (`code`);
+        ");
+
+        return 2024031700;
+    }
+
+    public function down(): int
+    {
+        return 2024031700;
+    }
+};

+ 0 - 24
src/Command/Tool.php

@@ -19,16 +19,12 @@ use function count;
 use function date;
 use function fgets;
 use function file_get_contents;
-use function file_put_contents;
 use function fwrite;
 use function in_array;
 use function json_decode;
-use function json_encode;
 use function method_exists;
 use function strtolower;
 use function trim;
-use const JSON_PRETTY_PRINT;
-use const JSON_UNESCAPED_UNICODE;
 use const PHP_EOL;
 use const STDIN;
 use const STDOUT;
@@ -39,7 +35,6 @@ final class Tool extends Command
 ├─=: php xcat Tool [选项]
 │ ├─ setTelegram             - 设置 Telegram 机器人
 │ ├─ resetSetting            - 使用默认值覆盖数据库配置
-│ ├─ exportSetting           - 导出数据库配置
 │ ├─ importSetting           - 导入数据库配置
 │ ├─ resetNodePassword       - 重置所有节点通讯密钥
 │ ├─ resetNodeBandwidth      - 重置所有节点流量
@@ -99,24 +94,6 @@ EOL;
         echo '已使用默认值覆盖所有数据库设置' . PHP_EOL;
     }
 
-    public function exportSetting(): void
-    {
-        $settings = Config::all();
-
-        foreach ($settings as $setting) {
-            // 因为主键自增所以即便设置为 null 也会在导入时自动分配 id
-            // 同时避免多位开发者 pull request 时 settings.json 文件 id 重复所可能导致的冲突
-            $setting->id = null;
-            // 避免开发者调试配置泄露
-            $setting->value = $setting->default;
-        }
-
-        $json_settings = json_encode($settings, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
-        file_put_contents('./config/settings.json', $json_settings);
-
-        echo '已导出所有数据库设置' . PHP_EOL;
-    }
-
     public function importSetting(): void
     {
         $json_settings = file_get_contents('./config/settings.json');
@@ -134,7 +111,6 @@ EOL;
 
             if ($query === null) {
                 $new_item = new Config();
-                $new_item->id = null;
                 $new_item->item = $item['item'];
                 $new_item->value = $item['value'];
                 $new_item->class = $item['class'];

Some files were not shown because too many files changed in this diff