fix: 解决访问没有埋点的问题
This commit is contained in:
@@ -1,62 +1,63 @@
|
||||
<?php
|
||||
namespace app\event\init;
|
||||
use app\model\system\Upgrade;
|
||||
use think\app\Service;
|
||||
use think\facade\Route;
|
||||
use app\model\system\Addon;
|
||||
use think\facade\Cache;
|
||||
class InitRoute extends Service {
|
||||
public function handle() {
|
||||
if (defined('BIND_MODULE') && BIND_MODULE === 'install') return;
|
||||
$ip = request()->ip();
|
||||
define("aiqixun_AUTH_CODE", '');
|
||||
define("aiqixun_AUTH_VERSION", '');
|
||||
|
||||
$pathinfo = request()->pathinfo();
|
||||
$pathinfo_array = explode('/', $pathinfo);
|
||||
$check_model = $pathinfo_array[0];
|
||||
$addon_is_exit = addon_is_exit($check_model);
|
||||
$addon = $addon_is_exit == 1 ? $check_model : '';
|
||||
if(!empty($addon)) {
|
||||
$module = isset($pathinfo_array[1]) ? $pathinfo_array[1] : 'admin';
|
||||
$controller = isset($pathinfo_array[2]) ? $pathinfo_array[2] : 'index';
|
||||
$method = isset($pathinfo_array[3]) ? $pathinfo_array[3] : 'index';
|
||||
request()->addon($addon);
|
||||
$this->app->setNamespace("addon\\".$addon.'\\'.$module);
|
||||
$this->app->setAppPath($this->app->getRootPath() . 'addon' . DIRECTORY_SEPARATOR. $addon.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
$module = isset($pathinfo_array[0]) ? $pathinfo_array[0] : 'admin';
|
||||
$controller = isset($pathinfo_array[1]) ? $pathinfo_array[1] : 'index';
|
||||
$method = isset($pathinfo_array[2]) ? $pathinfo_array[2] : 'index';
|
||||
}
|
||||
$pathinfo = str_replace(".html", '', $pathinfo);
|
||||
$controller = str_replace(".html", '', $controller);
|
||||
$method = str_replace(".html", '', $method);
|
||||
request()->module($module);
|
||||
Route::rule($pathinfo, $module.'/'.$controller. '/'. $method);
|
||||
}
|
||||
private function decrypt($data) {
|
||||
$format_data = substr($data, 32);
|
||||
$time = substr($data, -10);
|
||||
$decrypt_data = strstr($format_data, $time);
|
||||
$key = str_replace($decrypt_data, '', $format_data);
|
||||
$data = str_replace($time, '', $decrypt_data);
|
||||
$json_data = decrypt($data, $key);
|
||||
$array = json_decode($json_data, true);
|
||||
}
|
||||
private function addonsAuth() {
|
||||
$cache = Cache::get('auth_addon');
|
||||
if (!empty($cache)) return $cache;
|
||||
$upgrade = new Upgrade();
|
||||
$auth_addons = $upgrade->getAuthAddons();
|
||||
$addons = [];
|
||||
if ($auth_addons['code'] == 0) {
|
||||
$addons = array_column($auth_addons['data'], 'code');
|
||||
}
|
||||
Cache::set('auth_addon', $addons);
|
||||
return $addons;
|
||||
}
|
||||
private function authControl() {
|
||||
return [ 'fenxiao', 'pintuan' ];
|
||||
}
|
||||
<?php
|
||||
namespace app\event\init;
|
||||
use app\model\system\Upgrade;
|
||||
use think\app\Service;
|
||||
use think\facade\Route;
|
||||
use app\model\system\Addon;
|
||||
use think\facade\Cache;
|
||||
class InitRoute extends Service {
|
||||
public function handle() {
|
||||
if (defined('BIND_MODULE') && BIND_MODULE === 'install') return;
|
||||
$ip = request()->ip();
|
||||
define("aiqixun_AUTH_CODE", '');
|
||||
define("aiqixun_AUTH_VERSION", '');
|
||||
|
||||
$pathinfo = request()->pathinfo();
|
||||
$pathinfo_array = explode('/', $pathinfo);
|
||||
$check_model = $pathinfo_array[0];
|
||||
$addon_is_exit = addon_is_exit($check_model);
|
||||
$addon = $addon_is_exit == 1 ? $check_model : '';
|
||||
if(!empty($addon)) {
|
||||
$module = isset($pathinfo_array[1]) ? $pathinfo_array[1] : 'admin';
|
||||
$controller = isset($pathinfo_array[2]) ? $pathinfo_array[2] : 'index';
|
||||
$method = isset($pathinfo_array[3]) ? $pathinfo_array[3] : 'index';
|
||||
request()->addon($addon);
|
||||
$this->app->setNamespace("addon\\".$addon.'\\'.$module);
|
||||
$this->app->setAppPath($this->app->getRootPath() . 'addon' . DIRECTORY_SEPARATOR. $addon.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
$module = isset($pathinfo_array[0]) ? $pathinfo_array[0] : 'admin';
|
||||
$controller = isset($pathinfo_array[1]) ? $pathinfo_array[1] : 'index';
|
||||
$method = isset($pathinfo_array[2]) ? $pathinfo_array[2] : 'index';
|
||||
}
|
||||
$pathinfo = str_replace(".html", '', $pathinfo);
|
||||
$controller = str_replace(".html", '', $controller);
|
||||
$method = str_replace(".html", '', $method);
|
||||
request()->module($module);
|
||||
Route::rule($pathinfo, $module.'/'.$controller. '/'. $method);
|
||||
}
|
||||
private function decrypt($data) {
|
||||
$format_data = substr($data, 32);
|
||||
$time = substr($data, -10);
|
||||
$decrypt_data = strstr($format_data, $time);
|
||||
$key = str_replace($decrypt_data, '', $format_data);
|
||||
$data = str_replace($time, '', $decrypt_data);
|
||||
$json_data = decrypt($data, $key);
|
||||
$array = json_decode($json_data, true);
|
||||
return $array;
|
||||
}
|
||||
private function addonsAuth() {
|
||||
$cache = Cache::get('auth_addon');
|
||||
if (!empty($cache)) return $cache;
|
||||
$upgrade = new Upgrade();
|
||||
$auth_addons = $upgrade->getAuthAddons();
|
||||
$addons = [];
|
||||
if ($auth_addons['code'] == 0) {
|
||||
$addons = array_column($auth_addons['data'], 'code');
|
||||
}
|
||||
Cache::set('auth_addon', $addons);
|
||||
return $addons;
|
||||
}
|
||||
private function authControl() {
|
||||
return [ 'fenxiao', 'pintuan' ];
|
||||
}
|
||||
}
|
||||
352
src/extend/debug.txt
Normal file
352
src/extend/debug.txt
Normal file
@@ -0,0 +1,352 @@
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
460
|
||||
460
|
||||
460
|
||||
460
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
Reference in New Issue
Block a user