diff --git a/src/Metron/MtAgent.php b/src/Metron/MtAgent.php index b083be64..5a51766f 100644 --- a/src/Metron/MtAgent.php +++ b/src/Metron/MtAgent.php @@ -81,7 +81,7 @@ public function edit_user($request, $response, $args) } $edituser_config = $edituser->config; - if ($edituser_config['form_agent_create'] !== true) { + if (isset($edituser_config['form_agent_create']) && $edituser_config['form_agent_create'] !== true) { return '您无权操作通过邀请链接或邀请码注册的用户'; } @@ -113,7 +113,7 @@ public function edit_user_save($request, $response, $args) } $edituser_config = $edituser->config; - if ($edituser_config['form_agent_create'] !== true) { + if (isset($edituser_config['form_agent_create']) && $edituser_config['form_agent_create'] !== true) { $res['ret'] = 0; $res['msg'] = '您无权操作通过邀请链接或邀请码注册的用户'; return $response->getBody()->write(json_encode($res)); @@ -283,6 +283,7 @@ public function add_user_save($request, $response, $args) } $email = trim($request->getParam('email')); + $shop_id = $request->getParam('shop_id'); $email = strtolower($email); $suffix = trim($request->getParam('email_suffix')); @@ -309,7 +310,7 @@ public function add_user_save($request, $response, $args) $res['msg'] = '邮箱已经被注册了'; return $response->getBody()->write(json_encode($res)); } - + $current_timestamp = time(); $newuser = new User(); $pass = Tools::genRandomChar(); @@ -318,7 +319,7 @@ public function add_user_save($request, $response, $args) $newuser->pass = Hash::passwordHash($pass); $newuser->passwd = Tools::genRandomChar(16); $newuser->uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, $email . '|' . $current_timestamp); - $newuser->port = Tools::getAvPort(); + $newuser->port = 0; $newuser->t = 0; $newuser->u = 0; $newuser->d = 0; diff --git a/src/Utils/Tools.php b/src/Utils/Tools.php index a1394f42..a45a2192 100644 --- a/src/Utils/Tools.php +++ b/src/Utils/Tools.php @@ -187,8 +187,7 @@ public static function getAvPort() //检索User数据表现有port if ($_ENV['min_port'] > 65535 || $_ENV['min_port'] <= 0 || $_ENV['max_port'] > 65535 || $_ENV['max_port'] <= 0) { return 0; - } - else { + } else { $det = User::pluck('port')->toArray(); $port = array_diff(range($_ENV['min_port'], $_ENV['max_port']), $det); shuffle($port); diff --git "a/\344\275\277\347\224\250\345\256\235\345\241\224\346\220\255\345\273\272\351\235\242\346\235\277.html" "b/\344\275\277\347\224\250\345\256\235\345\241\224\346\220\255\345\273\272\351\235\242\346\235\277.html" deleted file mode 100644 index 44d9c574..00000000 --- "a/\344\275\277\347\224\250\345\256\235\345\241\224\346\220\255\345\273\272\351\235\242\346\235\277.html" +++ /dev/null @@ -1,3188 +0,0 @@ - - - - - - - - - -

1.连接 SSH 安装宝塔面板

-

 

-

2.宝塔面板安装环境, 推荐使用 PHP 7.2、MySQL 5.6、Nginx 1.16

-

 

-

3.宝塔面板创建网站, 域名等信息自行填写

-

 

-

4.连接 SSH 下载源码

-

 

-
-

 

-

5.使用composer安装依赖

-

 

-
-

 

-

6.复制配置文件

-

cp config/.config.example.php config/.config.php

-

cp config/.metron_setting.example.php config/.metron_setting.php

-

cp config/appprofile.example.php config/appprofile.php

-

.config.php设置后执行php xcat initQQWry 下载IP解析库

-

8.网站设置

-

打开 宝塔面版 > 网站 > 你的网站

-

- 网站目录 里取消勾选 防跨站攻击,运行目录里面选择 /public,点击保存。 -

-

伪静态 中填入下面内容,然后保存

-

 

-
-

9.在SSH里的网站目录下执行,给网站文件755权限

-

 

-
-

10.数据库操作

-

首次迁移: 导入网站目录下的sql/metron.sql 文件

-

将数据库user表里的全部用户的theme列改为metron,使用phpmyadmin执行这条sql语句: UPDATE user SET - theme='metron'

-

11.自行编辑config文件

-

.metron_setting.php 中务必设置授权码 (从bot获取) - .config.php 中设置 $_ENV['theme'] = 'metron'; -

-

一、 使用宝塔面板的计划任务配置

-
-
-        
-
- -