This commit is contained in:
2024-07-10 18:12:09 +08:00
parent 58e35de159
commit 63d43b88cb
9 changed files with 130 additions and 89 deletions

View File

@@ -60,7 +60,7 @@ return [
// 应用名称 // 应用名称
'app_name' => '', 'app_name' => '',
// 应用地址 // 应用地址
'app_host' => '47.108.163.84', 'app_host' => '',
// 应用调试模式 // 应用调试模式
'app_debug' => $debug, 'app_debug' => $debug,
// 应用Trace // 应用Trace

View File

@@ -11,6 +11,37 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
use think\Env; use think\Env;
//定位到项目根目录 E:\wsh\projects\boom_imx
$root_path = str_replace('config','',__DIR__);
list($debug,$trace,$sys_env) = [false,false,'DEV'];
if (!function_exists('auto_choose_app_conf')) {
function auto_choose_app_conf(&$debug,&$trace,&$sys_env){
$domain = $_SERVER['HTTP_HOST']; //获取当前域名 (含端口号)
if(in_array($domain, ['xxx.playone.cn'])){
//正式 - 全域名
$debug = true;
$trace = false;
$sys_env = 'PROD';
}
//测试
else if(in_array($domain, ['xxxxx.playone.cn','xxx.com'])) {
$debug = true;
$trace = false;
$sys_env = 'DEV';
}
else {
//本地
$debug = true;
$trace = false;
$sys_env = 'LOCAL';
}
}
}
auto_choose_app_conf($debug,$trace,$sys_env);
return [ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 应用设置 // | 应用设置
@@ -18,9 +49,9 @@ return [
// 应用命名空间 // 应用命名空间
'app_namespace' => 'app', 'app_namespace' => 'app',
// 应用调试模式 // 应用调试模式
'app_debug' => Env::get('app.debug', false), 'app_debug' => $debug,
// 应用Trace // 应用Trace
'app_trace' => Env::get('app.trace', false), 'app_trace' => $trace,
// 应用模式状态 // 应用模式状态
'app_status' => '', 'app_status' => '',
// 是否支持多模块 // 是否支持多模块
@@ -259,7 +290,7 @@ return [
// 驱动方式 // 驱动方式
'type' => 'Mysql', 'type' => 'Mysql',
// 缓存前缀 // 缓存前缀
'key' => 'i3d6o32wo8fvs1fvdpwens', 'key' => 'roST1cg0hXEnMWmVtlKa4NFv6fPk9DQb',
// 加密方式 // 加密方式
'hashalgo' => 'ripemd160', 'hashalgo' => 'ripemd160',
// 缓存有效期 0表示永久缓存 // 缓存有效期 0表示永久缓存

View File

@@ -12,19 +12,55 @@
use think\Env; use think\Env;
list($hostname,$database,$username,$password,$hostport) = ['','','','',''];
if (!function_exists('auto_choose_db_conf')) {
function auto_choose_db_conf(&$hostname,&$database,&$username,&$password,&$hostport){
$domain = $_SERVER['HTTP_HOST']; //获取当前域名 (含端口号)
//正式
if(in_array($domain, [
'sdsdsd.sss.cn'
])){
$hostname = 'localhost';
$database = 'dddd';
$username = 'dddd';
$password = 'ffff';
$hostport = '3306';
}
//测试 socket请求这里$domain=null【上线正式环境之后把null移动到正式环境配置】
else if(in_array($domain, [null,'sdsd.playone.cn','sdsd.zcc10.com'])) {
$hostname = 'localhost';
$database = 'ssss';
$username = 'sssss';
$password = 'ssssss';
$hostport = '3306';
}
//本地
else{
$hostname = '127.0.0.1';
$database = 'digital_doctor';
$username = 'root';
$password = 'root';//root or 123456
$hostport = '3306';
}
}
}
auto_choose_db_conf($hostname,$database,$username,$password,$hostport);
return [ return [
// 数据库类型 // 数据库类型
'type' => Env::get('database.type', 'mysql'), 'type' => 'mysql',
// 服务器地址 // 服务器地址
'hostname' => Env::get('database.hostname', '127.0.0.1'), 'hostname' => $hostname,
// 数据库名 // 数据库名
'database' => Env::get('database.database', 'fastadmin'), 'database' => $database,
// 用户名 // 用户名
'username' => Env::get('database.username', 'root'), 'username' => $username,//正式:root,测试zc_game_admin本地root
// 密码 // 密码.
'password' => Env::get('database.password', ''), 'password' => $password,//正式:hbDB8SRa3Ix3poVi,测试KZK4cGd4XYsbNG5w本地root
// 端口 // 端口
'hostport' => Env::get('database.hostport', ''), 'hostport' => $hostport,
// 连接dsn // 连接dsn
'dsn' => '', 'dsn' => '',
// 数据库连接参数 // 数据库连接参数

View File

@@ -1,40 +1,44 @@
<?php <?php
return [ return array (
'name' => '我的网站', 'name' => '数智人医生',
'beian' => '', 'beian' => '',
'cdnurl' => '', 'cdnurl' => '',
'version' => '1.0.1', 'version' => '1.0.1',
'timezone' => 'Asia/Shanghai', 'timezone' => 'Asia/Shanghai',
'forbiddenip' => '', 'forbiddenip' => '',
'languages' => [ 'languages' =>
'backend' => 'zh-cn', array (
'frontend' => 'zh-cn', 'backend' => 'zh-cn',
], 'frontend' => 'zh-cn',
'fixedpage' => 'dashboard', ),
'categorytype' => [ 'fixedpage' => 'dashboard',
'default' => 'Default', 'categorytype' =>
'page' => 'Page', array (
'article' => 'Article', 'default' => 'Default',
'test' => 'Test', 'page' => 'Page',
], 'article' => 'Article',
'configgroup' => [ 'test' => 'Test',
'basic' => 'Basic', ),
'email' => 'Email', 'configgroup' =>
'dictionary' => 'Dictionary', array (
'user' => 'User', 'basic' => 'Basic',
'example' => 'Example', 'email' => 'Email',
], 'dictionary' => 'Dictionary',
'attachmentcategory' => [ 'user' => 'User',
'category1' => 'Category1', 'example' => 'Example',
'category2' => 'Category2', ),
'custom' => 'Custom', 'attachmentcategory' =>
], array (
'mail_type' => '1', 'category1' => 'Category1',
'mail_smtp_host' => 'smtp.qq.com', 'category2' => 'Category2',
'mail_smtp_port' => '465', 'custom' => 'Custom',
'mail_smtp_user' => '', ),
'mail_smtp_pass' => '', 'mail_type' => '1',
'mail_verify_type' => '2', 'mail_smtp_host' => 'smtp.qq.com',
'mail_from' => '', 'mail_smtp_port' => '465',
]; 'mail_smtp_user' => '',
'mail_smtp_pass' => '',
'mail_verify_type' => '2',
'mail_from' => '',
);

View File

@@ -13,7 +13,6 @@ class Index extends Frontend
public function index() public function index()
{ {
return $this->view->fetch();
} }
} }

View File

@@ -14,10 +14,10 @@
define('APP_PATH', __DIR__ . '/../application/'); define('APP_PATH', __DIR__ . '/../application/');
// 判断是否安装 // 判断是否安装
if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) { //if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) {
header("location:./install.php"); // header("location:./install.php");
exit; // exit;
} //}
//var_dump(1111);die;
// 加载框架引导文件 // 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php'; require __DIR__ . '/../thinkphp/start.php';

View File

@@ -1,30 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 安装文件 ]
// 建议安装完成后移除此文件
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/base.php';
// 绑定到安装控制器
\think\Route::bind('\app\admin\command\Install', 'controller');
// 开启路由
\think\App::route(true);
// 设置根url
\think\Url::root('');
// 执行应用
\think\App::run()->send();

View File

@@ -16,10 +16,10 @@
define('APP_PATH', __DIR__ . '/../application/'); define('APP_PATH', __DIR__ . '/../application/');
// 判断是否安装 // 判断是否安装
if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) { //if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) {
header("location:./install.php"); // header("location:./install.php");
exit; // exit;
} //}
// 加载框架引导文件 // 加载框架引导文件
require __DIR__ . '/../thinkphp/base.php'; require __DIR__ . '/../thinkphp/base.php';