From 47e7f1e6c3a8e56fb22c70f9b075cdcbe21e647f Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 12 Dec 2021 23:20:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E4=BA=8E=E6=88=91=E4=BB=AC=E3=80=81?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=8D=8F=E8=AE=AE=E3=80=81=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=EF=BC=8C=E5=88=99=E6=98=BE=E7=A4=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/AgentInfoController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/AgentInfoController.php b/app/Http/Controllers/Api/AgentInfoController.php index 7fcd33b..9a283af 100644 --- a/app/Http/Controllers/Api/AgentInfoController.php +++ b/app/Http/Controllers/Api/AgentInfoController.php @@ -14,7 +14,13 @@ class AgentInfoController extends Controller 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]); + $value = AgentInfo::where('agent_id', $this->agent_id)->value($type); + + # 如果未设置关于我们、注册协议、购买协议,就显示默认的 + if (empty($value) || strlen($value) < 10) { + $value = admin_setting('common_' . $type); + } + + return $this->success([$type => $value]); } }