diff --git a/app/Command/CronTaskCommand.php b/app/Command/CronTaskCommand.php new file mode 100644 index 0000000..72094dc --- /dev/null +++ b/app/Command/CronTaskCommand.php @@ -0,0 +1,57 @@ +setDescription('Create a new cron task class'); + + parent::configure(); + } + + /** + * 获取stub文件 + * @return string + */ + protected function getStub(): string + { + return __DIR__ . '/stubs/cron.stub'; + } + + /** + * 获取默认命名空间 + * @return string + */ + protected function getDefaultNamespace(): string + { + return 'App\\Cron'; + } +} \ No newline at end of file diff --git a/app/Command/ServiceCommand.php b/app/Command/ServiceCommand.php new file mode 100644 index 0000000..3d5bea3 --- /dev/null +++ b/app/Command/ServiceCommand.php @@ -0,0 +1,49 @@ +setDescription('Create a new service class'); + + parent::configure(); + } + + /** + * 获取stub文件 + * @return string + */ + protected function getStub(): string + { + return __DIR__ . '/stubs/service.stub'; + } + + /** + * 获取默认命名空间 + * @return string + */ + protected function getDefaultNamespace(): string + { + return 'App\\Service'; + } +} \ No newline at end of file diff --git a/app/Command/stubs/cron.stub b/app/Command/stubs/cron.stub new file mode 100644 index 0000000..0488111 --- /dev/null +++ b/app/Command/stubs/cron.stub @@ -0,0 +1,23 @@ +handle(); + } +} diff --git a/app/Lib/AdminReturn.php b/app/Lib/AdminReturn.php new file mode 100644 index 0000000..03b6d34 --- /dev/null +++ b/app/Lib/AdminReturn.php @@ -0,0 +1,47 @@ + $code, + 'message' => $msg, + 'data' => $data + ]; + + return array_merge($res, $debug); + } + + /** + * 通用api返回 + * @param string $msg + * @param array $data + * @param int $code + * @param array $debug + * @return array + */ + public static function error(string $msg = 'error', array $data = [], int $code = ReturnCode::ERROR, array $debug = []): array + { + $res = [ + 'code' => $code, + 'message' => $msg, + 'data' => $data + ]; + + return array_merge($res, $debug); + } +} \ No newline at end of file diff --git a/app/Request/Admin/LoginRequest.php b/app/Request/Admin/LoginRequest.php new file mode 100644 index 0000000..9c28b96 --- /dev/null +++ b/app/Request/Admin/LoginRequest.php @@ -0,0 +1,28 @@ +adminId = Context::get("admin_id",0); + $this->roleId = Context::get("role_id",0); + } + + /** + * 主体函数抽象类 + */ + abstract public function handle(); +} \ No newline at end of file diff --git a/app/Service/Admin/User/LoginService.php b/app/Service/Admin/User/LoginService.php new file mode 100644 index 0000000..97ef803 --- /dev/null +++ b/app/Service/Admin/User/LoginService.php @@ -0,0 +1,22 @@ + [ LogLevel::ALERT, LogLevel::CRITICAL, - LogLevel::DEBUG, +// LogLevel::DEBUG, LogLevel::EMERGENCY, LogLevel::ERROR, LogLevel::INFO,