From 09a33718d5ecde8eab7d058b7322401e79b7df98 Mon Sep 17 00:00:00 2001 From: liapples Date: Wed, 28 Jul 2021 18:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E5=86=8C=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E5=92=8C=E8=B4=AD=E4=B9=B0=E5=8D=8F=E8=AE=AE=E7=9A=84?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/AgentInfoController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/AgentInfoController.php b/app/Http/Controllers/Api/AgentInfoController.php index 41c9bf8..7c7db8b 100644 --- a/app/Http/Controllers/Api/AgentInfoController.php +++ b/app/Http/Controllers/Api/AgentInfoController.php @@ -5,12 +5,18 @@ namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use App\Models\AgentInfo; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Cache; class AgentInfoController extends Controller { - public function about() + public function info() { - $about = AgentInfo::where('agent_id', $this->agent_id)->value('about'); - return $this->success(['about' => $about]); + $type = request()->route('type');; + //关于我们、注册协议、购买协议 + if (!in_array($type, ['about', 'reg_protocol', 'buy_protocol'])) { + return $this->error('参数无效'); + } + $about = AgentInfo::where('agent_id', $this->agent_id)->value($type); + return $this->success([$type => $about]); } }