From 09fc2888ea15ae8c1018949ff5f3df550e0384d1 Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Wed, 24 Apr 2019 16:25:46 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E6=9E=84=E5=BB=BA=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Index.php | 4 +- application/install/apiadmin.tpl | 38 +++++++++++++++++ application/install/db.tpl | 63 ++++++++++++++++++++++++++++ config/app.php | 4 +- 4 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 application/install/apiadmin.tpl create mode 100644 application/install/db.tpl diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 3404a4c..e66e433 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -3,10 +3,12 @@ namespace app\api\controller; +use think\facade\App; + class Index extends Base { public function index() { $this->debug([ - 'TpVersion' => THINK_VERSION + 'TpVersion' => App::version() ]); return $this->buildSuccess([ diff --git a/application/install/apiadmin.tpl b/application/install/apiadmin.tpl new file mode 100644 index 0000000..59102f7 --- /dev/null +++ b/application/install/apiadmin.tpl @@ -0,0 +1,38 @@ + +// +---------------------------------------------------------------------- + +return [ + 'APP_VERSION' => 'v4.0', + 'APP_NAME' => 'ApiAdmin', + + //鉴权相关 + 'USER_ADMINISTRATOR' => [1], + + //安全秘钥 + 'AUTH_KEY' => '{$AUTH_KEY}', + + //后台登录状态维持时间[目前只有登录和解锁会重置登录时间] + 'ONLINE_TIME' => 7200, + //AccessToken失效时间 + 'ACCESS_TOKEN_TIME_OUT' => 7200, + 'COMPANY_NAME' => 'ApiAdmin开发维护团队', + + //跨域配置 + 'CROSS_DOMAIN' => [ + 'Access-Control-Allow-Origin' => '*', + 'Access-Control-Allow-Methods' => 'POST,PUT,GET,DELETE', + 'Access-Control-Allow-Headers' => 'version, access-token, user-token, ApiAuth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With', + 'Access-Control-Allow-Credentials' => 'true' + ], + + //后台列表默认一页显示数量 + 'ADMIN_LIST_DEFAULT' => 20, +]; diff --git a/application/install/db.tpl b/application/install/db.tpl new file mode 100644 index 0000000..9d245f5 --- /dev/null +++ b/application/install/db.tpl @@ -0,0 +1,63 @@ + +// +---------------------------------------------------------------------- + +return [ + // 数据库类型 + 'type' => '{$DB_TYPE}', + // 服务器地址 + 'hostname' => '{$DB_HOST}', + // 数据库名 + 'database' => '{$DB_NAME}', + // 用户名 + 'username' => '{$DB_USER}', + // 密码 + 'password' => '{$DB_PASSWORD}', + // 端口 + 'hostport' => '{$DB_PORT}', + // 连接dsn + 'dsn' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => '{$DB_CHAR}', + // 数据库表前缀 + 'prefix' => '', + // 数据库调试模式 + 'debug' => true, + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 自动读取主库数据 + 'read_master' => false, + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 数据集返回类型 + 'resultset_type' => 'array', + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // Builder类 + 'builder' => '', + // Query类 + 'query' => '\\think\\db\\Query', + // 是否需要断线重连 + 'break_reconnect' => false, + // 断线标识字符串 + 'break_match_str' => [], +]; diff --git a/config/app.php b/config/app.php index 55bda2d..7316a4f 100644 --- a/config/app.php +++ b/config/app.php @@ -54,9 +54,9 @@ return [ // +---------------------------------------------------------------------- // 默认模块名 - 'default_module' => 'index', + 'default_module' => 'api', // 禁止访问模块 - 'deny_module_list' => ['common'], + 'deny_module_list' => ['http', 'install', 'model', 'util'], // 默认控制器名 'default_controller' => 'Index', // 默认操作名