diff --git a/app/controller/api/Miss.php b/app/controller/api/Miss.php index da69fea..2a328f7 100644 --- a/app/controller/api/Miss.php +++ b/app/controller/api/Miss.php @@ -4,22 +4,28 @@ declare (strict_types=1); namespace app\controller\api; use app\util\StrRandom; +use think\Exception; use think\facade\App; use think\Response; class Miss extends Base { public function index(): Response { - $this->debug([ - 'TpVersion' => App::version(), - 'Float' => StrRandom::randomPhone() - ]); + $version = config('apiadmin.APP_VERSION'); + if (!$version) { + throw new Exception('请先执行安装脚本,完成项目初始化!'); + } else { + $this->debug([ + 'TpVersion' => App::version(), + 'Float' => StrRandom::randomPhone() + ]); - return $this->buildSuccess([ - 'Product' => config('apiadmin.APP_NAME'), - 'Version' => config('apiadmin.APP_VERSION'), - 'Company' => config('apiadmin.COMPANY_NAME'), - 'ToYou' => "I'm glad to meet you(终于等到你!)" - ]); + return $this->buildSuccess([ + 'Product' => config('apiadmin.APP_NAME'), + 'Version' => $version, + 'Company' => config('apiadmin.COMPANY_NAME'), + 'ToYou' => "I'm glad to meet you(终于等到你!)" + ]); + } } }