From 2422809afaad146f88beecf0249878f88328ba91 Mon Sep 17 00:00:00 2001 From: augushong Date: Thu, 12 Nov 2020 17:48:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=93=BE=E6=8E=A5=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 10 +++++++--- app/model/Nav.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/common.php b/app/common.php index e6c7f7c..8e4304e 100644 --- a/app/common.php +++ b/app/common.php @@ -72,11 +72,15 @@ function get_system_config($name = '', $default = '') return $default; } -function get_source_link($url) +function get_source_link($url,$default = '') { - if (empty($url)) { - $url = '/static/images/avatar.png'; + + if(!empty($default)){ + $url = $default; + }else{ + $url = '/static/images/avatar.png'; + } } if (strpos($url, '/') === 0) { return request()->domain() . $url; diff --git a/app/model/Nav.php b/app/model/Nav.php index 65cdfd2..fbea981 100644 --- a/app/model/Nav.php +++ b/app/model/Nav.php @@ -19,7 +19,7 @@ class Nav extends Model // public function getImgAttr($value) { - return get_source_link($value); + return get_source_link($value,'/static/images/noimg.png'); } public function getStatusNameAttr()