mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
79470a8b3c
commit
a6bb9568fa
|
|
@ -3,7 +3,7 @@ declare (strict_types = 1);
|
|||
|
||||
namespace app;
|
||||
|
||||
use app\common\utils\Json;
|
||||
use app\common\service\Json;
|
||||
use think\Service;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ abstract class BaseController
|
|||
} elseif ($url) {
|
||||
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url);
|
||||
}
|
||||
|
||||
$result = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
|
|
@ -161,7 +162,7 @@ abstract class BaseController
|
|||
|
||||
$type = $this->getResponseType();
|
||||
if ($type == 'html'){
|
||||
$response = view(config('app.exception_tmpl'), $result);
|
||||
$response = view(config('app.dispatch_success_tmpl'), $result);
|
||||
} else if ($type == 'json') {
|
||||
$response = json($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,7 @@
|
|||
namespace app;
|
||||
|
||||
// 应用请求对象类
|
||||
use Spatie\Macroable\Macroable;
|
||||
|
||||
/**
|
||||
* Class Request
|
||||
* @package app
|
||||
*/
|
||||
class Request extends \think\Request
|
||||
{
|
||||
// 宏指令
|
||||
use Macroable;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ return [
|
|||
// 过期时间
|
||||
'expire' => 1440,
|
||||
// 前缀
|
||||
'prefix' => 'ape_admin',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\service;
|
||||
namespace app\service\service;
|
||||
|
||||
/**
|
||||
* Class Curl
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\utils;
|
||||
namespace app\common\service;
|
||||
|
||||
use think\Response;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 是否强制使用路由
|
||||
'url_route_must' => false,
|
||||
// 合并路由规则
|
||||
'route_rule_merge' => true,
|
||||
// 路由是否完全匹配
|
||||
'route_complete_match' => false,
|
||||
// 是否自动转换URL中的控制器和操作名
|
||||
'url_convert' => true,
|
||||
];
|
||||
|
|
@ -18,10 +18,10 @@ return [
|
|||
'with_event' => true,
|
||||
// 默认应用
|
||||
'default_app' => 'index',
|
||||
// 开启应用快速访问
|
||||
'app_express' => true,
|
||||
// 默认时区
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
// 快捷访问
|
||||
'app_express' => true,
|
||||
// 自动多应用模式
|
||||
'auto_multi_app' => true,
|
||||
// 应用映射(自动多应用模式有效)
|
||||
|
|
@ -29,7 +29,7 @@ return [
|
|||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [],
|
||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||
'deny_app_list' => ['common','addons'],
|
||||
'deny_app_list' => ['common'],
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ return [
|
|||
// 默认的路由变量规则
|
||||
'default_route_pattern' => '[\w\.]+',
|
||||
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
|
||||
'request_cache' => false,
|
||||
'request_cache_key' => false,
|
||||
// 请求缓存有效期
|
||||
'request_cache_expire' => null,
|
||||
// 全局请求缓存排除规则
|
||||
|
|
|
|||
|
|
@ -11,20 +11,9 @@
|
|||
|
||||
// [ 应用入口文件 ]
|
||||
namespace think;
|
||||
//检测系统
|
||||
|
||||
/*
|
||||
if(file_exists("./install/") && !file_exists("./install/install.lock")){
|
||||
if($_SERVER['PHP_SELF'] != '/index.php'){
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
exit("请在域名根目录下安装,如:<br/> www.xxx.com/index.php 正确 <br/> www.xxx.com/www/index.php 错误,域名后面不能圈套目录, 但项目没有根目录存放限制,可以放在任意目录,apache虚拟主机配置一下即可");
|
||||
}
|
||||
header('Location:/install/index.php');
|
||||
exit();
|
||||
}
|
||||
*/
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// 执行HTTP应用并响应
|
||||
$http = (new App())->http;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||
break;
|
||||
}
|
||||
location / {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,18 +8,10 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Route;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
// +----------------------------------------------------------------------
|
||||
Route::get('think', function () {
|
||||
return 'hello,ThinkPHP6!';
|
||||
});
|
||||
|
||||
return [
|
||||
// 是否强制使用路由
|
||||
'url_route_must' => false,
|
||||
// 合并路由规则
|
||||
'route_rule_merge' => true,
|
||||
// 路由是否完全匹配
|
||||
'route_complete_match' => false,
|
||||
// 是否自动转换URL中的控制器和操作名
|
||||
'url_convert' => true,
|
||||
];
|
||||
Route::get('hello/:name', 'index/hello');
|
||||
Loading…
Reference in New Issue