优化链接拼接

This commit is contained in:
augushong
2020-11-12 17:48:13 +08:00
parent 488af75e24
commit 2422809afa
2 changed files with 8 additions and 4 deletions

View File

@@ -72,11 +72,15 @@ function get_system_config($name = '', $default = '')
return $default; return $default;
} }
function get_source_link($url) function get_source_link($url,$default = '')
{ {
if (empty($url)) { if (empty($url)) {
$url = '/static/images/avatar.png';
if(!empty($default)){
$url = $default;
}else{
$url = '/static/images/avatar.png';
}
} }
if (strpos($url, '/') === 0) { if (strpos($url, '/') === 0) {
return request()->domain() . $url; return request()->domain() . $url;

View File

@@ -19,7 +19,7 @@ class Nav extends Model
// //
public function getImgAttr($value) public function getImgAttr($value)
{ {
return get_source_link($value); return get_source_link($value,'/static/images/noimg.png');
} }
public function getStatusNameAttr() public function getStatusNameAttr()