From aa5e714ceb0bd9b739cad1dac484b53126af3488 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Sun, 29 Mar 2020 20:47:47 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E6=96=87=E6=A1=A3=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=99=AE=E9=80=9A=E6=A8=A1=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/BuildToken.php | 5 +---- application/wiki/controller/Api.php | 8 +++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/application/api/controller/BuildToken.php b/application/api/controller/BuildToken.php index a2f8996..595a2e6 100644 --- a/application/api/controller/BuildToken.php +++ b/application/api/controller/BuildToken.php @@ -15,7 +15,7 @@ class BuildToken extends Base { /** * 构建AccessToken - * @return \think\response\Json + * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException @@ -23,9 +23,6 @@ class BuildToken extends Base { */ public function getAccessToken() { $param = $this->request->param(); - if (empty($param['app_id'])) { - return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少app_id'); - } $appInfo = (new AdminApp())->where(['app_id' => $param['app_id'], 'app_status' => 1])->find(); if (empty($appInfo)) { return $this->buildFailed(ReturnCode::INVALID, '应用ID非法'); diff --git a/application/wiki/controller/Api.php b/application/wiki/controller/Api.php index 45e2048..cf8ce03 100644 --- a/application/wiki/controller/Api.php +++ b/application/wiki/controller/Api.php @@ -154,12 +154,18 @@ class Api extends Base { $groupInfo->hot = $groupInfo->hot + 1; $groupInfo->save(); + if ($apiList['hash_type'] === 1) { + $url = $this->request->domain() . '/api/' . $apiList['api_class']; + } else { + $url = $this->request->domain() . '/api/' . $hash; + } + return $this->buildSuccess([ 'request' => $request, 'response' => $response, 'dataType' => $dataType, 'apiList' => $apiList, - 'url' => $this->request->domain() . '/api/' . $hash, + 'url' => $url, 'co' => config('apiadmin.APP_NAME') . ' ' . config('apiadmin.APP_VERSION') ]); }