diff --git a/.gitignore b/.gitignore index 503f97d2..46a53868 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ laravels-timer-process.pid .DS_Store vars.yaml laravels.conf +laravels.pid diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c18c43cc..b9816391 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,6 +2,8 @@ namespace App\Exceptions; +use App\Module\Base; +use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Throwable; @@ -38,4 +40,19 @@ class Handler extends ExceptionHandler // }); } + + /** + * 将异常转换为 HTTP 响应。 + * @param $request + * @param Throwable $e + * @return array|\Illuminate\Http\JsonResponse|\Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response + * @throws Throwable + */ + public function render($request, Throwable $e) + { + if ($e instanceof ModelNotFoundException) { + return response()->json(Base::retError('数据不存在!')); + } + return parent::render($request, $e); + } } diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 082a71fe..777bca95 100755 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -13,6 +13,18 @@ use Redirect; */ class IndexController extends InvokeController { + public function __invoke($method, $action = '', $child = '') + { + $app = $method ?: 'main'; + if ($action) { + $app .= "__" . $action; + } + if (!method_exists($this, $app)) { + $app = method_exists($this, $method) ? $method : 'main'; + } + return $this->$app($child); + } + /** * 首页 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 9c58185d..7a90d9d9 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -4,7 +4,24 @@ namespace App\Models; /** * Class Setting + * * @package App\Models + * @property int $id + * @property string|null $title + * @property string|null $desc 参数描述、备注 + * @property string|null $setting + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|Setting newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Setting newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Setting query() + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereDesc($value) + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereSetting($value) + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereTitle($value) + * @method static \Illuminate\Database\Eloquent\Builder|Setting whereUpdatedAt($value) + * @mixin \Eloquent */ class Setting extends AbstractModel { diff --git a/app/Models/Tmp.php b/app/Models/Tmp.php index ebe07411..621301c8 100644 --- a/app/Models/Tmp.php +++ b/app/Models/Tmp.php @@ -4,7 +4,24 @@ namespace App\Models; /** * Class Tmp + * * @package App\Models + * @property int $id + * @property string|null $title + * @property string|null $value + * @property string|null $content + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|Tmp newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Tmp newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Tmp query() + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereContent($value) + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereTitle($value) + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereUpdatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|Tmp whereValue($value) + * @mixin \Eloquent */ class Tmp extends AbstractModel { diff --git a/app/Models/User.php b/app/Models/User.php index 946904f9..80bb70ff 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,7 +8,49 @@ use Cache; /** * Class User + * * @package App\Models + * @property int $userid + * @property array $identity 身份 + * @property string|null $az A-Z + * @property string|null $username 用户名 + * @property string $nickname 昵称 + * @property string|null $userimg 头像 + * @property string|null $encrypt + * @property string|null $userpass 登录密码 + * @property int|null $loginnum 累计登录次数 + * @property int|null $changepass 登录需要修改密码 + * @property string|null $lastip 最后登录IP + * @property int|null $lastdate 最后登录时间 + * @property string|null $lineip 最后在线IP(接口) + * @property int|null $linedate 最后在线时间(接口) + * @property string|null $regip 注册IP + * @property int|null $regdate 注册时间 + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @property-read string $usering + * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|User newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|User query() + * @method static \Illuminate\Database\Eloquent\Builder|User whereAz($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereChangepass($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereEncrypt($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereIdentity($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereLastdate($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereLastip($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereLinedate($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereLineip($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereLoginnum($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereNickname($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereRegdate($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereRegip($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereUserid($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereUserimg($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereUsername($value) + * @method static \Illuminate\Database\Eloquent\Builder|User whereUserpass($value) + * @mixin \Eloquent */ class User extends AbstractModel { diff --git a/app/Models/WebSocket.php b/app/Models/WebSocket.php index 71323eb3..9b86ac3b 100644 --- a/app/Models/WebSocket.php +++ b/app/Models/WebSocket.php @@ -4,7 +4,22 @@ namespace App\Models; /** * Class WebSocket + * * @package App\Model + * @property string $key + * @property string|null $fd + * @property int|null $userid + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket query() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereFd($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereKey($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUpdatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUserid($value) + * @mixin \Eloquent */ class WebSocket extends AbstractModel { diff --git a/app/Models/WebSocketTmpMsg.php b/app/Models/WebSocketTmpMsg.php index 95d572ee..73671881 100644 --- a/app/Models/WebSocketTmpMsg.php +++ b/app/Models/WebSocketTmpMsg.php @@ -4,7 +4,26 @@ namespace App\Models; /** * Class WebSocketTmpMsg + * * @package App\Models + * @property int $id + * @property string|null $md5 MD5(会员ID-消息) + * @property string|null $msg 详细消息 + * @property int|null $send 是否已发送 + * @property int|null $create_id 所属会员ID + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg query() + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereCreateId($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereMd5($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereMsg($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereSend($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketTmpMsg whereUpdatedAt($value) + * @mixin \Eloquent */ class WebSocketTmpMsg extends AbstractModel { diff --git a/resources/views/ie.blade.php b/resources/views/ie.blade.php new file mode 100755 index 00000000..61e7dd9c --- /dev/null +++ b/resources/views/ie.blade.php @@ -0,0 +1,91 @@ + + +
+
+
+

你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

+ +
+
+ diff --git a/resources/views/main.blade.php b/resources/views/main.blade.php new file mode 100755 index 00000000..c16665ba --- /dev/null +++ b/resources/views/main.blade.php @@ -0,0 +1,44 @@ + + + + + + + + + + + + {{ config('app.name', 'WebPage') }} + + + + + + + + +@extends('ie') +
+
+
+
PAGE LOADING
+ + + + + + + +
+
+
+ + + + + diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php deleted file mode 100644 index b1905c92..00000000 --- a/resources/views/welcome.blade.php +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - Laravel - - - - - - - - - - -
- @if (Route::has('login')) - - @endif - -
-
- - - - - -
- -
-
-
- - -
-
- Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end. -
-
-
- -
-
- - -
- -
-
- Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. -
-
-
- -
-
- - -
- -
-
- Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials. -
-
-
- -
-
- -
Vibrant Ecosystem
-
- -
-
- Laravel's robust library of first-party tools and libraries, such as Forge, Vapor, Nova, and Envoyer help you take your projects to the next level. Pair them with powerful open source libraries like Cashier, Dusk, Echo, Horizon, Sanctum, Telescope, and more. -
-
-
-
-
- -
-
-
- - - - - - Shop - - - - - - - - Sponsor - -
-
- -
- Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) -
-
-
-
- - diff --git a/routes/web.php b/routes/web.php index b1303973..1616a9ee 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ middleware(['webapi'])->group(function () { + +}); + +/** + * 页面 + */ +Route::middleware(['webapi'])->group(function () { + Route::any('/', IndexController::class); + Route::any('/{method}', IndexController::class); + Route::any('/{method}/{action}', IndexController::class); + Route::any('/{method}/{action}/{child}', IndexController::class); + Route::any('/{method}/{action}/{child}/{n}', IndexController::class); + Route::any('/{method}/{action}/{child}/{n}/{c}', IndexController::class); });