Browse Source

remove gconfig system

iamsaltedfish 3 years ago
parent
commit
d9be8e513a

+ 0 - 10
app/routes.php

@@ -231,16 +231,6 @@ return function (SlimApp $app) {
         $this->get('/setting',                  App\Controllers\Admin\SettingController::class . ':index');
         $this->post('/setting',                 App\Controllers\Admin\SettingController::class . ':save');
         $this->post('/setting/email',           App\Controllers\Admin\SettingController::class . ':test');
-        $this->post('/setting/payment',         App\Controllers\Admin\SettingController::class . ':payment');
-
-        // Config Mange
-        $this->group('/config', function () {
-            $this->put('/update/{key}',         App\Controllers\Admin\GConfigController::class . ':update');
-            $this->get('/update/{key}/edit',    App\Controllers\Admin\GConfigController::class . ':edit');
-
-            $this->get('/telegram',             App\Controllers\Admin\GConfigController::class . ':telegram');
-            $this->post('/telegram/ajax',       App\Controllers\Admin\GConfigController::class . ':telegram_ajax');
-        });
     })->add(new Admin());
 
     if ($_ENV['enableAdminApi']){

+ 25 - 0
databases/migrations/20220417100701_drop_g_config_table.php

@@ -0,0 +1,25 @@
+<?php
+declare(strict_types=1);
+
+use Phinx\Migration\AbstractMigration;
+
+final class DropGConfigTable extends AbstractMigration
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change(): void
+    {
+        $this->table('gconfig')
+        ->drop()
+        ->update();
+    }
+}

+ 0 - 5
resources/views/material/admin/main.tpl

@@ -153,11 +153,6 @@
                                     节点列表
                                 </a>
                             </li>
-                            <li>
-                                <a href="/admin/config/telegram"><i class="icon icon-lg">supervisor_account</i>&nbsp;
-                                    Telegram
-                                </a>
-                            </li>
                         </ul>
                         <a class="waves-attach" data-toggle="collapse" href="#ui_menu_detect">
                             审计

+ 0 - 18
src/Command/Job.php

@@ -124,15 +124,6 @@ class Job extends Command
                                 'text' => '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。',
                             ], [], $_ENV['email_queue']
                         );
-                        $notice_text = str_replace(
-                            '%node_name%',
-                            $node->name,
-                            Config::getconfig('Telegram.string.NodeOffline')
-                        );
-                    }
-
-                    if (Config::getconfig('Telegram.bool.NodeOffline')) {
-                        Telegram::Send($notice_text);
                     }
 
                     $node->online = false;
@@ -145,15 +136,6 @@ class Job extends Command
                                 'text' => '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。',
                             ], [], $_ENV['email_queue']
                         );
-                        $notice_text = str_replace(
-                            '%node_name%',
-                            $node->name,
-                            Config::getconfig('Telegram.string.NodeOnline')
-                        );
-                    }
-
-                    if (Config::getconfig('Telegram.bool.NodeOnline')) {
-                        Telegram::Send($notice_text);
                     }
 
                     $node->online = true;

+ 0 - 133
src/Controllers/Admin/GConfigController.php

@@ -1,133 +0,0 @@
-<?php
-
-namespace App\Controllers\Admin;
-
-use App\Controllers\AdminController;
-use App\Models\GConfig;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\{
-    Request,
-    Response
-};
-
-class GConfigController extends AdminController
-{
-    /**
-     * @param Request   $request
-     * @param Response  $response
-     * @param array     $args
-     */
-    public function update($request, $response, $args): ResponseInterface
-    {
-        $key    = trim($args['key']);
-        $user   = $this->user;
-        $config = GConfig::where('key', '=', $key)->first();
-        if ($config != null && $config->setValue($request->getParam('value'), $user) === true) {
-            return $response->withJson([
-                'ret' => 1,
-                'msg' => '修改成功'
-            ]);
-        }
-        return $response->withJson([
-            'ret' => 0,
-            'msg' => '修改失败'
-        ]);
-    }
-
-    /**
-     * @param Request   $request
-     * @param Response  $response
-     * @param array     $args
-     */
-    public function edit($request, $response, $args): ResponseInterface
-    {
-        $key    = trim($args['key']);
-        $config = GConfig::where('key', '=', $key)->first();
-        return $response->write(
-            $this->view()
-                ->assign('edit_config', $config)
-                ->fetch('admin/config/edit.tpl')
-        );
-    }
-    
-    /**
-     * @param Request   $request
-     * @param Response  $response
-     * @param array     $args
-     */
-    public function telegram($request, $response, $args): ResponseInterface
-    {
-        $table_config['total_column'] = array(
-            'op'             => '操作',
-            'name'           => '配置名称',
-            'key'            => '配置名',
-            'value'          => '配置值',
-            'operator_id'    => '操作员 ID',
-            'operator_name'  => '操作员名称',
-            'operator_email' => '操作员邮箱',
-            'last_update'    => '修改时间'
-        );
-        $table_config['default_show_column'] = array('op', 'name', 'value', 'last_update');
-        foreach ($table_config['total_column'] as $column => $value) {
-            $table_config['default_show_column'][] = $column;
-        }
-        $table_config['ajax_url'] = 'telegram/ajax';
-        return $response->write(
-            $this->view()
-                ->assign('table_config', $table_config)
-                ->fetch('admin/config/telegram/index.tpl')
-        );
-    }
-
-    /**
-     * @param Request   $request
-     * @param Response  $response
-     * @param array     $args
-     */
-    public function telegram_ajax($request, $response, $args): ResponseInterface
-    {
-        $query = GConfig::getTableDataFromAdmin(
-            $request,
-            static function (&$order_field) {
-                if (in_array($order_field, ['op'])) {
-                    $order_field = 'id';
-                }
-                if (in_array($order_field, ['key'])) {
-                    $order_field = 'name';
-                }
-            },
-            static function ($query) {
-                return $query->where('key', 'LIKE binary', '%Telegram%');
-            }
-        );
-
-        $data  = [];
-        foreach ($query['datas'] as $value) {
-            /** @var GConfig $value */
-
-            $tempdata                   = [];
-            $tempdata['op']             = '<a class="btn btn-brand" href="/admin/config/update/' . $value->key . '/edit">编辑</a>';
-            $tempdata['name']           = $value->name;
-            $tempdata['key']            = $value->key;
-            $tempdata['value']          = $value->getValue();
-            $tempdata['operator_id']    = $value->operator_id;
-            $tempdata['operator_name']  = $value->operator_name;
-            $tempdata['operator_email'] = $value->operator_email;
-            $tempdata['last_update']    = date('Y-m-d H:i:s', $value->last_update);
-            if (strpos($value->key, '.bool.')) {
-                $tempdata['value'] = ($value->getValue() ? '开启' : '关闭');
-            } else {
-                $tempdata['value'] = '(请在编辑页面查看)';
-            }
-
-            $data[] = $tempdata;
-        }
-
-        return $response->withJson([
-            'draw'            => $request->getParam('draw'),
-            'recordsTotal'    => GConfig::where('key', 'LIKE', "%Telegram%")->count(),
-            'recordsFiltered' => $query['count'],
-            'data'            => $data,
-        ]);
-    }
-}

+ 0 - 52
src/Controllers/Admin/NodeController.php

@@ -124,24 +124,6 @@ class NodeController extends AdminController
             CloudflareDriver::updateRecord($domain_name[0], $node->node_ip);
         }
 
-        if (Config::getconfig('Telegram.bool.AddNode')) {
-            try {
-                Telegram::Send(
-                    str_replace(
-                        '%node_name%',
-                        $request->getParam('name'),
-                        Config::getconfig('Telegram.string.AddNode')
-                    )
-                );
-            } catch (Exception $e) {
-                return $response->withJson([
-                    'ret' => 1,
-                    'msg' => '节点添加成功,但Telegram通知失败',
-                    'node_id' => $node->id
-                ]);
-            }
-        }
-
         return $response->withJson([
             'ret' => 1,
             'msg' => '节点添加成功',
@@ -219,23 +201,6 @@ class NodeController extends AdminController
 
         $node->save();
 
-        if (Config::getconfig('Telegram.bool.UpdateNode')) {
-            try {
-                Telegram::Send(
-                    str_replace(
-                        '%node_name%',
-                        $request->getParam('name'),
-                        Config::getconfig('Telegram.string.UpdateNode')
-                    )
-                );
-            } catch (Exception $e) {
-                return $response->withJson([
-                    'ret' => 1,
-                    'msg' => '修改成功,但Telegram通知失败'
-                ]);
-            }
-        }
-
         return $response->withJson([
             'ret' => 1,
             'msg' => '修改成功'
@@ -261,23 +226,6 @@ class NodeController extends AdminController
             ]);
         }
 
-        if (Config::getconfig('Telegram.bool.DeleteNode')) {
-            try {
-                Telegram::Send(
-                    str_replace(
-                        '%node_name%',
-                        $request->getParam('name'),
-                        Config::getconfig('Telegram.string.DeleteNode')
-                    )
-                );
-            } catch (Exception $e) {
-                return $response->withJson([
-                    'ret' => 1,
-                    'msg' => '删除成功,但Telegram通知失败'
-                ]);
-            }
-        }
-
         return $response->withJson([
             'ret' => 1,
             'msg' => '删除成功'

+ 0 - 69
src/Models/GConfig.php

@@ -1,69 +0,0 @@
-<?php
-namespace App\Models;
-
-use App\Services\DefaultConfig;
-
-class GConfig extends Model
-{
-    protected $connection = 'default';
-    protected $table = 'gconfig';
-
-    public function recover($user)
-    {
-        $this->oldvalue       = $this->value;
-        $this->value          = DefaultConfig::default_value($this->key)['value'];
-        $this->operator_id    = $user->id;
-        $this->operator_name  = ('[恢复默认] - ' . $user->user_name);
-        $this->operator_email = $user->email;
-        $this->last_update    = time();
-        $this->save();
-    }
-
-    public function getValue()
-    {
-        switch ($this->type) {
-            case 'bool':
-                return (bool)      $this->value;
-            case 'array':
-                return json_decode($this->value, true);
-            case 'string':
-                return (string)    $this->value;
-            default:
-                return (string)    $this->value;
-        }
-    }
-
-    public function setValue($value, $user = null)
-    {
-        $this->oldvalue = $this->value;
-        $this->value    = $this->typeConversion($value);
-        if ($user === null) {
-            $this->operator_id    = 0;
-            $this->operator_name  = '系统修改';
-            $this->operator_email = '[email protected]';
-        } else {
-            $this->operator_id    = $user->id;
-            $this->operator_name  = $user->user_name;
-            $this->operator_email = $user->email;
-        }
-        $this->last_update = time();
-        if (!$this->save()) {
-            return false;
-        }
-        return true;
-    }
-
-    public function typeConversion($value)
-    {
-        switch ($this->type) {
-            case 'bool':
-                return (string) $value;
-            case 'array':
-                return json_encode($value, 320);
-            case 'string':
-                return (string) $value;
-            default:
-                return (string) $value;
-        }
-    }
-}

+ 12 - 39
src/Models/User.php

@@ -1,28 +1,17 @@
 <?php
-
 namespace App\Models;
 
-use App\Controllers\LinkController;
-use App\Utils\{
-    Tools,
-    Hash,
-    GA,
-    Telegram,
-    URL
-};
-use App\Services\{Config, Mail};
-use Ramsey\Uuid\Uuid;
 use Exception;
+use App\Services\Config;
+use App\Services\Mail;
+use App\Utils\GA;
+use App\Utils\Hash;
+use App\Utils\Telegram;
+use App\Utils\Tools;
+use App\Utils\URL;
+use Ramsey\Uuid\Uuid;
+use App\Controllers\LinkController;
 
-/**
- * User Model
- *
- * @property-read   int     $id         ID
- * @todo More property
- * @property        bool    $is_admin           是否管理员
- * @property        bool    $expire_notified    If user is notified for expire
- * @property        bool    $traffic_notified   If user is noticed for low traffic
- */
 class User extends Model
 {
     protected $connection = 'default';
@@ -618,27 +607,11 @@ class User extends Model
             'ok'  => true,
             'msg' => '解绑成功.'
         ];
+
         $telegram_id = $this->telegram_id;
         $this->telegram_id = 0;
-        if ($this->save()) {
-            if (
-                $_ENV['enable_telegram'] === true
-                &&
-                Config::getconfig('Telegram.bool.group_bound_user') === true
-                &&
-                Config::getconfig('Telegram.bool.unbind_kick_member') === true
-                &&
-                !$this->is_admin
-            ) {
-                \App\Utils\Telegram\TelegramTools::SendPost(
-                    'kickChatMember',
-                    [
-                        'chat_id'   => $_ENV['telegram_chatid'],
-                        'user_id'   => $telegram_id,
-                    ]
-                );
-            }
-        } else {
+
+        if (!$this->save()) {
             $return = [
                 'ok'  => false,
                 'msg' => '解绑失败.'

+ 0 - 11
src/Services/Config.php

@@ -1,8 +1,6 @@
 <?php
-
 namespace App\Services;
 
-use App\Models\GConfig;
 use App\Models\Setting;
 
 class Config
@@ -13,15 +11,6 @@ class Config
         return $_ENV[$key];
     }
 
-    public static function getconfig($key)
-    {
-        $value = GConfig::where('key', '=', $key)->first();
-        if ($value === null) {
-            $value = DefaultConfig::firstOrCreate($key);
-        }
-        return $value->getValue();
-    }
-
     public static function getPublicConfig()
     {
         $public_configs = Setting::getPublicConfig();

+ 0 - 312
src/Services/DefaultConfig.php

@@ -1,312 +0,0 @@
-<?php
-
-namespace App\Services;
-
-use App\Models\GConfig;
-
-class DefaultConfig
-{
-    /**
-     * 创建配置,成功返回 true
-     *
-     * @param string $key 键名
-     *
-     * @return bool
-     */
-    public static function create($key)
-    {
-        $value = self::default_value($key);
-        if ($value != null) {
-            $new                 = new GConfig();
-            $new->key            = $value['key'];
-            $new->type           = $value['type'];
-            $new->value          = $value['value'];
-            $new->name           = $value['name'];
-            $new->comment        = $value['comment'];
-            $new->operator_id    = $value['operator_id'];
-            $new->operator_name  = $value['operator_name'];
-            $new->oldvalue       = '';
-            $new->operator_email = '';
-            $new->last_update    = time();
-            if ($new->save()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 创建并返回配置,如果该键名存在默认配置中
-     *
-     * @param string $key
-     *
-     * @return GConfig|null
-     */
-    public static function firstOrCreate($key)
-    {
-        return (self::create($key)
-            ? GConfig::where('key', '=', $key)->first()
-            : null
-        );
-    }
-
-    /**
-     * 检查新增的配置并创建
-     *
-     * @return string
-     */
-    public static function detectConfigs()
-    {
-        $return = '开始检查新增的配置项...' . PHP_EOL;
-        $configs = self::configs();
-        foreach ($configs as $key => $value) {
-            if (GConfig::where('key', '=', $key)->first() == null) {
-                if (self::create($key)) {
-                    $return .= '新增的配置项:' . $key . ':' . $value['name'] . PHP_EOL;
-                } else {
-                    $return .= $key . ':配置项创建失败,请检查错误' . PHP_EOL;
-                }
-            }
-        }
-        $return .= '以上是新增的配置项...' . PHP_EOL;
-
-        return $return;
-    }
-
-    /**
-     * 默认配置,新增配置请添加到此处
-     *
-     * @param string $key 键名
-     *
-     * @return array
-     */
-    public static function configs($key = null)
-    {
-        $configs = [
-            // Telegram 部分
-            'Telegram.bool.show_group_link' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 0,
-                'name'          => '在 Bot 菜单中显示加入用户群',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.group_link' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '',
-                'name'          => '用户群的链接',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.bool.group_bound_user' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 0,
-                'name'          => '是否仅允许已绑定 Telegram 账户的用户加入群组',
-                'comment'       => '是否仅允许已绑定 Telegram 账户的用户加入 telegram_chatid 设定的群组',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.bool.unbind_kick_member' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 0,
-                'name'          => '解绑 Telegram 账户后自动踢出群组',
-                'comment'       => '用户解绑 Telegram 账户后自动踢出群组,不含管理员',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.Diary' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送系统今天的运行状况',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.Diary' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => ('各位老爷少奶奶,我来为大家报告一下系统今天的运行状况哈~' . PHP_EOL . '今日签到人数:%getTodayCheckinUser%' . PHP_EOL . '今日使用总流量:%lastday_total%' . PHP_EOL . '晚安~'),
-                'name'          => '自定义向 Telegram 群组推送系统今天的运行状况的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[今日签到人数] %getTodayCheckinUser%' . PHP_EOL . '[今日使用总流量] %lastday_total%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.DailyJob' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送数据库清理的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.DailyJob' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '姐姐姐姐,数据库被清理了,感觉身体被掏空了呢~',
-                'name'          => '自定义向 Telegram 群组推送数据库清理通知的信息',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.NodeOffline' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点掉线的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.NodeOffline' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '喵喵喵~ %node_name% 节点掉线了喵~',
-                'name'          => '自定义向 Telegram 群组推送节点掉线通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.NodeOnline' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点上线的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.NodeOnline' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '喵喵喵~ %node_name% 节点恢复了喵~',
-                'name'          => '自定义向 Telegram 群组推送节点上线通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.NodeGFW' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点被墙的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.NodeGFW' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '喵喵喵~ %node_name% 节点被墙了喵~',
-                'name'          => '自定义向 Telegram 群组推送节点被墙通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.NodeGFW_recover' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点被墙恢复的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.NodeGFW_recover' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '喵喵喵~ %node_name% 节点恢复了喵~',
-                'name'          => '自定义向 Telegram 群组推送节点被墙恢复通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.AddNode' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点新增的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.AddNode' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '新节点添加~ %node_name%',
-                'name'          => '自定义向 Telegram 群组推送节点新增通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.UpdateNode' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点修改的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.UpdateNode' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '节点信息被修改~ %node_name%',
-                'name'          => '自定义向 Telegram 群组推送节点修改通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-
-            'Telegram.bool.DeleteNode' => [
-                'key'           => $key,
-                'type'          => 'bool',
-                'value'         => 1,
-                'name'          => '开启 Telegram 群组推送节点删除的通知',
-                'comment'       => '',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-            'Telegram.string.DeleteNode' => [
-                'key'           => $key,
-                'type'          => 'string',
-                'value'         => '节点被删除~ %node_name%',
-                'name'          => '自定义向 Telegram 群组推送节点删除通知的信息',
-                'comment'       => '可用变量:' . PHP_EOL . '[节点名称] %node_name%',
-                'operator_id'   => 0,
-                'operator_name' => '系统默认',
-            ],
-        ];
-        return ($key === null
-            ? $configs
-            : $configs[$key]
-        );
-    }
-
-    /**
-     * 恢复配置为默认值
-     *
-     * @param string $key 键名
-     *
-     * @return void
-     */
-    public static function default_value($key)
-    {
-        return self::configs($key);
-    }
-}

+ 12 - 28
src/Utils/Telegram/Callbacks/Callback.php

@@ -1,24 +1,19 @@
 <?php
-
 namespace App\Utils\Telegram\Callbacks;
 
-use App\Controllers\LinkController;
-use App\Models\{
-    Ip,
-    Node,
-    Payback,
-    LoginIp,
-    Setting,
-    InviteCode,
-    UserSubscribeLog
-};
+use App\Models\InviteCode;
+use App\Models\Ip;
+use App\Models\LoginIp;
+use App\Models\Node;
+use App\Models\Payback;
+use App\Models\Setting;
+use App\Models\UserSubscribeLog;
 use App\Services\Config;
-use App\Utils\{
-    Tools,
-    QQWry,
-    Telegram\Reply,
-    Telegram\TelegramTools
-};
+use App\Utils\QQWry;
+use App\Utils\Telegram\Reply;
+use App\Utils\Telegram\TelegramTools;
+use App\Utils\Tools;
+use App\Controllers\LinkController;
 
 class Callback
 {
@@ -266,14 +261,6 @@ class Callback
         $text .= Reply::getUserInfo($user);
         $text .= PHP_EOL;
         $text .= '流量重置时间:' . $user->valid_use_loop();
-        if (Config::getconfig('Telegram.bool.show_group_link')) {
-            $Keyboard[] = [
-                [
-                    'text' => '加入用户群',
-                    'url'  => Config::getconfig('Telegram.string.group_link')
-                ]
-            ];
-        }
         return [
             'text'     => $text,
             'keyboard' => $Keyboard,
@@ -828,9 +815,6 @@ class Callback
                 // Telegram 账户解绑
                 $this->AllowEditMessage = false;
                 $text                   = '发送 **/unbind 账户邮箱** 进行解绑.';
-                if (Config::getconfig('Telegram.bool.unbind_kick_member') === true) {
-                    $text .= PHP_EOL . PHP_EOL . '根据管理员的设定,您解绑账户将会被自动移出用户群.';
-                }
                 $sendMessage = [
                     'text'                     => $text,
                     'disable_web_page_preview' => false,

+ 0 - 3
src/Utils/Telegram/Commands/UnbindCommand.php

@@ -97,9 +97,6 @@ class UnbindCommand extends Command
     public function sendtext()
     {
         $text = '发送 **/unbind 账户邮箱** 进行解绑.';
-        if (Config::getconfig('Telegram.bool.unbind_kick_member') === true) {
-            $text .= PHP_EOL . PHP_EOL . '根据管理员的设定,您解绑账户将会被自动移出用户群.';
-        }
         return $text;
     }
 }

+ 0 - 23
src/Utils/Telegram/Message.php

@@ -180,29 +180,6 @@ class Message
             // 新成员加入群组
             $NewUser = TelegramTools::getUser($Member['id']);
             $deNewChatMember = json_decode($NewChatMember, true);
-            if (
-                Config::getconfig('Telegram.bool.group_bound_user') === true
-                &&
-                $this->ChatID == $_ENV['telegram_chatid']
-                &&
-                $NewUser == null
-                &&
-                $deNewChatMember['is_bot'] == false
-            ) {
-                $this->replyWithMessage(
-                    [
-                        'text' => '由于 ' . $Member['name'] . ' 未绑定账户,将被移除.'
-                    ]
-                );
-                TelegramTools::SendPost(
-                    'kickChatMember',
-                    [
-                        'chat_id'   => $this->ChatID,
-                        'user_id'   => $Member['id'],
-                    ]
-                );
-                return;
-            }
             if ($_ENV['enable_welcome_message'] === true) {
                 $text = ($NewUser->class >= 1 ? '欢迎 VIP' . $NewUser->class . ' 用户 ' . $Member['name'] . '回到组织.' : '欢迎 ' . $Member['name']);
                 $this->replyWithMessage(