GeekQu 5 anni fa
parent
commit
7ffe0df4e8
52 ha cambiato i file con 397 aggiunte e 397 eliminazioni
  1. 1 1
      src/Command/DailyMail.php
  2. 4 4
      src/Command/ExtMail.php
  3. 6 6
      src/Command/FinanceMail.php
  4. 59 59
      src/Command/Job.php
  5. 4 4
      src/Command/SyncRadius.php
  6. 8 8
      src/Command/XCat.php
  7. 5 5
      src/Controllers/Admin/AnnController.php
  8. 2 2
      src/Controllers/Admin/NodeController.php
  9. 1 1
      src/Controllers/Admin/ShopController.php
  10. 2 2
      src/Controllers/Admin/TicketController.php
  11. 20 20
      src/Controllers/Admin/UserController.php
  12. 56 56
      src/Controllers/AuthController.php
  13. 11 11
      src/Controllers/HomeController.php
  14. 6 6
      src/Controllers/LinkController.php
  15. 51 51
      src/Controllers/UserController.php
  16. 36 36
      src/Controllers/VueController.php
  17. 2 2
      src/Models/Shop.php
  18. 3 3
      src/Models/User.php
  19. 3 3
      src/Services/Auth/Cookie.php
  20. 1 1
      src/Services/Auth/Redis.php
  21. 4 4
      src/Services/Aws/Factory.php
  22. 2 2
      src/Services/BitPayment.php
  23. 1 1
      src/Services/Boot.php
  24. 1 1
      src/Services/Factory.php
  25. 3 3
      src/Services/Gateway/AbstractPayment.php
  26. 4 4
      src/Services/Gateway/AopF2F.php
  27. 2 2
      src/Services/Gateway/BitPay.php
  28. 3 3
      src/Services/Gateway/Codepay.php
  29. 4 4
      src/Services/Gateway/PAYJS.php
  30. 10 10
      src/Services/Gateway/PaymentWall.php
  31. 5 5
      src/Services/Gateway/SPay.php
  32. 4 4
      src/Services/Gateway/SPay/Spay_tool.php
  33. 1 1
      src/Services/Gateway/YftPay.php
  34. 1 1
      src/Services/Jwt.php
  35. 1 1
      src/Services/Mail.php
  36. 3 3
      src/Services/Mail/Mailgun.php
  37. 3 3
      src/Services/Mail/SendGrid.php
  38. 1 1
      src/Services/Mail/Ses.php
  39. 7 7
      src/Services/Mail/Smtp.php
  40. 2 2
      src/Services/Password.php
  41. 2 2
      src/Services/Payment.php
  42. 5 5
      src/Services/RedisClient.php
  43. 1 1
      src/Services/View.php
  44. 2 2
      src/Utils/CloudflareDriver.php
  45. 2 2
      src/Utils/Geetest.php
  46. 5 5
      src/Utils/Hash.php
  47. 6 6
      src/Utils/Radius.php
  48. 6 6
      src/Utils/Telegram.php
  49. 8 8
      src/Utils/TelegramProcess.php
  50. 3 3
      src/Utils/Tools.php
  51. 2 2
      src/Utils/Tuling.php
  52. 12 12
      src/Utils/URL.php

+ 1 - 1
src/Command/DailyMail.php

@@ -34,7 +34,7 @@ class DailyMail
 
             if ($user->sendDailyMail == 1) {
                 echo 'Send daily mail to user: ' . $user->id;
-                $subject = Config::get('appName') . '-每日流量报告以及公告';
+                $subject = $_ENV['appName'] . '-每日流量报告以及公告';
                 $to = $user->email;
                 $text = '下面是系统中目前的公告:<br><br>' . $text1 . '<br><br>晚安!';
 

+ 4 - 4
src/Command/ExtMail.php

@@ -16,9 +16,9 @@ class ExtMail
         foreach ($users as $user) {
             if ($user->t == 0) {
                 echo 'Send daily mail to user: ' . $user->id;
-                $subject = Config::get('appName') . '-期待您的回归';
+                $subject = $_ENV['appName'] . '-期待您的回归';
                 $to = $user->email;
-                $text = '似乎您在' . Config::get('appName') . '上的流量一直是 0 呢(P.S:也可能是您没有使用 ss 而使用了其他还不能计入流量的方式....),如果您在使用上遇到了任何困难,请不要犹豫,登录到' . Config::get('appName') . ',您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~';
+                $text = '似乎您在' . $_ENV['appName'] . '上的流量一直是 0 呢(P.S:也可能是您没有使用 ss 而使用了其他还不能计入流量的方式....),如果您在使用上遇到了任何困难,请不要犹豫,登录到' . $_ENV['appName'] . ',您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~';
                 try {
                     Mail::send($to, $subject, 'ext/back.tpl', [
                         'user' => $user, 'text' => $text
@@ -37,9 +37,9 @@ class ExtMail
         foreach ($users as $user) {
             if ($user->t != 0 && $user->t < 1451577599) {
                 echo 'Send daily mail to user: ' . $user->id;
-                $subject = Config::get('appName') . '-期待您的回归';
+                $subject = $_ENV['appName'] . '-期待您的回归';
                 $to = $user->email;
-                $text = '似乎您在 2017 年以来就没有使用过' . Config::get('appName') . '了呢,如果您在使用上遇到了任何困难,请不要犹豫,登录到' . Config::get('appName') . ',您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~';
+                $text = '似乎您在 2017 年以来就没有使用过' . $_ENV['appName'] . '了呢,如果您在使用上遇到了任何困难,请不要犹豫,登录到' . $_ENV['appName'] . ',您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~';
                 try {
                     Mail::send($to, $subject, 'ext/back.tpl', [
                         'user' => $user, 'text' => $text

+ 6 - 6
src/Command/FinanceMail.php

@@ -69,7 +69,7 @@ class FinanceMail
         $adminUser = User::where('is_admin', '=', '1')->get();
         foreach ($adminUser as $user) {
             echo 'Send offline mail to user: ' . $user->id;
-            $subject = Config::get('appName') . '-财务日报';
+            $subject = $_ENV['appName'] . '-财务日报';
             $to = $user->email;
             $title = '财务日报';
             $text = $text_html;
@@ -83,7 +83,7 @@ class FinanceMail
             }
         }
 
-        if (Config::get('finance_public') == true) {
+        if ($_ENV['finance_public'] == true) {
             $sts = new Analytics();
             Telegram::Send(
                 '新鲜出炉的财务日报~' . PHP_EOL .
@@ -136,7 +136,7 @@ class FinanceMail
         $adminUser = User::where('is_admin', '=', '1')->get();
         foreach ($adminUser as $user) {
             echo 'Send offline mail to user: ' . $user->id;
-            $subject = Config::get('appName') . '-财务周报';
+            $subject = $_ENV['appName'] . '-财务周报';
             $to = $user->email;
             $title = '财务周报';
             $text = $text_html;
@@ -150,7 +150,7 @@ class FinanceMail
             }
         }
 
-        if (Config::get('finance_public') == true) {
+        if ($_ENV['finance_public'] == true) {
             $sts = new Analytics();
             Telegram::Send(
                 '新鲜出炉的财务周报~' . PHP_EOL .
@@ -183,7 +183,7 @@ class FinanceMail
         $adminUser = User::where('is_admin', '=', '1')->get();
         foreach ($adminUser as $user) {
             echo 'Send offline mail to user: ' . $user->id;
-            $subject = Config::get('appName') . '-财务月报';
+            $subject = $_ENV['appName'] . '-财务月报';
             $to = $user->email;
             $title = '财务月报';
             $text = $text_html;
@@ -197,7 +197,7 @@ class FinanceMail
             }
         }
 
-        if (Config::get('finance_public') == true) {
+        if ($_ENV['finance_public'] == true) {
             $sts = new Analytics();
             Telegram::Send(
                 '新鲜出炉的财务月报~' . PHP_EOL .

+ 59 - 59
src/Command/Job.php

@@ -51,29 +51,29 @@ class Job
     public static function backup($full = false)
     {
         ini_set('memory_limit', '-1');
-        $to = Config::get('auto_backup_email');
+        $to = $_ENV['auto_backup_email'];
         if ($to == null) {
             return false;
         }
         if (!mkdir('/tmp/ssmodbackup/') && !is_dir('/tmp/ssmodbackup/')) {
             throw new RuntimeException(sprintf('Directory "%s" was not created', '/tmp/ssmodbackup/'));
         }
-        $db_address_array = explode(':', Config::get('db_host'));
+        $db_address_array = explode(':', $_ENV['db_host']);
         if ($full) {
-            system('mysqldump --user=' . Config::get('db_username') . ' --password=' . Config::get('db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . Config::get('db_database') . ' > /tmp/ssmodbackup/mod.sql');
+            system('mysqldump --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . $_ENV['db_database'] . ' > /tmp/ssmodbackup/mod.sql');
         } else {
             system(
-                'mysqldump --user=' . Config::get('db_username') . ' --password=' . Config::get('db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . Config::get('db_database') . ' announcement auto blockip bought code coupon disconnect_ip link login_ip payback radius_ban shop speedtest ss_invite_code ss_node ss_password_reset ticket unblockip user user_token email_verify detect_list relay paylist> /tmp/ssmodbackup/mod.sql',
+                'mysqldump --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' ' . $_ENV['db_database'] . ' announcement auto blockip bought code coupon disconnect_ip link login_ip payback radius_ban shop speedtest ss_invite_code ss_node ss_password_reset ticket unblockip user user_token email_verify detect_list relay paylist> /tmp/ssmodbackup/mod.sql',
                 $ret
             );
             system(
-                'mysqldump --opt --user=' . Config::get('db_username') . ' --password=' . Config::get('db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' -d ' . Config::get('db_database') . ' alive_ip ss_node_info ss_node_online_log user_traffic_log detect_log telegram_session >> /tmp/ssmodbackup/mod.sql',
+                'mysqldump --opt --user=' . $_ENV['db_username'] . ' --password=' . $_ENV['db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' -d ' . $_ENV['db_database'] . ' alive_ip ss_node_info ss_node_online_log user_traffic_log detect_log telegram_session >> /tmp/ssmodbackup/mod.sql',
                 $ret
             );
-            if (Config::get('enable_radius') == true) {
-                $db_address_array = explode(':', Config::get('radius_db_host'));
+            if ($_ENV['enable_radius'] == true) {
+                $db_address_array = explode(':', $_ENV['radius_db_host']);
                 system(
-                    'mysqldump --user=' . Config::get('radius_db_user') . ' --password=' . Config::get('radius_db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . '' . Config::get('radius_db_database') . '> /tmp/ssmodbackup/radius.sql',
+                    'mysqldump --user=' . $_ENV['radius_db_user'] . ' --password=' . $_ENV['radius_db_password'] . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . '' . $_ENV['radius_db_database'] . '> /tmp/ssmodbackup/radius.sql',
                     $ret
                 );
             }
@@ -81,8 +81,8 @@ class Job
 
         system('cp ' . BASE_PATH . '/config/.config.php /tmp/ssmodbackup/configbak.php', $ret);
         echo $ret;
-        system('zip -r /tmp/ssmodbackup.zip /tmp/ssmodbackup/* -P ' . Config::get('auto_backup_passwd'), $ret);
-        $subject = Config::get('appName') . '-备份成功';
+        system('zip -r /tmp/ssmodbackup.zip /tmp/ssmodbackup/* -P ' . $_ENV['auto_backup_passwd'], $ret);
+        $subject = $_ENV['appName'] . '-备份成功';
         $text = '您好,系统已经为您自动备份,请查看附件,用您设定的密码解压。';
         try {
             Mail::send($to, $subject, 'news/backup.tpl', [
@@ -96,7 +96,7 @@ class Job
         system('rm -rf /tmp/ssmodbackup', $ret);
         system('rm /tmp/ssmodbackup.zip', $ret);
 
-        if (Config::get('backup_notify') == true) {
+        if ($_ENV['backup_notify'] == true) {
             Telegram::Send('备份完毕了喵~今天又是安全祥和的一天呢。');
         }
     }
@@ -179,7 +179,7 @@ class Job
                     $user->last_day_t = 0;
                     $user->save();
 
-                    $subject = Config::get('appName') . '-您的流量被重置了';
+                    $subject = $_ENV['appName'] . '-您的流量被重置了';
                     $to = $user->email;
                     $text = '您好,根据您所订购的订单 ID:' . $bought->id . ',流量已经被重置为' . $shop->reset_value() . 'GB';
                     try {
@@ -210,7 +210,7 @@ class Job
                 $user->transfer_enable = $user->auto_reset_bandwidth * 1024 * 1024 * 1024;
                 $user->save();
 
-                $subject = Config::get('appName') . '-您的流量被重置了';
+                $subject = $_ENV['appName'] . '-您的流量被重置了';
                 $to = $user->email;
                 $text = '您好,根据管理员的设置,流量已经被重置为' . $user->auto_reset_bandwidth . 'GB';
                 try {
@@ -358,7 +358,7 @@ class Job
             $shop = Shop::where('id', $bought->shopid)->first();
             if ($shop == null) {
                 $bought->delete();
-                $subject = Config::get('appName') . '-续费失败';
+                $subject = $_ENV['appName'] . '-续费失败';
                 $to = $user->email;
                 $text = '您好,系统为您自动续费商品时,发现该商品已被下架,为能继续正常使用,建议您登录用户面板购买新的商品。';
                 try {
@@ -390,7 +390,7 @@ class Job
                 $bought_new->coupon = '';
                 $bought_new->save();
 
-                $subject = Config::get('appName') . '-续费成功';
+                $subject = $_ENV['appName'] . '-续费成功';
                 $to = $user->email;
                 $text = '您好,系统已经为您自动续费,商品名:' . $shop->name . ',金额:' . $shop->price . ' 元。';
                 try {
@@ -404,7 +404,7 @@ class Job
                 $bought->is_notified = true;
                 $bought->save();
             } elseif ($bought->is_notified == false) {
-                $subject = Config::get('appName') . '-续费失败';
+                $subject = $_ENV['appName'] . '-续费失败';
                 $to = $user->email;
                 $text = '您好,系统为您自动续费商品名:' . $shop->name . ',金额:' . $shop->price . ' 元 时,发现您余额不足,请及时充值。充值后请稍等系统便会自动为您续费。';
                 try {
@@ -428,17 +428,17 @@ class Job
         $adminUser = User::where('is_admin', '=', '1')->get();
 
         //节点掉线检测
-        if (Config::get('enable_detect_offline') == true) {
+        if ($_ENV['enable_detect_offline'] == true) {
             $nodes = Node::all();
 
             foreach ($nodes as $node) {
                 if ($node->isNodeOnline() === false && $node->online == true) {
-                    if (Config::get('useScFtqq') == true && Config::get('enable_detect_offline_useScFtqq') == true) {
-                        $ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
+                    if ($_ENV['useScFtqq'] == true && $_ENV['enable_detect_offline_useScFtqq'] == true) {
+                        $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
                         $postdata = http_build_query(
                             array(
-                                'text' => Config::get('appName') . '-节点掉线了',
+                                'text' => $_ENV['appName'] . '-节点掉线了',
                                 'desp' => $text
                             )
                         );
@@ -456,7 +456,7 @@ class Job
 
                     foreach ($adminUser as $user) {
                         echo 'Send offline mail to user: ' . $user->id;
-                        $subject = Config::get('appName') . '-系统警告';
+                        $subject = $_ENV['appName'] . '-系统警告';
                         $to = $user->email;
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
                         try {
@@ -476,12 +476,12 @@ class Job
                     $node->online = false;
                     $node->save();
                 } elseif ($node->isNodeOnline() === true && $node->online == false) {
-                    if (Config::get('useScFtqq') == true && Config::get('enable_detect_offline_useScFtqq') == true) {
-                        $ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
+                    if ($_ENV['useScFtqq'] == true && $_ENV['enable_detect_offline_useScFtqq'] == true) {
+                        $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
                         $postdata = http_build_query(
                             array(
-                                'text' => Config::get('appName') . '-节点恢复上线了',
+                                'text' => $_ENV['appName'] . '-节点恢复上线了',
                                 'desp' => $text
                             )
                         );
@@ -499,7 +499,7 @@ class Job
                     }
                     foreach ($adminUser as $user) {
                         echo 'Send offline mail to user: ' . $user->id;
-                        $subject = Config::get('appName') . '-系统提示';
+                        $subject = $_ENV['appName'] . '-系统提示';
                         $to = $user->email;
                         $text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
                         try {
@@ -523,7 +523,7 @@ class Job
 
 
         //登录地检测
-        if (Config::get('login_warn') == true) {
+        if ($_ENV['login_warn'] == true) {
             $iplocation = new QQWry();
             $Logs = LoginIp::where('datetime', '>', time() - 60)->get();
             foreach ($Logs as $log) {
@@ -548,7 +548,7 @@ class Job
                                     'utf-8//IGNORE',
                                     $Userlocation
                                 ) . '-' . iconv('gbk', 'utf-8//IGNORE', $location['country']);
-                                $subject = Config::get('appName') . '-系统警告';
+                                $subject = $_ENV['appName'] . '-系统警告';
                                 $to = $user->email;
                                 $text = '您好,系统发现您的账号在 ' . iconv(
                                     'gbk',
@@ -589,7 +589,7 @@ class Job
                 $user->d = 0;
                 $user->last_day_t = 0;
 
-                $subject = Config::get('appName') . '-您的用户账户已经过期了';
+                $subject = $_ENV['appName'] . '-您的用户账户已经过期了';
                 $to = $user->email;
                 $text = '您好,系统发现您的账号已经过期了。';
                 try {
@@ -610,26 +610,26 @@ class Job
 
 
             //余量不足检测
-            if (Config::get('notify_limit_mode') != false) {
+            if ($_ENV['notify_limit_mode'] != false) {
                 $user_traffic_left = $user->transfer_enable - $user->u - $user->d;
                 $under_limit = false;
 
                 if ($user->transfer_enable != 0) {
-                    if (Config::get('notify_limit_mode') == 'per' &&
-                        $user_traffic_left / $user->transfer_enable * 100 < Config::get('notify_limit_value')) {
+                    if ($_ENV['notify_limit_mode'] == 'per' &&
+                        $user_traffic_left / $user->transfer_enable * 100 < $_ENV['notify_limit_value']) {
                         $under_limit = true;
                         $unit_text = '%';
                     }
-                } elseif (Config::get('notify_limit_mode') == 'mb' &&
-                    Tools::flowToMB($user_traffic_left) < Config::get('notify_limit_value')) {
+                } elseif ($_ENV['notify_limit_mode'] == 'mb' &&
+                    Tools::flowToMB($user_traffic_left) < $_ENV['notify_limit_value']) {
                     $under_limit = true;
                     $unit_text = 'MB';
                 }
 
                 if ($under_limit == true && $user->traffic_notified == false) {
-                    $subject = Config::get('appName') . ' - 您的剩余流量过低';
+                    $subject = $_ENV['appName'] . ' - 您的剩余流量过低';
                     $to = $user->email;
-                    $text = '您好,系统发现您剩余流量已经低于 ' . Config::get('notify_limit_value') . $unit_text . ' 。';
+                    $text = '您好,系统发现您剩余流量已经低于 ' . $_ENV['notify_limit_value'] . $unit_text . ' 。';
                     try {
                         Mail::send($to, $subject, 'news/warn.tpl', [
                             'user' => $user,
@@ -646,14 +646,14 @@ class Job
                 }
             }
 
-            if (Config::get('account_expire_delete_days') >= 0 &&
-                strtotime($user->expire_in) + Config::get('account_expire_delete_days') * 86400 < time() &&
-                $user->money <= Config::get('auto_clean_min_money')
+            if ($_ENV['account_expire_delete_days'] >= 0 &&
+                strtotime($user->expire_in) + $_ENV['account_expire_delete_days'] * 86400 < time() &&
+                $user->money <= $_ENV['auto_clean_min_money']
 
             ) {
-                $subject = Config::get('appName') . '-您的用户账户已经被删除了';
+                $subject = $_ENV['appName'] . '-您的用户账户已经被删除了';
                 $to = $user->email;
-                $text = '您好,系统发现您的账户已经过期 ' . Config::get('account_expire_delete_days') . ' 天了,帐号已经被删除。';
+                $text = '您好,系统发现您的账户已经过期 ' . $_ENV['account_expire_delete_days'] . ' 天了,帐号已经被删除。';
                 try {
                     Mail::send($to, $subject, 'news/warn.tpl', [
                         'user' => $user,
@@ -669,17 +669,17 @@ class Job
             }
 
 
-            if (Config::get('auto_clean_uncheck_days') > 0 &&
+            if ($_ENV['auto_clean_uncheck_days'] > 0 &&
                 max(
                     $user->last_check_in_time,
                     strtotime($user->reg_date)
-                ) + (Config::get('auto_clean_uncheck_days') * 86400) < time() &&
+                ) + ($_ENV['auto_clean_uncheck_days'] * 86400) < time() &&
                 $user->class == 0 &&
-                $user->money <= Config::get('auto_clean_min_money')
+                $user->money <= $_ENV['auto_clean_min_money']
             ) {
-                $subject = Config::get('appName') . '-您的用户账户已经被删除了';
+                $subject = $_ENV['appName'] . '-您的用户账户已经被删除了';
                 $to = $user->email;
-                $text = '您好,系统发现您的账号已经 ' . Config::get('auto_clean_uncheck_days') . ' 天没签到了,帐号已经被删除。';
+                $text = '您好,系统发现您的账号已经 ' . $_ENV['auto_clean_uncheck_days'] . ' 天没签到了,帐号已经被删除。';
                 try {
                     Mail::send($to, $subject, 'news/warn.tpl', [
                         'user' => $user,
@@ -693,14 +693,14 @@ class Job
                 continue;
             }
 
-            if (Config::get('auto_clean_unused_days') > 0 &&
-                max($user->t, strtotime($user->reg_date)) + (Config::get('auto_clean_unused_days') * 86400) < time() &&
+            if ($_ENV['auto_clean_unused_days'] > 0 &&
+                max($user->t, strtotime($user->reg_date)) + ($_ENV['auto_clean_unused_days'] * 86400) < time() &&
                 $user->class == 0 &&
-                $user->money <= Config::get('auto_clean_min_money')
+                $user->money <= $_ENV['auto_clean_min_money']
             ) {
-                $subject = Config::get('appName') . '-您的用户账户已经被删除了';
+                $subject = $_ENV['appName'] . '-您的用户账户已经被删除了';
                 $to = $user->email;
-                $text = '您好,系统发现您的账号已经 ' . Config::get('auto_clean_unused_days') . ' 天没使用了,帐号已经被删除。';
+                $text = '您好,系统发现您的账号已经 ' . $_ENV['auto_clean_unused_days'] . ' 天没使用了,帐号已经被删除。';
                 try {
                     Mail::send($to, $subject, 'news/warn.tpl', [
                         'user' => $user,
@@ -719,7 +719,7 @@ class Job
                 strtotime($user->class_expire) > 1420041600
             ) {
                 $text = '您好,系统发现您的账号等级已经过期了。';
-                $reset_traffic = Config::get('class_expire_reset_traffic');
+                $reset_traffic = $_ENV['class_expire_reset_traffic'];
                 if ($reset_traffic >= 0) {
                     $user->transfer_enable = Tools::toGB($reset_traffic);
                     $user->u = 0;
@@ -727,7 +727,7 @@ class Job
                     $user->last_day_t = 0;
                     $text .= '流量已经被重置为' . $reset_traffic . 'GB';
                 }
-                $subject = Config::get('appName') . '-您的账户等级已经过期了';
+                $subject = $_ENV['appName'] . '-您的账户等级已经过期了';
                 $to = $user->email;
                 try {
                     Mail::send($to, $subject, 'news/warn.tpl', [
@@ -766,7 +766,7 @@ class Job
         //节点被墙检测
         $last_time = file_get_contents(BASE_PATH . '/storage/last_detect_gfw_time');
         for ($count = 1; $count <= 12; $count++) {
-            if (time() - $last_time >= Config::get('detect_gfw_interval')) {
+            if (time() - $last_time >= $_ENV['detect_gfw_interval']) {
                 $file_interval = fopen(BASE_PATH . '/storage/last_detect_gfw_time', 'wb');
                 fwrite($file_interval, time());
                 fclose($file_interval);
@@ -778,18 +778,18 @@ class Job
                         $node->online == false) {
                         continue;
                     }
-                    $api_url = Config::get('detect_gfw_url');
+                    $api_url = $_ENV['detect_gfw_url'];
                     $api_url = str_replace(
                         array('{ip}', '{port}'),
-                        array($node->node_ip, Config::get('detect_gfw_port')),
+                        array($node->node_ip, $_ENV['detect_gfw_port']),
                         $api_url
                     );
                     //因为考虑到有v2ray之类的节点,所以不得不使用ip作为参数
                     $result_tcping = false;
-                    $detect_time = Config::get('detect_gfw_count');
+                    $detect_time = $_ENV['detect_gfw_count'];
                     for ($i = 1; $i <= $detect_time; $i++) {
                         $json_tcping = json_decode(file_get_contents($api_url), true);
-                        if (eval('return ' . Config::get('detect_gfw_judge') . ';')) {
+                        if (eval('return ' . $_ENV['detect_gfw_judge'] . ';')) {
                             $result_tcping = true;
                             break;
                         }
@@ -803,7 +803,7 @@ class Job
                         }
                         foreach ($adminUser as $user) {
                             echo 'Send gfw mail to user: ' . $user->id . '-';
-                            $subject = Config::get('appName') . '-系统警告';
+                            $subject = $_ENV['appName'] . '-系统警告';
                             $to = $user->email;
                             $text = '管理员您好,系统发现节点 ' . $node->name . ' 被墙了,请您及时处理。';
                             try {
@@ -828,7 +828,7 @@ class Job
                         }
                         foreach ($adminUser as $user) {
                             echo 'Send gfw mail to user: ' . $user->id . '-';
-                            $subject = Config::get('appName') . '-系统提示';
+                            $subject = $_ENV['appName'] . '-系统提示';
                             $to = $user->email;
                             $text = '管理员您好,系统发现节点 ' . $node->name . ' 溜出墙了。';
                             try {

+ 4 - 4
src/Command/SyncRadius.php

@@ -20,7 +20,7 @@ class SyncRadius
 {
     public static function synclogin()
     {
-        if (Config::get('enable_radius') == false) {
+        if ($_ENV['enable_radius'] == false) {
             return;
         }
         $tempuserbox = array();
@@ -90,7 +90,7 @@ class SyncRadius
 
     public static function syncvpn()
     {
-        if (Config::get('radius_db_host') == '') {
+        if ($_ENV['radius_db_host'] == '') {
             return;
         }
 
@@ -166,7 +166,7 @@ class SyncRadius
             Radius::Add($user, $user->passwd);
 
             echo 'Send sync mail to user: ' . $user->id;
-            $subject = Config::get('appName') . '-密码更新通知';
+            $subject = $_ENV['appName'] . '-密码更新通知';
             $to = $user->email;
             $text = '您好,为了保证密码系统的统一,刚刚系统已经将您 vpn 等连接方式的用户名已经重置为:' . Radius::GetUserName($user->email) . ',密码自动重置为您 ss 的密码:' . $user->passwd . '  了,以后您修改 ss 密码就会自动修改 vpn 等连接方式的密码了,感谢您的支持。 ';
             try {
@@ -182,7 +182,7 @@ class SyncRadius
 
     public static function syncnas()
     {
-        if (Config::get('radius_db_host') != '') {
+        if ($_ENV['radius_db_host'] != '') {
             $md5txt = '';
 
             $nases = RadiusNas::all();

+ 8 - 8
src/Command/XCat.php

@@ -206,11 +206,11 @@ class XCat
             $user->t = 0;
             $user->u = 0;
             $user->d = 0;
-            $user->transfer_enable = Tools::toGB(Config::get('defaultTraffic'));
-            $user->invite_num = Config::get('inviteNum');
+            $user->transfer_enable = Tools::toGB($_ENV['defaultTraffic']);
+            $user->invite_num = $_ENV['inviteNum'];
             $user->ref_by = 0;
             $user->is_admin = 1;
-            $user->expire_in = date('Y-m-d H:i:s', time() + Config::get('user_expire_in_default') * 86400);
+            $user->expire_in = date('Y-m-d H:i:s', time() + $_ENV['user_expire_in_default'] * 86400);
             $user->reg_date = date('Y-m-d H:i:s');
             $user->money = 0;
             $user->im_type = 1;
@@ -218,7 +218,7 @@ class XCat
             $user->class = 0;
             $user->plan = 'A';
             $user->node_speedlimit = 0;
-            $user->theme = Config::get('theme');
+            $user->theme = $_ENV['theme'];
 
             $ga = new GA();
             $secret = $ga->createSecret();
@@ -253,14 +253,14 @@ class XCat
 
     public function setTelegram()
     {
-        $bot = new BotApi(Config::get('telegram_token'));
+        $bot = new BotApi($_ENV['telegram_token']);
         $ch= curl_init();
-        curl_setopt ($ch, CURLOPT_URL, sprintf('https://api.telegram.org/bot%s/deleteWebhook', Config::get('telegram_token')));
+        curl_setopt ($ch, CURLOPT_URL, sprintf('https://api.telegram.org/bot%s/deleteWebhook', $_ENV['telegram_token']));
         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
         $deleteWebhookReturn = json_decode(curl_exec($ch));
         curl_close($ch);
-        if ($deleteWebhookReturn->ok && $deleteWebhookReturn->result && $bot->setWebhook(Config::get('baseUrl') . '/telegram_callback?token=' . Config::get('telegram_request_token')) == 1) {
+        if ($deleteWebhookReturn->ok && $deleteWebhookReturn->result && $bot->setWebhook($_ENV['baseUrl'] . '/telegram_callback?token=' . $_ENV['telegram_request_token']) == 1) {
             echo('设置成功!' . PHP_EOL);
         }
     }
@@ -285,7 +285,7 @@ class XCat
 
     public function sendDailyUsageByTG()
     {
-        $bot = new BotApi(Config::get('telegram_token'));
+        $bot = new BotApi($_ENV['telegram_token']);
         $users = User::where('telegram_id', '>', 0)->get();
         foreach ($users as $user) {
             $u = $user->u;

+ 5 - 5
src/Controllers/Admin/AnnController.php

@@ -35,7 +35,7 @@ class AnnController extends AdminController
         $PushBear = $request->getParam('PushBear');
         $vip = $request->getParam('vip');
         $content = $request->getParam('content');
-        $subject = Config::get('appName') . '-公告';
+        $subject = $_ENV['appName'] . '-公告';
 
         if ($request->getParam('page') == 1) {
             $ann = new Ann();
@@ -50,7 +50,7 @@ class AnnController extends AdminController
             }
         }
         if ($PushBear == 1) {
-            $PushBear_sendkey = Config::get('PushBear_sendkey');
+            $PushBear_sendkey = $_ENV['PushBear_sendkey'];
             $postdata = http_build_query(
                 array(
                     'text' => $subject,
@@ -61,8 +61,8 @@ class AnnController extends AdminController
             file_get_contents('https://pushbear.ftqq.com/sub?' . $postdata, false);
         }
         if ($issend == 1) {
-            $beginSend = ($request->getParam('page') - 1) * Config::get('sendPageLimit');
-            $users = User::where('class', '>=', $vip)->skip($beginSend)->limit(Config::get('sendPageLimit'))->get();
+            $beginSend = ($request->getParam('page') - 1) * $_ENV['sendPageLimit'];
+            $users = User::where('class', '>=', $vip)->skip($beginSend)->limit($_ENV['sendPageLimit'])->get();
             foreach ($users as $user) {
                 $to = $user->email;
                 if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
@@ -78,7 +78,7 @@ class AnnController extends AdminController
                     continue;
                 }
             }
-            if (count($users) == Config::get('sendPageLimit')) {
+            if (count($users) == $_ENV['sendPageLimit']) {
                 $rs['ret'] = 2;
                 $rs['msg'] = $request->getParam('page') + 1;
                 return $response->getBody()->write(json_encode($rs));

+ 2 - 2
src/Controllers/Admin/NodeController.php

@@ -84,8 +84,8 @@ class NodeController extends AdminController
 
         $node->save();
 
-        $domain_name = explode('.' . Config::get('cloudflare_name'), $node->server);
-        if (Config::get('cloudflare_enable') == true) {
+        $domain_name = explode('.' . $_ENV['cloudflare_name'], $node->server);
+        if ($_ENV['cloudflare_enable'] == true) {
             CloudflareDriver::updateRecord($domain_name[0], $node->node_ip);
         }
 

+ 1 - 1
src/Controllers/Admin/ShopController.php

@@ -260,7 +260,7 @@ class ShopController extends AdminController
 
         $datatables->edit('period_sales', static function ($data) {
             $shop = Shop::find($data['id']);
-            $period = Config::get('sales_period');
+            $period = $_ENV['sales_period'];
 
             if ($period == 'expire') {
                 $period = json_decode($shop->content, true)['class_expire'];

+ 2 - 2
src/Controllers/Admin/TicketController.php

@@ -57,9 +57,9 @@ class TicketController extends AdminController
         {
             $adminUser = User::where('id', '=', $ticket_main->userid)->get();
         foreach ($adminUser as $user) {
-            $subject = Config::get('appName') . '-工单被回复';
+            $subject = $_ENV['appName'] . '-工单被回复';
             $to = $user->email;
-            $text = '您好,有人回复了<a href="' . Config::get('baseUrl') . '/user/ticket/' . $ticket_main->id . '/view">工单</a>,请您查看。';
+            $text = '您好,有人回复了<a href="' . $_ENV['baseUrl'] . '/user/ticket/' . $ticket_main->id . '/view">工单</a>,请您查看。';
             try {
                 Mail::send($to, $subject, 'news/warn.tpl', [
                     'user' => $user, 'text' => $text

+ 20 - 20
src/Controllers/Admin/UserController.php

@@ -90,31 +90,31 @@ class UserController extends AdminController
         $user->t = 0;
         $user->u = 0;
         $user->d = 0;
-        $user->method = Config::get('reg_method');
-        $user->protocol = Config::get('reg_protocol');
-        $user->protocol_param = Config::get('reg_protocol_param');
-        $user->obfs = Config::get('reg_obfs');
-        $user->obfs_param = Config::get('reg_obfs_param');
-        $user->forbidden_ip = Config::get('reg_forbidden_ip');
-        $user->forbidden_port = Config::get('reg_forbidden_port');
+        $user->method = $_ENV['reg_method'];
+        $user->protocol = $_ENV['reg_protocol'];
+        $user->protocol_param = $_ENV['reg_protocol_param'];
+        $user->obfs = $_ENV['reg_obfs'];
+        $user->obfs_param = $_ENV['reg_obfs_param'];
+        $user->forbidden_ip = $_ENV['reg_forbidden_ip'];
+        $user->forbidden_port = $_ENV['reg_forbidden_port'];
         $user->im_type = 2;
         $user->im_value = $email;
-        $user->transfer_enable = Tools::toGB(Config::get('defaultTraffic'));
-        $user->invite_num = Config::get('inviteNum');
-        $user->auto_reset_day = Config::get('reg_auto_reset_day');
-        $user->auto_reset_bandwidth = Config::get('reg_auto_reset_bandwidth');
+        $user->transfer_enable = Tools::toGB($_ENV['defaultTraffic']);
+        $user->invite_num = $_ENV['inviteNum'];
+        $user->auto_reset_day = $_ENV['reg_auto_reset_day'];
+        $user->auto_reset_bandwidth = $_ENV['reg_auto_reset_bandwidth'];
         $user->money = 0;
-        $user->class_expire = date('Y-m-d H:i:s', time() + Config::get('user_class_expire_default') * 3600);
-        $user->class = Config::get('user_class_default');
-        $user->node_connector = Config::get('user_conn');
-        $user->node_speedlimit = Config::get('user_speedlimit');
-        $user->expire_in = date('Y-m-d H:i:s', time() + Config::get('user_expire_in_default') * 86400);
+        $user->class_expire = date('Y-m-d H:i:s', time() + $_ENV['user_class_expire_default'] * 3600);
+        $user->class = $_ENV['user_class_default'];
+        $user->node_connector = $_ENV['user_conn'];
+        $user->node_speedlimit = $_ENV['user_speedlimit'];
+        $user->expire_in = date('Y-m-d H:i:s', time() + $_ENV['user_expire_in_default'] * 86400);
         $user->reg_date = date('Y-m-d H:i:s');
         $user->reg_ip = $_SERVER['REMOTE_ADDR'];
         $user->plan = 'A';
-        $user->theme = Config::get('theme');
+        $user->theme = $_ENV['theme'];
 
-        $groups = explode(',', Config::get('ramdom_group'));
+        $groups = explode(',', $_ENV['ramdom_group']);
 
         $user->node_group = $groups[array_rand($groups)];
 
@@ -127,7 +127,7 @@ class UserController extends AdminController
             $res['ret'] = 1;
             $res['msg'] = '新用户注册成功 用户名: ' . $email . ' 随机初始密码: ' . $pass;
             $res['email_error'] = 'success';
-            $subject = Config::get('appName') . '-新用户注册通知';
+            $subject = $_ENV['appName'] . '-新用户注册通知';
             $to = $user->email;
             $text = '您好,管理员已经为您生成账户,用户名: ' . $email . ',登录密码为:' . $pass . ',感谢您的支持。 ';
             try {
@@ -377,7 +377,7 @@ class UserController extends AdminController
             'uid' => $user->id,
             'email' => $user->email,
             'key' => Hash::cookieHash($user->pass, $expire_in),
-            'ip' => md5($_SERVER['REMOTE_ADDR'] . Config::get('key') . $user->id . $expire_in),
+            'ip' => md5($_SERVER['REMOTE_ADDR'] . $_ENV['key'] . $user->id . $expire_in),
             'expire_in' => $expire_in,
             'old_uid' => Utils\Cookie::get('uid'),
             'old_email' => Utils\Cookie::get('email'),

+ 56 - 56
src/Controllers/AuthController.php

@@ -29,10 +29,10 @@ class AuthController extends BaseController
     {
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('enable_login_captcha') === true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_login_captcha'] === true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -41,7 +41,7 @@ class AuthController extends BaseController
             }
         }
 
-        if (Config::get('enable_telegram') === true) {
+        if ($_ENV['enable_telegram'] === true) {
             $login_text = TelegramSessionManager::add_login_session();
             $login = explode('|', $login_text);
             $login_token = $login[0];
@@ -55,8 +55,8 @@ class AuthController extends BaseController
             ->assign('geetest_html', $GtSdk)
             ->assign('login_token', $login_token)
             ->assign('login_number', $login_number)
-            ->assign('telegram_bot', Config::get('telegram_bot'))
-            ->assign('base_url', Config::get('baseUrl'))
+            ->assign('telegram_bot', $_ENV['telegram_bot'])
+            ->assign('base_url', $_ENV['baseUrl'])
             ->assign('recaptcha_sitekey', $recaptcha_sitekey)
             ->display('auth/login.tpl');
     }
@@ -65,10 +65,10 @@ class AuthController extends BaseController
     {
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('captcha_provider') != '') {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['captcha_provider'] != '') {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     $res['recaptchaKey'] = $recaptcha_sitekey;
                     break;
                 case 'geetest':
@@ -93,14 +93,14 @@ class AuthController extends BaseController
         $code = $request->getParam('code');
         $rememberMe = $request->getParam('remember_me');
 
-        if (Config::get('enable_login_captcha') === true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_login_captcha'] === true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
                     $recaptcha = $request->getParam('recaptcha');
                     if ($recaptcha == '') {
                         $ret = false;
                     } else {
-                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . Config::get('recaptcha_secret') . '&response=' . $recaptcha);
+                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . $_ENV['recaptcha_secret'] . '&response=' . $recaptcha);
                         $ret = json_decode($json)->success;
                     }
                     break;
@@ -141,7 +141,7 @@ class AuthController extends BaseController
 
         $time = 3600 * 24;
         if ($rememberMe) {
-            $time = 3600 * 24 * (Config::get('rememberMeDuration') ?: 7);
+            $time = 3600 * 24 * ($_ENV['rememberMeDuration'] ?: 7);
         }
 
         if ($user->ga_enable == 1) {
@@ -218,10 +218,10 @@ class AuthController extends BaseController
 
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('enable_reg_captcha') === true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_reg_captcha'] === true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -230,7 +230,7 @@ class AuthController extends BaseController
             }
         }
 
-        if (Config::get('enable_telegram') === true) {
+        if ($_ENV['enable_telegram'] === true) {
             $login_text = TelegramSessionManager::add_login_session();
             $login = explode('|', $login_text);
             $login_token = $login[0];
@@ -242,11 +242,11 @@ class AuthController extends BaseController
 
         return $this->view()
             ->assign('geetest_html', $GtSdk)
-            ->assign('enable_email_verify', Config::get('enable_email_verify'))
+            ->assign('enable_email_verify', $_ENV['enable_email_verify'])
             ->assign('code', $code)
             ->assign('recaptcha_sitekey', $recaptcha_sitekey)
-            ->assign('telegram_bot', Config::get('telegram_bot'))
-            ->assign('base_url', Config::get('baseUrl'))
+            ->assign('telegram_bot', $_ENV['telegram_bot'])
+            ->assign('base_url', $_ENV['baseUrl'])
             ->assign('login_token', $login_token)
             ->assign('login_number', $login_number)
             ->display('auth/register.tpl');
@@ -255,7 +255,7 @@ class AuthController extends BaseController
 
     public function sendVerify($request, $response, $next)
     {
-        if (Config::get('enable_email_verify') == true) {
+        if ($_ENV['enable_email_verify'] == true) {
             $email = $request->getParam('email');
             $email = trim($email);
 
@@ -280,7 +280,7 @@ class AuthController extends BaseController
             }
 
             $ipcount = EmailVerify::where('ip', '=', $_SERVER['REMOTE_ADDR'])->where('expire_in', '>', time())->count();
-            if ($ipcount >= (int)Config::get('email_verify_iplimit')) {
+            if ($ipcount >= (int)$_ENV['email_verify_iplimit']) {
                 $res['ret'] = 0;
                 $res['msg'] = '此IP请求次数过多';
                 return $response->getBody()->write(json_encode($res));
@@ -297,17 +297,17 @@ class AuthController extends BaseController
             $code = Tools::genRandomNum(6);
 
             $ev = new EmailVerify();
-            $ev->expire_in = time() + Config::get('email_verify_ttl');
+            $ev->expire_in = time() + $_ENV['email_verify_ttl'];
             $ev->ip = $_SERVER['REMOTE_ADDR'];
             $ev->email = $email;
             $ev->code = $code;
             $ev->save();
 
-            $subject = Config::get('appName') . '- 验证邮件';
+            $subject = $_ENV['appName'] . '- 验证邮件';
 
             try {
                 Mail::send($email, $subject, 'auth/verify.tpl', [
-                    'code' => $code, 'expire' => date('Y-m-d H:i:s', time() + Config::get('email_verify_ttl'))
+                    'code' => $code, 'expire' => date('Y-m-d H:i:s', time() + $_ENV['email_verify_ttl'])
                 ], [
                     //BASE_PATH.'/public/assets/email/styles.css'
                 ]);
@@ -327,7 +327,7 @@ class AuthController extends BaseController
 
     public function register_helper($name, $email, $passwd, $code, $imtype, $imvalue, $telegram_id)
     {
-        if (Config::get('register_mode') === 'close') {
+        if ($_ENV['register_mode'] === 'close') {
             $res['ret'] = 0;
             $res['msg'] = '未开放注册。';
             return $res;
@@ -336,7 +336,7 @@ class AuthController extends BaseController
         //dumplin:1、邀请人等级为0则邀请码不可用;2、邀请人invite_num为可邀请次数,填负数则为无限
         $c = InviteCode::where('code', $code)->first();
         if ($c == null) {
-            if (Config::get('register_mode') === 'invite') {
+            if ($_ENV['register_mode'] === 'invite') {
                 $res['ret'] = 0;
                 $res['msg'] = '邀请码无效';
                 return $res;
@@ -375,19 +375,19 @@ class AuthController extends BaseController
         $user->t = 0;
         $user->u = 0;
         $user->d = 0;
-        $user->method = Config::get('reg_method');
-        $user->protocol = Config::get('reg_protocol');
-        $user->protocol_param = Config::get('reg_protocol_param');
-        $user->obfs = Config::get('reg_obfs');
-        $user->obfs_param = Config::get('reg_obfs_param');
-        $user->forbidden_ip = Config::get('reg_forbidden_ip');
-        $user->forbidden_port = Config::get('reg_forbidden_port');
+        $user->method = $_ENV['reg_method'];
+        $user->protocol = $_ENV['reg_protocol'];
+        $user->protocol_param = $_ENV['reg_protocol_param'];
+        $user->obfs = $_ENV['reg_obfs'];
+        $user->obfs_param = $_ENV['reg_obfs_param'];
+        $user->forbidden_ip = $_ENV['reg_forbidden_ip'];
+        $user->forbidden_port = $_ENV['reg_forbidden_port'];
         $user->im_type = $imtype;
         $user->im_value = $antiXss->xss_clean($imvalue);
-        $user->transfer_enable = Tools::toGB(Config::get('defaultTraffic'));
-        $user->invite_num = Config::get('inviteNum');
-        $user->auto_reset_day = Config::get('reg_auto_reset_day');
-        $user->auto_reset_bandwidth = Config::get('reg_auto_reset_bandwidth');
+        $user->transfer_enable = Tools::toGB($_ENV['defaultTraffic']);
+        $user->invite_num = $_ENV['inviteNum'];
+        $user->auto_reset_day = $_ENV['reg_auto_reset_day'];
+        $user->auto_reset_bandwidth = $_ENV['reg_auto_reset_bandwidth'];
         $user->money = 0;
 
         //dumplin:填写邀请人,写入邀请奖励
@@ -395,8 +395,8 @@ class AuthController extends BaseController
         if (($c != null) && $c->user_id != 0) {
             $gift_user = User::where('id', '=', $c->user_id)->first();
             $user->ref_by = $c->user_id;
-            $user->money = Config::get('invite_get_money');
-            $gift_user->transfer_enable += Config::get('invite_gift') * 1024 * 1024 * 1024;
+            $user->money = $_ENV['invite_get_money'];
+            $gift_user->transfer_enable += $_ENV['invite_gift'] * 1024 * 1024 * 1024;
             --$gift_user->invite_num;
             $gift_user->save();
         }
@@ -404,17 +404,17 @@ class AuthController extends BaseController
             $user->telegram_id = $telegram_id;
         }
 
-        $user->class_expire = date('Y-m-d H:i:s', time() + Config::get('user_class_expire_default') * 3600);
-        $user->class = Config::get('user_class_default');
-        $user->node_connector = Config::get('user_conn');
-        $user->node_speedlimit = Config::get('user_speedlimit');
-        $user->expire_in = date('Y-m-d H:i:s', time() + Config::get('user_expire_in_default') * 86400);
+        $user->class_expire = date('Y-m-d H:i:s', time() + $_ENV['user_class_expire_default'] * 3600);
+        $user->class = $_ENV['user_class_default'];
+        $user->node_connector = $_ENV['user_conn'];
+        $user->node_speedlimit = $_ENV['user_speedlimit'];
+        $user->expire_in = date('Y-m-d H:i:s', time() + $_ENV['user_expire_in_default'] * 86400);
         $user->reg_date = date('Y-m-d H:i:s');
         $user->reg_ip = $_SERVER['REMOTE_ADDR'];
         $user->plan = 'A';
-        $user->theme = Config::get('theme');
+        $user->theme = $_ENV['theme'];
 
-        $groups = explode(',', Config::get('ramdom_group'));
+        $groups = explode(',', $_ENV['ramdom_group']);
 
         $user->node_group = $groups[array_rand($groups)];
 
@@ -441,7 +441,7 @@ class AuthController extends BaseController
 
     public function registerHandle($request, $response)
     {
-        if (Config::get('register_mode') === 'close') {
+        if ($_ENV['register_mode'] === 'close') {
             $res['ret'] = 0;
             $res['msg'] = '未开放注册。';
             return $response->getBody()->write(json_encode($res));
@@ -463,14 +463,14 @@ class AuthController extends BaseController
         $imvalue = $request->getParam('wechat');
         $imvalue = trim($imvalue);
 
-        if (Config::get('enable_reg_captcha') === true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_reg_captcha'] === true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
                     $recaptcha = $request->getParam('recaptcha');
                     if ($recaptcha == '') {
                         $ret = false;
                     } else {
-                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . Config::get('recaptcha_secret') . '&response=' . $recaptcha);
+                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . $_ENV['recaptcha_secret'] . '&response=' . $recaptcha);
                         $ret = json_decode($json)->success;
                     }
                     break;
@@ -499,7 +499,7 @@ class AuthController extends BaseController
             return $response->getBody()->write(json_encode($res));
         }
 
-        if (Config::get('enable_email_verify') == true) {
+        if ($_ENV['enable_email_verify'] == true) {
             $mailcount = EmailVerify::where('email', '=', $email)->where('code', '=', $emailcode)->where('expire_in', '>', time())->first();
             if ($mailcount == null) {
                 $res['ret'] = 0;
@@ -534,7 +534,7 @@ class AuthController extends BaseController
             $res['msg'] = '此联络方式已注册';
             return $response->getBody()->write(json_encode($res));
         }
-        if (Config::get('enable_email_verify') == true) {
+        if ($_ENV['enable_email_verify'] == true) {
             EmailVerify::where('email', '=', $email)->delete();
         }
         $res = $this->register_helper($name, $email, $passwd, $code, $imtype, $imvalue, 0);
@@ -557,7 +557,7 @@ class AuthController extends BaseController
             return $response->getBody()->write(json_encode($res));
         }
 
-        if (Config::get('enable_telegram') === true) {
+        if ($_ENV['enable_telegram'] === true) {
             $ret = TelegramSessionManager::check_login_session($token, $number);
             $res['ret'] = $ret;
             return $response->getBody()->write(json_encode($res));
@@ -569,7 +569,7 @@ class AuthController extends BaseController
 
     public function telegram_oauth($request, $response, $args)
     {
-        if (Config::get('enable_telegram') === true) {
+        if ($_ENV['enable_telegram'] === true) {
             $auth_data = $request->getQueryParams();
             if ($this->telegram_oauth_check($auth_data) === true) { // Looks good, proceed.
                 $telegram_id = $auth_data['id'];
@@ -592,7 +592,7 @@ class AuthController extends BaseController
     private function telegram_oauth_check($auth_data)
     {
         $check_hash = $auth_data['hash'];
-        $bot_token = Config::get('telegram_token');
+        $bot_token = $_ENV['telegram_token'];
         unset($auth_data['hash']);
         $data_check_arr = [];
         foreach ($auth_data as $key => $value) {

+ 11 - 11
src/Controllers/HomeController.php

@@ -25,10 +25,10 @@ class HomeController extends BaseController
     {
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('captcha_provider') != '') {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['captcha_provider'] != '') {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -37,7 +37,7 @@ class HomeController extends BaseController
             }
         }
 
-        if (Config::get('enable_telegram') == true) {
+        if ($_ENV['enable_telegram'] == true) {
             $login_text = TelegramSessionManager::add_login_session();
             $login = explode('|', $login_text);
             $login_token = $login[0];
@@ -51,10 +51,10 @@ class HomeController extends BaseController
             ->assign('geetest_html', $GtSdk)
             ->assign('login_token', $login_token)
             ->assign('login_number', $login_number)
-            ->assign('telegram_bot', Config::get('telegram_bot'))
-            ->assign('enable_logincaptcha', Config::get('enable_login_captcha'))
-            ->assign('enable_regcaptcha', Config::get('enable_reg_captcha'))
-            ->assign('base_url', Config::get('baseUrl'))
+            ->assign('telegram_bot', $_ENV['telegram_bot'])
+            ->assign('enable_logincaptcha', $_ENV['enable_login_captcha'])
+            ->assign('enable_regcaptcha', $_ENV['enable_reg_captcha'])
+            ->assign('base_url', $_ENV['baseUrl'])
             ->assign('recaptcha_sitekey', $recaptcha_sitekey)
             ->fetch('index.tpl'));
     }
@@ -108,7 +108,7 @@ class HomeController extends BaseController
     public function telegram($request, $response, $args): ResponseInterface
     {
         $token = $request->getQueryParam('token');
-        if ($token == Config::get('telegram_request_token')) {
+        if ($token == $_ENV['telegram_request_token']) {
             TelegramProcess::process();
             $result = '1';
         } else {
@@ -155,7 +155,7 @@ class HomeController extends BaseController
     public function getOrderList($request, $response, $args): ResponseInterface
     {
         $key = $request->getParam('key');
-        if (!$key || $key != Config::get('key')) {
+        if (!$key || $key != $_ENV['key']) {
             $res['ret'] = 0;
             $res['msg'] = '错误';
             return $response->write(json_encode($res));
@@ -173,7 +173,7 @@ class HomeController extends BaseController
         $key = $request->getParam('key');
         $sn = $request->getParam('sn');
         $url = $request->getParam('url');
-        if (!$key || $key != Config::get('key')) {
+        if (!$key || $key != $_ENV['key']) {
             $res['ret'] = 0;
             $res['msg'] = '错误';
             return $response->write(json_encode($res));

+ 6 - 6
src/Controllers/LinkController.php

@@ -293,7 +293,7 @@ class LinkController extends BaseController
                 'password' => $item['passwd'],
                 'tcp_over_udp' => false,
                 'udp_over_tcp' => false,
-                'group' => Config::get('appName'),
+                'group' => $_ENV['appName'],
                 'protocol' => $item['protocol'],
                 'protocolparam' => $item['protocol_param'],
                 'obfs_udp' => false,
@@ -332,8 +332,8 @@ class LinkController extends BaseController
             'nodeFeedAutoUpdate' => true,
             'serverSubscribes' => [
                 [
-                    'URL' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=0'),
-                    'Group' => Config::get('appName'),
+                    'URL' => ($_ENV['subUrl'] . self::GenerateSSRSubCode($user->id, 0) . '?mu=0'),
+                    'Group' => $_ENV['appName'],
                     'LastUpdateTime' => 0
                 ]
             ],
@@ -381,7 +381,7 @@ class LinkController extends BaseController
                 'timeout' => 5,
                 'id' => $id,
                 'ratio' => $item['ratio'],
-                'subscription_url' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=3')
+                'subscription_url' => ($_ENV['subUrl'] . self::GenerateSSRSubCode($user->id, 0) . '?mu=3')
             ];
             $id++;
         }
@@ -447,14 +447,14 @@ class LinkController extends BaseController
             ],
             'subscriptions' => [
               [
-                'airport' => Config::get('appName'),
+                'airport' => $_ENV['appName'],
                 'encryption' => $user->method,
                 'password' => $user->passwd,
                 'port' => $user->port,
                 'expiry' => $user->class_expire,
                 'traffic_used' => Tools::flowToGB($user->u + $user->d),
                 'traffic_total' => Tools::flowToGB($user->transfer_enable),
-                'url' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=3'),
+                'url' => ($_ENV['subUrl'] . self::GenerateSSRSubCode($user->id, 0) . '?mu=3'),
                 'plugin' => $plugin,
                 'plugin_options' => $plugin_opts,
                 'plugin_arguments' => '',

+ 51 - 51
src/Controllers/UserController.php

@@ -58,10 +58,10 @@ class UserController extends BaseController
 
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('enable_checkin_captcha') == true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_checkin_captcha'] == true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -75,26 +75,26 @@ class UserController extends BaseController
 
         return $this->view()
             ->assign('ssr_sub_token', $ssr_sub_token)
-            ->assign('display_ios_class', Config::get('display_ios_class'))
-            ->assign('display_ios_topup', Config::get('display_ios_topup'))
-            ->assign('ios_account', Config::get('ios_account'))
-            ->assign('ios_password', Config::get('ios_password'))
+            ->assign('display_ios_class', $_ENV['display_ios_class'])
+            ->assign('display_ios_topup', $_ENV['display_ios_topup'])
+            ->assign('ios_account', $_ENV['ios_account'])
+            ->assign('ios_password', $_ENV['ios_password'])
             ->assign('ann', $Ann)
             ->assign('geetest_html', $GtSdk)
-            ->assign('mergeSub', Config::get('mergeSub'))
-            ->assign('subUrl', Config::get('subUrl'))
+            ->assign('mergeSub', $_ENV['mergeSub'])
+            ->assign('subUrl', $_ENV['subUrl'])
             ->assign('user', $this->user)
             ->registerClass('URL', URL::class)
-            ->assign('baseUrl', Config::get('baseUrl'))
+            ->assign('baseUrl', $_ENV['baseUrl'])
             ->assign('recaptcha_sitekey', $recaptcha_sitekey)
             ->display('user/index.tpl');
     }
 
     public function lookingglass($request, $response, $args)
     {
-        $Speedtest = Speedtest::where('datetime', '>', time() - Config::get('Speedtest_duration') * 3600)->orderBy('datetime', 'desc')->get();
+        $Speedtest = Speedtest::where('datetime', '>', time() - $_ENV['Speedtest_duration'] * 3600)->orderBy('datetime', 'desc')->get();
 
-        return $this->view()->assign('speedtest', $Speedtest)->assign('hour', Config::get('Speedtest_duration'))->display('user/lookingglass.tpl');
+        return $this->view()->assign('speedtest', $Speedtest)->assign('hour', $_ENV['Speedtest_duration'])->display('user/lookingglass.tpl');
     }
 
     public function code($request, $response, $args)
@@ -112,7 +112,7 @@ class UserController extends BaseController
 
     public function donate($request, $response, $args)
     {
-        if (Config::get('enable_donate') != true) {
+        if ($_ENV['enable_donate'] != true) {
             exit(0);
         }
 
@@ -253,14 +253,14 @@ class UserController extends BaseController
 
             if ($user->ref_by != '' && $user->ref_by != 0 && $user->ref_by != null) {
                 $gift_user = User::where('id', '=', $user->ref_by)->first();
-                $gift_user->money += ($codeq->number * (Config::get('code_payback') / 100));
+                $gift_user->money += ($codeq->number * ($_ENV['code_payback'] / 100));
                 $gift_user->save();
 
                 $Payback = new Payback();
                 $Payback->total = $codeq->number;
                 $Payback->userid = $this->user->id;
                 $Payback->ref_by = $this->user->ref_by;
-                $Payback->ref_get = $codeq->number * (Config::get('code_payback') / 100);
+                $Payback->ref_get = $codeq->number * ($_ENV['code_payback'] / 100);
                 $Payback->datetime = time();
                 $Payback->save();
             }
@@ -268,7 +268,7 @@ class UserController extends BaseController
             $res['ret'] = 1;
             $res['msg'] = '充值成功,充值的金额为' . $codeq->number . '元。';
 
-            if (Config::get('enable_donate') == true) {
+            if ($_ENV['enable_donate'] == true) {
                 if ($this->user->is_hide == 1) {
                     Telegram::Send('姐姐姐姐,一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元呢~');
                 } else {
@@ -354,7 +354,7 @@ class UserController extends BaseController
 
     public function ResetPort($request, $response, $args)
     {
-        $price = Config::get('port_price');
+        $price = $_ENV['port_price'];
         $user = $this->user;
 
         if ($user->money < $price) {
@@ -384,7 +384,7 @@ class UserController extends BaseController
 
     public function SpecifyPort($request, $response, $args)
     {
-        $price = Config::get('port_price_specify');
+        $price = $_ENV['port_price_specify'];
         $user = $this->user;
 
         if ($user->money < $price) {
@@ -395,7 +395,7 @@ class UserController extends BaseController
 
         $port = $request->getParam('port');
 
-        if ($port < Config::get('min_port') || $port > Config::get('max_port') || Tools::isInt($port) == false) {
+        if ($port < $_ENV['min_port'] || $port > $_ENV['max_port'] || Tools::isInt($port) == false) {
             $res['ret'] = 0;
             $res['msg'] = '端口不在要求范围内';
             return $response->getBody()->write(json_encode($res));
@@ -490,7 +490,7 @@ class UserController extends BaseController
             $array_node['group'] = $node->node_group;
 
             $array_node['raw_node'] = $node;
-            $regex = Config::get('flag_regex');
+            $regex = $_ENV['flag_regex'];
             $matches = array();
             preg_match($regex, $node->name, $matches);
             if (isset($matches[0])) {
@@ -648,8 +648,8 @@ class UserController extends BaseController
 
                 $node_prefix[$name_cheif][] = $node;
 
-                if (Config::get('enable_flag') == true) {
-                    $regex = Config::get('flag_regex');
+                if ($_ENV['enable_flag'] == true) {
+                    $regex = $_ENV['flag_regex'];
                     $matches = array();
                     preg_match($regex, $name_cheif, $matches);
                     $node_flag_file[$name_cheif] = $matches[0] ?? 'null';
@@ -806,7 +806,7 @@ class UserController extends BaseController
 
         $config_service = new Config();
 
-        return $this->view()->assign('user', $this->user)->assign('themes', $themes)->assign('isBlock', $isBlock)->assign('Block', $Block)->assign('bind_token', $bind_token)->assign('telegram_bot', Config::get('telegram_bot'))->assign('config_service', $config_service)
+        return $this->view()->assign('user', $this->user)->assign('themes', $themes)->assign('isBlock', $isBlock)->assign('Block', $Block)->assign('bind_token', $bind_token)->assign('telegram_bot', $_ENV['telegram_bot'])->assign('config_service', $config_service)
             ->registerClass('URL', URL::class)->display('user/edit.tpl');
     }
 
@@ -831,7 +831,7 @@ class UserController extends BaseController
 
     public function buyInvite($request, $response, $args)
     {
-        $price = Config::get('invite_price');
+        $price = $_ENV['invite_price'];
         $num = $request->getParam('num');
         $num = trim($num);
 
@@ -866,7 +866,7 @@ class UserController extends BaseController
 
     public function customInvite($request, $response, $args)
     {
-        $price = Config::get('custom_invite_price');
+        $price = $_ENV['custom_invite_price'];
         $customcode = $request->getParam('customcode');
         $customcode = trim($customcode);
 
@@ -1176,7 +1176,7 @@ class UserController extends BaseController
 
     public function ticket($request, $response, $args)
     {
-        if (Config::get('enable_ticket') != true) {
+        if ($_ENV['enable_ticket'] != true) {
             exit(0);
         }
         $pageNum = $request->getQueryParams()['page'] ?? 1;
@@ -1219,10 +1219,10 @@ class UserController extends BaseController
         $ticket->datetime = time();
         $ticket->save();
 
-        if (Config::get('mail_ticket') == true && $markdown != '') {
+        if ($_ENV['mail_ticket'] == true && $markdown != '') {
             $adminUser = User::where('is_admin', '=', '1')->get();
             foreach ($adminUser as $user) {
-                $subject = Config::get('appName') . '-新工单被开启';
+                $subject = $_ENV['appName'] . '-新工单被开启';
                 $to = $user->email;
                 $text = '管理员,有人开启了新的工单,请您及时处理。';
                 try {
@@ -1236,11 +1236,11 @@ class UserController extends BaseController
             }
         }
 
-        if (Config::get('useScFtqq') == true && $markdown != '') {
-            $ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
+        if ($_ENV['useScFtqq'] == true && $markdown != '') {
+            $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
             $postdata = http_build_query(
                 array(
-                    'text' => Config::get('appName') . '-新工单被开启',
+                    'text' => $_ENV['appName'] . '-新工单被开启',
                     'desp' => $markdown
                 )
             );
@@ -1286,12 +1286,12 @@ class UserController extends BaseController
         }
 
         if ($status == 1 && $ticket_main->status != $status) {
-            if (Config::get('mail_ticket') == true && $markdown != '') {
+            if ($_ENV['mail_ticket'] == true && $markdown != '') {
                 $adminUser = User::where('is_admin', '=', '1')->get();
                 foreach ($adminUser as $user) {
-                    $subject = Config::get('appName') . '-工单被重新开启';
+                    $subject = $_ENV['appName'] . '-工单被重新开启';
                     $to = $user->email;
-                    $text = '管理员,有人重新开启了<a href="' . Config::get('baseUrl') . '/admin/ticket/' . $ticket_main->id . '/view">工单</a>,请您及时处理。';
+                    $text = '管理员,有人重新开启了<a href="' . $_ENV['baseUrl'] . '/admin/ticket/' . $ticket_main->id . '/view">工单</a>,请您及时处理。';
                     try {
                         Mail::send($to, $subject, 'news/warn.tpl', [
                             'user' => $user, 'text' => $text
@@ -1302,11 +1302,11 @@ class UserController extends BaseController
                     }
                 }
             }
-            if (Config::get('useScFtqq') == true && $markdown != '') {
-                $ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
+            if ($_ENV['useScFtqq'] == true && $markdown != '') {
+                $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                 $postdata = http_build_query(
                     array(
-                        'text' => Config::get('appName') . '-工单被重新开启',
+                        'text' => $_ENV['appName'] . '-工单被重新开启',
                         'desp' => $markdown
                     )
                 );
@@ -1318,15 +1318,15 @@ class UserController extends BaseController
                     ));
                 $context = stream_context_create($opts);
                 file_get_contents('https://sc.ftqq.com/' . $ScFtqq_SCKEY . '.send', false, $context);
-                $useScFtqq = Config::get('ScFtqq_SCKEY');
+                $useScFtqq = $_ENV['ScFtqq_SCKEY'];
             }
         } else {
-            if (Config::get('mail_ticket') == true && $markdown != '') {
+            if ($_ENV['mail_ticket'] == true && $markdown != '') {
                 $adminUser = User::where('is_admin', '=', '1')->get();
                 foreach ($adminUser as $user) {
-                    $subject = Config::get('appName') . '-工单被回复';
+                    $subject = $_ENV['appName'] . '-工单被回复';
                     $to = $user->email;
-                    $text = '管理员,有人回复了<a href="' . Config::get('baseUrl') . '/admin/ticket/' . $ticket_main->id . '/view">工单</a>,请您及时处理。';
+                    $text = '管理员,有人回复了<a href="' . $_ENV['baseUrl'] . '/admin/ticket/' . $ticket_main->id . '/view">工单</a>,请您及时处理。';
                     try {
                         Mail::send($to, $subject, 'news/warn.tpl', [
                             'user' => $user, 'text' => $text
@@ -1337,11 +1337,11 @@ class UserController extends BaseController
                     }
                 }
             }
-            if (Config::get('useScFtqq') == true && $markdown != '') {
-                $ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
+            if ($_ENV['useScFtqq'] == true && $markdown != '') {
+                $ScFtqq_SCKEY = $_ENV['ScFtqq_SCKEY'];
                 $postdata = http_build_query(
                     array(
-                        'text' => Config::get('appName') . '-工单被回复',
+                        'text' => $_ENV['appName'] . '-工单被回复',
                         'desp' => $markdown
                     )
                 );
@@ -1649,14 +1649,14 @@ class UserController extends BaseController
 
     public function doCheckIn($request, $response, $args)
     {
-        if (Config::get('enable_checkin_captcha') == true) {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['enable_checkin_captcha'] == true) {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
                     $recaptcha = $request->getParam('recaptcha');
                     if ($recaptcha == '') {
                         $ret = false;
                     } else {
-                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . Config::get('recaptcha_secret') . '&response=' . $recaptcha);
+                        $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . $_ENV['recaptcha_secret'] . '&response=' . $recaptcha);
                         $ret = json_decode($json)->success;
                     }
                     break;
@@ -1682,7 +1682,7 @@ class UserController extends BaseController
             $res['msg'] = '您似乎已经签到过了...';
             return $response->getBody()->write(json_encode($res));
         }
-        $traffic = random_int(Config::get('checkinMin'), Config::get('checkinMax'));
+        $traffic = random_int($_ENV['checkinMin'], $_ENV['checkinMax']);
         $this->user->transfer_enable += Tools::toMB($traffic);
         $this->user->last_check_in_time = time();
         $this->user->save();
@@ -1718,7 +1718,7 @@ class UserController extends BaseController
             return $this->echoJson($response, $res);
         }
 
-        if (Config::get('enable_kill') == true) {
+        if ($_ENV['enable_kill'] == true) {
             Auth::logout();
             $user->kill_user();
             $res['ret'] = 1;
@@ -1863,11 +1863,11 @@ class UserController extends BaseController
             unlink($temp_file_path);
         }
         // 超链接文件内容
-        $site_url_content = '[InternetShortcut]' . PHP_EOL . 'URL=' . Config::get('baseUrl');
+        $site_url_content = '[InternetShortcut]' . PHP_EOL . 'URL=' . $_ENV['baseUrl'];
         // 创建 zip 并添加内容
         $zipArc->open($temp_file_path, \ZipArchive::CREATE);
         $zipArc->addFromString($user_config_file_name, $content);
-        $zipArc->addFromString('点击访问_' . Config::get('appName') . '.url', $site_url_content);
+        $zipArc->addFromString('点击访问_' . $_ENV['appName'] . '.url', $site_url_content);
         Tools::folderToZip($client_path, $zipArc, strlen($client_path));
         $zipArc->close();
 

+ 36 - 36
src/Controllers/VueController.php

@@ -27,10 +27,10 @@ class VueController extends BaseController
         $GtSdk = null;
         $recaptcha_sitekey = null;
         $user = $this->user;
-        if (Config::get('captcha_provider') != '') {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['captcha_provider'] != '') {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -39,7 +39,7 @@ class VueController extends BaseController
             }
         }
 
-        if (Config::get('enable_telegram') == true) {
+        if ($_ENV['enable_telegram'] == true) {
             $login_text = TelegramSessionManager::add_login_session();
             $login = explode('|', $login_text);
             $login_token = $login[0];
@@ -53,23 +53,23 @@ class VueController extends BaseController
             'geetest_html' => $GtSdk,
             'login_token' => $login_token,
             'login_number' => $login_number,
-            'telegram_bot' => Config::get('telegram_bot'),
-            'enable_logincaptcha' => Config::get('enable_login_captcha'),
-            'enable_regcaptcha' => Config::get('enable_reg_captcha'),
-            'enable_checkin_captcha' => Config::get('enable_checkin_captcha'),
-            'base_url' => Config::get('baseUrl'),
+            'telegram_bot' => $_ENV['telegram_bot'],
+            'enable_logincaptcha' => $_ENV['enable_login_captcha'],
+            'enable_regcaptcha' => $_ENV['enable_reg_captcha'],
+            'enable_checkin_captcha' => $_ENV['enable_checkin_captcha'],
+            'base_url' => $_ENV['baseUrl'],
             'recaptcha_sitekey' => $recaptcha_sitekey,
-            'captcha_provider' => Config::get('captcha_provider'),
-            'jump_delay' => Config::get('jump_delay'),
-            'register_mode' => Config::get('register_mode'),
-            'enable_email_verify' => Config::get('enable_email_verify'),
-            'appName' => Config::get('appName'),
+            'captcha_provider' => $_ENV['captcha_provider'],
+            'jump_delay' => $_ENV['jump_delay'],
+            'register_mode' => $_ENV['register_mode'],
+            'enable_email_verify' => $_ENV['enable_email_verify'],
+            'appName' => $_ENV['appName'],
             'dateY' => date('Y'),
             'isLogin' => $user->isLogin,
-            'enable_telegram' => Config::get('enable_telegram'),
-            'enable_mylivechat' => Config::get('enable_mylivechat'),
-            'enable_flag' => Config::get('enable_flag'),
-            'payment_type' => Config::get('payment_system'),
+            'enable_telegram' => $_ENV['enable_telegram'],
+            'enable_mylivechat' => $_ENV['enable_mylivechat'],
+            'enable_flag' => $_ENV['enable_flag'],
+            'payment_type' => $_ENV['payment_system'],
         );
 
         $res['ret'] = 1;
@@ -103,10 +103,10 @@ class VueController extends BaseController
         $ssr_sub_token = LinkController::GenerateSSRSubCode($this->user->id, 0);
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('captcha_provider') != '') {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['captcha_provider'] != '') {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     break;
                 case 'geetest':
                     $uid = time() . random_int(1, 10000);
@@ -115,12 +115,12 @@ class VueController extends BaseController
             }
         }
         $Ann = Ann::orderBy('date', 'desc')->first();
-        $display_ios_class = Config::get('display_ios_class');
-        $ios_account = Config::get('ios_account');
-        $ios_password = Config::get('ios_password');
-        $mergeSub = Config::get('mergeSub');
-        $subUrl = Config::get('subUrl');
-        $baseUrl = Config::get('baseUrl');
+        $display_ios_class = $_ENV['display_ios_class'];
+        $ios_account = $_ENV['ios_account'];
+        $ios_password = $_ENV['ios_password'];
+        $mergeSub = $_ENV['mergeSub'];
+        $subUrl = $_ENV['subUrl'];
+        $baseUrl = $_ENV['baseUrl'];
         $user['online_ip_count'] = $user->online_ip_count();
 
         $res['info'] = array(
@@ -170,11 +170,11 @@ class VueController extends BaseController
             'paybacks' => $paybacks,
             'paybacks_sum' => $paybacks_sum,
             'invite_num' => $user->invite_num,
-            'invitePrice' => Config::get('invite_price'),
-            'customPrice' => Config::get('custom_invite_price'),
-            'invite_gift' => Config::get('invite_gift'),
-            'invite_get_money' => Config::get('invite_get_money'),
-            'code_payback' => Config::get('code_payback'),
+            'invitePrice' => $_ENV['invite_price'],
+            'customPrice' => $_ENV['custom_invite_price'],
+            'invite_gift' => $_ENV['invite_gift'],
+            'invite_get_money' => $_ENV['invite_get_money'],
+            'code_payback' => $_ENV['code_payback'],
         );
 
         $res['ret'] = 1;
@@ -294,10 +294,10 @@ class VueController extends BaseController
     {
         $GtSdk = null;
         $recaptcha_sitekey = null;
-        if (Config::get('captcha_provider') != '') {
-            switch (Config::get('captcha_provider')) {
+        if ($_ENV['captcha_provider'] != '') {
+            switch ($_ENV['captcha_provider']) {
                 case 'recaptcha':
-                    $recaptcha_sitekey = Config::get('recaptcha_sitekey');
+                    $recaptcha_sitekey = $_ENV['recaptcha_sitekey'];
                     $res['recaptchaKey'] = $recaptcha_sitekey;
                     break;
                 case 'geetest':
@@ -380,7 +380,7 @@ class VueController extends BaseController
             $array_node['group'] = $node->node_group;
 
             $array_node['raw_node'] = $node;
-            $regex = Config::get('flag_regex');
+            $regex = $_ENV['flag_regex'];
             $matches = array();
             preg_match($regex, $node->name, $matches);
             if (isset($matches[0])) {

+ 2 - 2
src/Models/Shop.php

@@ -135,7 +135,7 @@ class Shop extends Model
             switch ($key) {
                 case 'bandwidth':
                     if ($is_renew == 0) {
-                        if (Config::get('enable_bought_reset') == true) {
+                        if ($_ENV['enable_bought_reset'] == true) {
                             $user->transfer_enable = $value * 1024 * 1024 * 1024;
                             $user->u = 0;
                             $user->d = 0;
@@ -160,7 +160,7 @@ class Shop extends Model
                     }
                     break;
                 case 'class':
-                    if (Config::get('enable_bought_extend') == true) {
+                    if ($_ENV['enable_bought_extend'] == true) {
                         if ($user->class == $value) {
                             $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $content['class_expire'] * 86400);
                         } else {

+ 3 - 3
src/Models/User.php

@@ -63,8 +63,8 @@ class User extends Model
     {
         $str = str_replace(
             array('%id', '%suffix'),
-            array($this->attributes['id'], Config::get('mu_suffix')),
-            Config::get('mu_regex')
+            array($this->attributes['id'], $_ENV['mu_suffix']),
+            $_ENV['mu_regex']
         );
         preg_match_all("|%-?[1-9]\d*m|U", $str, $matches, PREG_PATTERN_ORDER);
         foreach ($matches[0] as $key) {
@@ -212,7 +212,7 @@ class User extends Model
     {
         $ga = new GA();
         $url = $ga->getUrl(
-            urlencode(Config::get('appName') . '-' . $this->attributes['user_name'] . '-两步验证码'),
+            urlencode($_ENV['appName'] . '-' . $this->attributes['user_name'] . '-两步验证码'),
             $this->attributes['ga_token']
         );
         return $url;

+ 3 - 3
src/Services/Auth/Cookie.php

@@ -19,7 +19,7 @@ class Cookie extends Base
             'uid' => $uid,
             'email' => $user->email,
             'key' => $key,
-            'ip' => md5($_SERVER['REMOTE_ADDR'] . Config::get('key') . $uid . $expire_in),
+            'ip' => md5($_SERVER['REMOTE_ADDR'] . $_ENV['key'] . $uid . $expire_in),
             'expire_in' => $expire_in
         ], $expire_in);
     }
@@ -43,9 +43,9 @@ class Cookie extends Base
             return $user;
         }
 
-        if (Config::get('enable_login_bind_ip') == true) {
+        if ($_ENV['enable_login_bind_ip'] == true) {
             $nodes = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->first();
-            if (($nodes == null) && $ipHash != md5($_SERVER['REMOTE_ADDR'] . Config::get('key') . $uid . $expire_in)) {
+            if (($nodes == null) && $ipHash != md5($_SERVER['REMOTE_ADDR'] . $_ENV['key'] . $uid . $expire_in)) {
                 return $user;
             }
         }

+ 1 - 1
src/Services/Auth/Redis.php

@@ -48,7 +48,7 @@ class Redis extends Base
 
         $ip = $this->client->get($sid . 'ip');
         $nodes = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->first();
-        if ($ip != $_SERVER['REMOTE_ADDR'] && $nodes == null && Config::get('enable_login_bind_ip') == true) {
+        if ($ip != $_SERVER['REMOTE_ADDR'] && $nodes == null && $_ENV['enable_login_bind_ip'] == true) {
             $user = new User();
             $user->isLogin = false;
             return $user;

+ 4 - 4
src/Services/Aws/Factory.php

@@ -11,13 +11,13 @@ class Factory
     {
         $sdk = new Sdk([
             'credentials' => array(
-                'key' => Config::get('aws_access_key_id'),
-                'secret' => Config::get('aws_secret_access_key'),
+                'key' => $_ENV['aws_access_key_id'],
+                'secret' => $_ENV['aws_secret_access_key'],
             ),
-            'region' => Config::get('aws_region'),
+            'region' => $_ENV['aws_region'],
             'version' => 'latest',
             'DynamoDb' => [
-                'region' => Config::get('aws_region')
+                'region' => $_ENV['aws_region']
             ]
         ]);
         return $sdk;

+ 2 - 2
src/Services/BitPayment.php

@@ -13,7 +13,7 @@ class BitPayment
 {
     public static function getClient()
     {
-        return new BitPay(Config::get('bitpay_secret'));
+        return new BitPay($_ENV['bitpay_secret']);
     }
     public static function notify($request, $response, $args)
     {
@@ -25,7 +25,7 @@ class BitPayment
     }
     public static function purchaseHTML()
     {
-        $bitpayConfig = Config::get('bitpay_secret');
+        $bitpayConfig = $_ENV['bitpay_secret'];
         if (self::getClient() != null && $bitpayConfig != '') {
             return self::getClient()->getPurchaseHTML();
         }

+ 1 - 1
src/Services/Boot.php

@@ -8,7 +8,7 @@ class Boot
 {
     public static function setTime()
     {
-        date_default_timezone_set(Config::get('timeZone'));
+        date_default_timezone_set($_ENV['timeZone']);
         View::$beginTime = microtime(true);
     }
 

+ 1 - 1
src/Services/Factory.php

@@ -10,7 +10,7 @@ class Factory
 {
     public static function createAuth()
     {
-        $method = Config::get('authDriver');
+        $method = $_ENV['authDriver'];
         switch ($method) {
             case 'cookie':
                 return new Cookie();

+ 3 - 3
src/Services/Gateway/AbstractPayment.php

@@ -72,18 +72,18 @@ abstract class AbstractPayment
 
         if ($user->ref_by >= 1) {
             $gift_user = User::where('id', '=', $user->ref_by)->first();
-            $gift_user->money += ($codeq->number * (Config::get('code_payback') / 100));
+            $gift_user->money += ($codeq->number * ($_ENV['code_payback'] / 100));
             $gift_user->save();
             $Payback = new Payback();
             $Payback->total = $codeq->number;
             $Payback->userid = $user->id;
             $Payback->ref_by = $user->ref_by;
-            $Payback->ref_get = $codeq->number * (Config::get('code_payback') / 100);
+            $Payback->ref_get = $codeq->number * ($_ENV['code_payback'] / 100);
             $Payback->datetime = time();
             $Payback->save();
         }
 
-        if (Config::get('enable_donate') == true) {
+        if ($_ENV['enable_donate'] == true) {
             if ($user->is_hide == 1) {
                 Telegram::Send('一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元!');
             } else {

+ 4 - 4
src/Services/Gateway/AopF2F.php

@@ -21,10 +21,10 @@ class AopF2F extends AbstractPayment
     {
         $gateway = Omnipay::create('Alipay_AopF2F');
         $gateway->setSignType('RSA2'); //RSA/RSA2
-        $gateway->setAppId(Config::get('f2fpay_app_id'));
-        $gateway->setPrivateKey(Config::get('merchant_private_key')); // 可以是路径,也可以是密钥内容
-        $gateway->setAlipayPublicKey(Config::get('alipay_public_key')); // 可以是路径,也可以是密钥内容
-        $notifyUrl = Config::get('f2fNotifyUrl') ?? (Config::get('baseUrl') . '/payment/notify');
+        $gateway->setAppId($_ENV['f2fpay_app_id']);
+        $gateway->setPrivateKey($_ENV['merchant_private_key']); // 可以是路径,也可以是密钥内容
+        $gateway->setAlipayPublicKey($_ENV['alipay_public_key']); // 可以是路径,也可以是密钥内容
+        $notifyUrl = $_ENV['f2fNotifyUrl'] ?? ($_ENV['baseUrl'] . '/payment/notify');
         $gateway->setNotifyUrl($notifyUrl);
         return $gateway;
     }

+ 2 - 2
src/Services/Gateway/BitPay.php

@@ -102,8 +102,8 @@ class BitPay extends AbstractPayment
         $data['title'] = '支付单号' . $pl->tradeno;
         $data['description'] = '充值:' . $price;
         $data['description'] .= '  元';
-        $data['callback_url'] = Config::get('baseUrl') . '/payment/bitpay/notify';
-        $data['success_url'] = Config::get('baseUrl') . '/user/payment/bitpay/return?merchantTradeNo=';
+        $data['callback_url'] = $_ENV['baseUrl'] . '/payment/bitpay/notify';
+        $data['success_url'] = $_ENV['baseUrl'] . '/user/payment/bitpay/return?merchantTradeNo=';
         $data['success_url'] .= $pl->tradeno;
         $data['cancel_url'] = $data['success_url'];
         if ($type === 'Alipay') {

+ 3 - 3
src/Services/Gateway/Codepay.php

@@ -45,8 +45,8 @@ class Codepay extends AbstractPayment
 
     public function purchase($request, $response, $args)
     {
-        $codepay_id = Config::get('codepay_id');//这里改成码支付ID
-        $codepay_key = Config::get('codepay_key'); //这是您的通讯密钥
+        $codepay_id = $_ENV['codepay_id'];//这里改成码支付ID
+        $codepay_key = $_ENV['codepay_key']; //这是您的通讯密钥
         $user = Auth::getUser();
         $price = $request->getParam('price');
         $type = $request->getParam('type');
@@ -98,7 +98,7 @@ class Codepay extends AbstractPayment
         //以下五行无需更改
         ksort($_POST); //排序post参数
         reset($_POST); //内部指针指向数组中的第一个元素
-        $codepay_key = Config::get('codepay_key'); //这是您的密钥
+        $codepay_key = $_ENV['codepay_key']; //这是您的密钥
         $sign = '';//初始化
         foreach ($_POST as $key => $val) { //遍历POST参数
             if ($val == '' || $key == 'sign') {

+ 4 - 4
src/Services/Gateway/PAYJS.php

@@ -25,7 +25,7 @@ class PAYJS extends AbstractPayment
      */
     public function prepareSign($data)
     {
-        $data['mchid'] = Config::get('payjs_mchid');
+        $data['mchid'] = $_ENV['payjs_mchid'];
         $data = array_filter($data);
         ksort($data);
         return http_build_query($data);
@@ -87,12 +87,12 @@ class PAYJS extends AbstractPayment
         //if ($type != 'alipay') {
             //$type = '';
         //}
-        $data['mchid'] = Config::get('payjs_mchid');
+        $data['mchid'] = $_ENV['payjs_mchid'];
         //$data['type'] = $type;
         $data['out_trade_no'] = $pl->tradeno;
         $data['total_fee'] = (float) $price * 100;
-        $data['notify_url'] = Config::get('baseUrl') . '/payment/notify?way=payjs';
-        //$data['callback_url'] = Config::get('baseUrl') . '/user/code';
+        $data['notify_url'] = $_ENV['baseUrl'] . '/payment/notify?way=payjs';
+        //$data['callback_url'] = $_ENV['baseUrl'] . '/user/code';
         $params = $this->prepareSign($data);
         $data['sign'] = $this->sign($params);
         $url = 'https://payjs.cn/api/cashier?' . http_build_query($data);

+ 10 - 10
src/Services/Gateway/PaymentWall.php

@@ -26,11 +26,11 @@ class PaymentWall extends AbstractPayment
 
     public function notify($request, $response, $args)
     {
-        if (Config::get('pmw_publickey') != '') {
+        if ($_ENV['pmw_publickey'] != '') {
             Paymentwall_Config::getInstance()->set(array(
                 'api_type' => Paymentwall_Config::API_VC,
-                'public_key' => Config::get('pmw_publickey'),
-                'private_key' => Config::get('pmw_privatekey')
+                'public_key' => $_ENV['pmw_publickey'],
+                'private_key' => $_ENV['pmw_privatekey']
             ));
             $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
             if ($pingback->validate()) {
@@ -53,18 +53,18 @@ class PaymentWall extends AbstractPayment
                 $codeq->save();
                 if ($user->ref_by != '' && $user->ref_by != 0 && $user->ref_by != null) {
                     $gift_user = User::where('id', '=', $user->ref_by)->first();
-                    $gift_user->money += ($codeq->number * (Config::get('code_payback') / 100));
+                    $gift_user->money += ($codeq->number * ($_ENV['code_payback'] / 100));
                     $gift_user->save();
                     $Payback = new Payback();
                     $Payback->total = $pingback->getVirtualCurrencyAmount();
                     $Payback->userid = $user->id;
                     $Payback->ref_by = $user->ref_by;
-                    $Payback->ref_get = $codeq->number * (Config::get('code_payback') / 100);
+                    $Payback->ref_get = $codeq->number * ($_ENV['code_payback'] / 100);
                     $Payback->datetime = time();
                     $Payback->save();
                 }
                 echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
-                if (Config::get('enable_donate') == true) {
+                if ($_ENV['enable_donate'] == true) {
                     if ($user->is_hide == 1) {
                         Telegram::Send('姐姐姐姐,一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元呢~');
                     } else {
@@ -84,13 +84,13 @@ class PaymentWall extends AbstractPayment
     {
         Paymentwall_Config::getInstance()->set(array(
             'api_type' => Paymentwall_Config::API_VC,
-            'public_key' => Config::get('pmw_publickey'),
-            'private_key' => Config::get('pmw_privatekey')
+            'public_key' => $_ENV['pmw_publickey'],
+            'private_key' => $_ENV['pmw_privatekey']
         ));
         $user = Auth::getUser();
         $widget = new Paymentwall_Widget(
             $user->id, // id of the end-user who's making the payment
-            Config::get('pmw_widget'),      // widget code, e.g. p1; can be picked inside of your merchant account
+            $_ENV['pmw_widget'],      // widget code, e.g. p1; can be picked inside of your merchant account
             array(),     // array of products - leave blank for Virtual Currency API
             array(
                 'email' => $user->email,
@@ -105,7 +105,7 @@ class PaymentWall extends AbstractPayment
                 )
             ) // additional parameters
         );
-        return $widget->getHtmlCode(array('height' => Config::get('pmw_height'), 'width' => '100%'));
+        return $widget->getHtmlCode(array('height' => $_ENV['pmw_height'], 'width' => '100%'));
     }
 
     public function getReturnHTML($request, $response, $args)

+ 5 - 5
src/Services/Gateway/SPay.php

@@ -41,9 +41,9 @@ class SPay extends AbstractPayment
 
 
         $data['total_fee'] = $total_fee;    //支付金额
-        $data['partner'] = Config::get('alipay_id');    //spay合作者id
-        $data['notify_url'] = Config::get('baseUrl') . '/spay_back';    //不能有get参数 也就是?xxx=xxx&    xxx=xxx
-        $data['return_url'] = Config::get('baseUrl') . '/spay_back';    //不能有get参数 也就是?xxx=xxx&    xxx=xxx
+        $data['partner'] = $_ENV['alipay_id'];    //spay合作者id
+        $data['notify_url'] = $_ENV['baseUrl'] . '/spay_back';    //不能有get参数 也就是?xxx=xxx&    xxx=xxx
+        $data['return_url'] = $_ENV['baseUrl'] . '/spay_back';    //不能有get参数 也就是?xxx=xxx&    xxx=xxx
         $data['out_trade_no'] = $out_trade_no;    //商户唯一订单号
         $data['service'] = 'create_direct_pay_by_user';
         $i = 0;
@@ -58,7 +58,7 @@ class SPay extends AbstractPayment
                 $jk .= '&';
             }
         }
-        $data['sign'] = md5($jk . Config::get('alipay_key'));
+        $data['sign'] = md5($jk . $_ENV['alipay_key']);
         //header("Location: http://www.dayyun.com/pay/pay/alipay.php?".http_build_query($data));
 
 
@@ -91,7 +91,7 @@ class SPay extends AbstractPayment
                 $jk .= '&';
             }
         }
-        $newsign = md5($jk . Config::get('alipay_key'));
+        $newsign = md5($jk . $_ENV['alipay_key']);
         if ($newsign != $sign) {
             die('false');
         }

+ 4 - 4
src/Services/Gateway/SPay/Spay_tool.php

@@ -203,21 +203,21 @@ class Spay_tool
     {
         $alipay_config = array();
 
-        $alipay_config['partner'] = Config::get('alipay_id');
+        $alipay_config['partner'] = $_ENV['alipay_id'];
 
         //收款支付宝账号,以2088开头由16位纯数字组成的字符串,一般情况下收款账号就是签约账号
         $alipay_config['seller_id'] = $alipay_config['partner'];
 
         // MD5密钥,安全检验码,由数字和字母组成的32位字符串,查看地址:https://b.alipay.com/order/pidAndKey.htm
-        $alipay_config['key'] = Config::get('alipay_key');
+        $alipay_config['key'] = $_ENV['alipay_key'];
 
         // 服务器异步通知页面路径  需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
-        $alipay_config['notify_url'] = Config::get('baseUrl') . '/purchase/notify';
+        $alipay_config['notify_url'] = $_ENV['baseUrl'] . '/purchase/notify';
 
         // 页面跳转同步通知页面路径 需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
 
         //此处请填 访问地址+"/user/code"
-        $alipay_config['return_url'] = Config::get('baseUrl') . '/user/code';
+        $alipay_config['return_url'] = $_ENV['baseUrl'] . '/user/code';
 
         //签名方式
         $alipay_config['sign_type'] = strtoupper('MD5');

+ 1 - 1
src/Services/Gateway/YftPay.php

@@ -84,7 +84,7 @@ class YftPay extends AbstractPayment
         //页面跳转同步通知页面路径
         $return_url = $request->getUri()->getScheme() . "://" . $request->getUri()->getHost() . $pay_config->pay_config["return_url"];
         //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
-        $secret = Config::get('yft_secret');
+        $secret = $_ENV['yft_secret'];
         $ss_order_no = self::genOrderNumber();
         /************************************************************/
         //构造要请求的参数数组,无需改动

+ 1 - 1
src/Services/Jwt.php

@@ -8,7 +8,7 @@ class Jwt
 {
     private static function getKey()
     {
-        return Config::get('key');
+        return $_ENV['key'];
     }
 
     public static function encode($input)

+ 1 - 1
src/Services/Mail.php

@@ -20,7 +20,7 @@ class Mail
      */
     public static function getClient()
     {
-        $driver = Config::get('mailDriver');
+        $driver = $_ENV['mailDriver'];
         switch ($driver) {
             case 'mailgun':
                 return new Mailgun();

+ 3 - 3
src/Services/Mail/Mailgun.php

@@ -23,9 +23,9 @@ class Mailgun extends Base
     public function getConfig()
     {
         return [
-            'key' => Config::get('mailgun_key'),
-            'domain' => Config::get('mailgun_domain'),
-            'sender' => Config::get('mailgun_sender')
+            'key' => $_ENV['mailgun_key'],
+            'domain' => $_ENV['mailgun_domain'],
+            'sender' => $_ENV['mailgun_sender']
         ];
     }
 

+ 3 - 3
src/Services/Mail/SendGrid.php

@@ -26,9 +26,9 @@ class SendGrid extends Base
     public function getConfig()
     {
         return [
-            'key' => Config::get('sendgrid_key'),
-            'sender' => Config::get('sendgrid_sender'),
-            'name' => Config::get('sendgrid_name')
+            'key' => $_ENV['sendgrid_key'],
+            'sender' => $_ENV['sendgrid_sender'],
+            'name' => $_ENV['sendgrid_name']
         ];
     }
 

+ 1 - 1
src/Services/Mail/Ses.php

@@ -16,7 +16,7 @@ class Ses extends Base
 
     public function getSender()
     {
-        return Config::get('aws_ses_sender');
+        return $_ENV['aws_ses_sender'];
     }
 
     public function send($to, $subject, $text)

+ 7 - 7
src/Services/Mail/Smtp.php

@@ -22,7 +22,7 @@ class Smtp extends Base
         $mail->Username = $this->config['username'];                 // SMTP username
         $mail->Password = $this->config['passsword'];                    // SMTP password
         if ($_ENV['smtp_ssl'] == true) {
-            $mail->SMTPSecure = (Config::get('smtp_port') == '587' ? 'tls' : 'ssl');                            // Enable TLS encryption, `ssl` also accepted
+            $mail->SMTPSecure = ($_ENV['smtp_port'] == '587' ? 'tls' : 'ssl');                            // Enable TLS encryption, `ssl` also accepted
         }
         $mail->Port = $this->config['port'];                                    // TCP port to connect to
         $mail->setFrom($this->config['sender'], $this->config['name']);
@@ -33,12 +33,12 @@ class Smtp extends Base
     public function getConfig()
     {
         return [
-            'host' => Config::get('smtp_host'),
-            'username' => Config::get('smtp_username'),
-            'port' => Config::get('smtp_port'),
-            'sender' => Config::get('smtp_sender'),
-            'name' => Config::get('smtp_name'),
-            'passsword' => Config::get('smtp_passsword')
+            'host' => $_ENV['smtp_host'],
+            'username' => $_ENV['smtp_username'],
+            'port' => $_ENV['smtp_port'],
+            'sender' => $_ENV['smtp_sender'],
+            'name' => $_ENV['smtp_name'],
+            'passsword' => $_ENV['smtp_passsword']
         ];
     }
 

+ 2 - 2
src/Services/Password.php

@@ -27,8 +27,8 @@ class Password
         if (!$pwdRst->save()) {
             return false;
         }
-        $subject = Config::get('appName') . '重置密码';
-        $resetUrl = Config::get('baseUrl') . '/password/token/' . $pwdRst->token;
+        $subject = $_ENV['appName'] . '重置密码';
+        $resetUrl = $_ENV['baseUrl'] . '/password/token/' . $pwdRst->token;
         try {
             Mail::send($email, $subject, 'password/reset.tpl', [
                 'resetUrl' => $resetUrl

+ 2 - 2
src/Services/Payment.php

@@ -16,7 +16,7 @@ class Payment
 {
     public static function getClient()
     {
-        $method = Config::get('payment_system');
+        $method = $_ENV['payment_system'];
         switch ($method) {
             case ('codepay'):
                 return new Codepay();
@@ -29,7 +29,7 @@ class Payment
             case ('chenAlipay'):
                 return new ChenPay();
             case ('payjs'):
-                return new PAYJS(Config::get('payjs_key'));
+                return new PAYJS($_ENV['payjs_key']);
             case ('yftpay'):
                 return new YftPay();
             default:

+ 5 - 5
src/Services/RedisClient.php

@@ -12,11 +12,11 @@ class RedisClient
     public function __construct()
     {
         $config = [
-            'scheme' => Config::get('redis_scheme'),
-            'password' => Config::get('redis_password'),
-            'host' => Config::get('redis_host'),
-            'port' => Config::get('redis_port'),
-            'database' => Config::get('redis_database'),
+            'scheme' => $_ENV['redis_scheme'],
+            'password' => $_ENV['redis_password'],
+            'host' => $_ENV['redis_host'],
+            'port' => $_ENV['redis_port'],
+            'database' => $_ENV['redis_database'],
         ];
         $this->client = new Client($config);
     }

+ 1 - 1
src/Services/View.php

@@ -19,7 +19,7 @@ class View
         if ($user->isLogin) {
             $theme = $user->theme;
         } else {
-            $theme = Config::get('theme');
+            $theme = $_ENV['theme'];
         }
 
         $can_backtoadmin = 0;

+ 2 - 2
src/Utils/CloudflareDriver.php

@@ -37,11 +37,11 @@ class CloudflareDriver
 
     public static function updateRecord($name, $content, $proxied = false)
     {
-        $key = new APIKey(Config::get('cloudflare_email'), Config::get('cloudflare_key'));
+        $key = new APIKey($_ENV['cloudflare_email'], $_ENV['cloudflare_key']);
         $adapter = new Guzzle($key);
         $zones = new Zones($adapter);
 
-        $zoneID = $zones->getZoneID(Config::get('cloudflare_name'));
+        $zoneID = $zones->getZoneID($_ENV['cloudflare_name']);
 
         $dns = new DNS($adapter);
 

+ 2 - 2
src/Utils/Geetest.php

@@ -13,7 +13,7 @@ class Geetest
 {
     public static function get($user_id = null)
     {
-        $GtSdk = new GeetestLib(Config::get('geetest_id'), Config::get('geetest_key'));
+        $GtSdk = new GeetestLib($_ENV['geetest_id'], $_ENV['geetest_key']);
         $status = $GtSdk->pre_process($user_id);
         $ret = json_decode($GtSdk->get_response_str());
         session_start();
@@ -25,7 +25,7 @@ class Geetest
     public static function verify($geetest_challenge, $geetest_validate, $geetest_seccode)
     {
         session_start();
-        $GtSdk = new GeetestLib(Config::get('geetest_id'), Config::get('geetest_key'));
+        $GtSdk = new GeetestLib($_ENV['geetest_id'], $_ENV['geetest_key']);
         $user_id = $_SESSION['user_id'];
         if ($_SESSION['gtserver'] == 1) {
             $result = $GtSdk->success_validate($geetest_challenge, $geetest_validate, $geetest_seccode, $user_id);

+ 5 - 5
src/Utils/Hash.php

@@ -9,7 +9,7 @@ class Hash
 {
     public static function passwordHash($pass)
     {
-        $method = Config::get('pwdMethod');
+        $method = $_ENV['pwdMethod'];
         switch ($method) {
             case 'md5':
                 return self::md5WithSalt($pass);
@@ -34,24 +34,24 @@ class Hash
 
     public static function cookieHash($passHash, $expire_in)
     {
-        return substr(hash('sha256', $passHash . Config::get('key') . $expire_in), 5, 45);
+        return substr(hash('sha256', $passHash . $_ENV['key'] . $expire_in), 5, 45);
     }
 
     public static function md5WithSalt($pwd)
     {
-        $salt = Config::get('salt');
+        $salt = $_ENV['salt'];
         return md5($pwd . $salt);
     }
 
     public static function sha256WithSalt($pwd)
     {
-        $salt = Config::get('salt');
+        $salt = $_ENV['salt'];
         return hash('sha256', $pwd . $salt);
     }
 
     public static function checkPassword($hashedPassword, $password)
     {
-        if (in_array(Config::get('pwdMethod'), ['bcrypt', 'argon2i', 'argon2id'])) {
+        if (in_array($_ENV['pwdMethod'], ['bcrypt', 'argon2i', 'argon2id'])) {
             return password_verify($password, $hashedPassword);
         }
         return ($hashedPassword == self::passwordHash($password));

+ 6 - 6
src/Utils/Radius.php

@@ -17,7 +17,7 @@ class Radius
      */
     public static function Add($user, $pwd)
     {
-        if (Config::get('enable_radius') == true) {
+        if ($_ENV['enable_radius'] == true) {
             $email = $user->email;
             $email = str_replace(array('@', '.'), '', $email);
 
@@ -51,7 +51,7 @@ class Radius
 
     public static function Delete($email)
     {
-        if (Config::get('enable_radius') == true) {
+        if ($_ENV['enable_radius'] == true) {
             $email = str_replace(array('@', '.'), '', $email);
 
 
@@ -66,7 +66,7 @@ class Radius
 
     public static function ChangeUserName($origin_email, $new_email, $passwd)
     {
-        if (Config::get('enable_radius') == true) {
+        if ($_ENV['enable_radius'] == true) {
             $email1 = str_replace(array('@', '.'), '', $origin_email);
             $email2 = str_replace(array('@', '.'), '', $new_email);
 
@@ -105,14 +105,14 @@ class Radius
 
     public static function AddNas($ip, $name)
     {
-        if (Config::get('enable_radius') == true) {
+        if ($_ENV['enable_radius'] == true) {
             $exists = RadiusNas::where('shortname', $ip)->first();
             if ($exists == null) {
                 $exists = new RadiusNas();
                 $exists->nasname = $ip;
                 $exists->shortname = $ip;
                 $exists->type = 'other';
-                $exists->secret = Config::get('radius_secret');
+                $exists->secret = $_ENV['radius_secret'];
                 $exists->description = $ip;
                 $exists->save();
             }
@@ -121,7 +121,7 @@ class Radius
 
     public static function DelNas($ip)
     {
-        if (Config::get('enable_radius') == true) {
+        if ($_ENV['enable_radius'] == true) {
             RadiusNas::where('shortname', $ip)->delete();
         }
     }

+ 6 - 6
src/Utils/Telegram.php

@@ -14,10 +14,10 @@ class Telegram
      */
     public static function Send($messageText)
     {
-        if (Config::get('enable_telegram') == true) {
-            $bot = new BotApi(Config::get('telegram_token'));
+        if ($_ENV['enable_telegram'] == true) {
+            $bot = new BotApi($_ENV['telegram_token']);
             try {
-                $bot->sendMessage(Config::get('telegram_chatid'), $messageText);
+                $bot->sendMessage($_ENV['telegram_chatid'], $messageText);
             } catch (Exception $e) {
                 echo $e->getMessage();
             }
@@ -27,10 +27,10 @@ class Telegram
 
     public static function SendMarkdown($messageText)
     {
-        if (Config::get('enable_telegram') == true) {
-            $bot = new BotApi(Config::get('telegram_token'));
+        if ($_ENV['enable_telegram'] == true) {
+            $bot = new BotApi($_ENV['telegram_token']);
             try {
-                $bot->sendMessage(Config::get('telegram_chatid'), $messageText, 'Markdown');
+                $bot->sendMessage($_ENV['telegram_chatid'], $messageText, 'Markdown');
             } catch (Exception $e) {
                 echo $e->getMessage();
             }

+ 8 - 8
src/Utils/TelegramProcess.php

@@ -31,7 +31,7 @@ class TelegramProcess
             switch (true) {
                 case (strpos($callback_data, 'mu')):
                     $ssr_sub_token = LinkController::GenerateSSRSubCode($user->id, 0);
-                    $subUrl = Config::get('subUrl');
+                    $subUrl = $_ENV['subUrl'];
                     $reply_message = self::$all_rss[$callback_data] . ': ' . $subUrl . $ssr_sub_token . $callback_data . PHP_EOL;
                     break;
                 case ($callback_data == 'clean_link'):
@@ -62,7 +62,7 @@ class TelegramProcess
                         $reply['message'] = '您今天已经签过到了!';
                         break;
                     }
-                    $traffic = random_int(Config::get('checkinMin'), Config::get('checkinMax'));
+                    $traffic = random_int($_ENV['checkinMin'], $_ENV['checkinMax']);
                     $user->transfer_enable += Tools::toMB($traffic);
                     $user->last_check_in_time = time();
                     $user->save();
@@ -196,12 +196,12 @@ class TelegramProcess
 
                     foreach ($photo_id_array as $key => $value) {
                         $file = $bot->getFile($value);
-                        $qrcode_text = QRcode::decode('https://api.telegram.org/file/bot' . Config::get('telegram_token') . '/' . $file->getFilePath());
+                        $qrcode_text = QRcode::decode('https://api.telegram.org/file/bot' . $_ENV['telegram_token'] . '/' . $file->getFilePath());
 
                         if ($qrcode_text == null) {
                             foreach ($photo_id_list_array[$key] as $fail_key => $fail_value) {
                                 $fail_file = $bot->getFile($fail_value);
-                                $qrcode_text = QRcode::decode('https://api.telegram.org/file/bot' . Config::get('telegram_token') . '/' . $fail_file->getFilePath());
+                                $qrcode_text = QRcode::decode('https://api.telegram.org/file/bot' . $_ENV['telegram_token'] . '/' . $fail_file->getFilePath());
                                 if ($qrcode_text != null) {
                                     break;
                                 }
@@ -243,7 +243,7 @@ class TelegramProcess
             }
         } else {
             //群组
-            if (Config::get('telegram_group_quiet') == true) {
+            if ($_ENV['telegram_group_quiet'] == true) {
                 return;
             }
             $bot->sendChatAction($message->getChat()->getId(), 'typing');
@@ -273,13 +273,13 @@ class TelegramProcess
                     break;
                 default:
                     if ($message->getText() != null) {
-                        if ($message->getChat()->getId() == Config::get('telegram_chatid')) {
+                        if ($message->getChat()->getId() == $_ENV['telegram_chatid']) {
                             $reply['message'] = Tuling::chat($message->getFrom()->getId(), $message->getText());
                         } else {
                             $reply['message'] = '不约,叔叔我们不约';
                         }
                     }
-                    if ($message->getNewChatMember() != null && Config::get('enable_welcome_message') == true) {
+                    if ($message->getNewChatMember() != null && $_ENV['enable_welcome_message'] == true) {
                         $reply['message'] = '欢迎 ' . $message->getNewChatMember()->getFirstName() . ' ' . $message->getNewChatMember()->getLastName();
                     } else {
                         $reply['message'] = null;
@@ -294,7 +294,7 @@ class TelegramProcess
     public static function process()
     {
         try {
-            $bot = new Client(Config::get('telegram_token'));
+            $bot = new Client($_ENV['telegram_token']);
             // or initialize with botan.io tracker api key
             // $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
 

+ 3 - 3
src/Utils/Tools.php

@@ -129,7 +129,7 @@ class Tools
 
     public static function genSID()
     {
-        $unid = uniqid(Config::get('key'), true);
+        $unid = uniqid($_ENV['key'], true);
         return Hash::sha256WithSalt($unid);
     }
 
@@ -152,7 +152,7 @@ class Tools
     {
         //检索User数据表现有port
         $det = User::pluck('port')->toArray();
-        $port = array_diff(range(Config::get('min_port'), Config::get('max_port')), $det);
+        $port = array_diff(range($_ENV['min_port'], $_ENV['max_port']), $det);
         shuffle($port);
         return $port[0];
     }
@@ -280,7 +280,7 @@ class Tools
 
         $relay_able_list = Config::getSupportParam('relay_able_protocol');
 
-        return in_array($user->protocol, $relay_able_list) || Config::get('relay_insecure_mode') == true;
+        return in_array($user->protocol, $relay_able_list) || $_ENV['relay_insecure_mode'] == true;
     }
 
     public static function has_conflict_rule($input_rule, $ruleset, $edit_rule_id = 0, $origin_node_id = 0, $user_id = 0)

+ 2 - 2
src/Utils/Tuling.php

@@ -8,9 +8,9 @@ class Tuling
 {
     public static function chat($user, $text)
     {
-        if (Config::get('enable_tuling') == true) {
+        if ($_ENV['enable_tuling'] == true) {
             $data = array();
-            $data['key'] = Config::get('tuling_apikey');
+            $data['key'] = $_ENV['tuling_apikey'];
             $data['userid'] = $user;
             $data['info'] = $text;
 

+ 12 - 12
src/Utils/URL.php

@@ -243,7 +243,7 @@ class URL
         if (strtotime($user->expire_in) < time()) {
             return $return_url;
         }
-        if (Config::get('mergeSub') == true) {
+        if ($_ENV['mergeSub'] == true) {
             $items = array_merge(self::getAllItems($user, 1, $is_ss), self::getAllItems($user, 0, $is_ss));
         } else {
             $items = self::getAllItems($user, $is_mu, $is_ss);
@@ -266,7 +266,7 @@ class URL
         if ($is_ss == 2) {
             $personal_info = $item['method'] . ':' . $item['passwd'] . '@' . $item['address'] . ':' . $item['port'];
             $ssurl = 'ss://' . Tools::base64_url_encode($personal_info);
-            $ssurl .= '#' . rawurlencode(Config::get('appName') . ' - ' . $item['remark']);
+            $ssurl .= '#' . rawurlencode($_ENV['appName'] . ' - ' . $item['remark']);
         } else {
             $personal_info = $item['method'] . ':' . $item['passwd'];
             $ssurl = 'ss://' . Tools::base64_url_encode($personal_info) . '@' . $item['address'] . ':' . $item['port'];
@@ -284,7 +284,7 @@ class URL
                 }
                 $ssurl .= '?plugin=' . rawurlencode($plugin);
             }
-            $ssurl .= '#' . rawurlencode(Config::get('appName') . ' - ' . $item['remark']);
+            $ssurl .= '#' . rawurlencode($_ENV['appName'] . ' - ' . $item['remark']);
         }
         return $ssurl;
     }
@@ -337,14 +337,14 @@ class URL
             return null;
         }
         $array_all = array();
-        $array_all['airport'] = Config::get('appName');
+        $array_all['airport'] = $_ENV['appName'];
         $array_all['port'] = $user->port;
         $array_all['encryption'] = $user->method;
         $array_all['password'] = $user->passwd;
         $array_all['traffic_used'] = Tools::flowToGB($user->u + $user->d);
         $array_all['traffic_total'] = Tools::flowToGB($user->transfer_enable);
         $array_all['expiry'] = $user->class_expire;
-        $array_all['url'] = Config::get('subUrl') . LinkController::GenerateSSRSubCode($user->id, 0) . '?mu=3';
+        $array_all['url'] = $_ENV['subUrl'] . LinkController::GenerateSSRSubCode($user->id, 0) . '?mu=3';
         $plugin_options = '';
         if (strpos($user->obfs, 'http') != false) {
             $plugin_options = 'obfs=http';
@@ -534,7 +534,7 @@ class URL
             $mu_user->obfs_param = $user->getMuMd5();
             $mu_user->protocol_param = $user->id . ':' . $user->passwd;
             $user = $mu_user;
-            if (Config::get('mergeSub') != true) {
+            if ($_ENV['mergeSub'] != true) {
                 $node_name .= ' - ' . $mu_port . ' 单端口';
             }
         }
@@ -573,8 +573,8 @@ class URL
         $return_array['passwd'] = $user->passwd;
         $return_array['method'] = $user->method;
         $return_array['remark'] = $node_name;
-        $return_array['group'] = Config::get('appName');
-        if ($mu_port != 0 && Config::get('mergeSub') != true) {
+        $return_array['group'] = $_ENV['appName'];
+        if ($mu_port != 0 && $_ENV['mergeSub'] != true) {
             $return_array['group'] .= ' - 单端口';
         }
         $return_array['ratio'] = ($relay_rule != null
@@ -590,8 +590,8 @@ class URL
 
     public static function getUserTraffic($user, $is_mu = 0)
     {
-        $group_name = Config::get('appName');
-        if ($is_mu == 1 && Config::get('mergeSub') != true) {
+        $group_name = $_ENV['appName'];
+        if ($is_mu == 1 && $_ENV['mergeSub'] != true) {
             $group_name .= ' - 单端口';
         }
         if (strtotime($user->expire_in) > time()) {
@@ -609,8 +609,8 @@ class URL
 
     public static function getUserClassExpiration($user, $is_mu = 0)
     {
-        $group_name = Config::get('appName');
-        if ($is_mu == 1 && Config::get('mergeSub') != true) {
+        $group_name = $_ENV['appName'];
+        if ($is_mu == 1 && $_ENV['mergeSub'] != true) {
             $group_name .= ' - 单端口';
         }
         if (strtotime($user->expire_in) > time()) {