|
@@ -492,38 +492,33 @@ function list_birthday_age($list){
|
|
|
}
|
|
|
return $list;
|
|
|
}
|
|
|
-
|
|
|
//结果集信息里,多个字段需要增加domain_cdnurl
|
|
|
-function list_domain_image($list,$field,$extend = []){
|
|
|
+function list_domain_image($list,$field){
|
|
|
if(!$list || empty($list)){
|
|
|
return $list;
|
|
|
}
|
|
|
foreach($list as $vo => $info){
|
|
|
- $list[$vo] = info_domain_image($info,$field,$extend);
|
|
|
+ $list[$vo] = info_domain_image($info,$field);
|
|
|
}
|
|
|
return $list;
|
|
|
}
|
|
|
//单条信息里,多个字段需要增加domain_cdnurl
|
|
|
//支持image,images
|
|
|
-function info_domain_image($data,$field,$extend = []){
|
|
|
+function info_domain_image($data,$field){
|
|
|
if(!$data || empty($data)){
|
|
|
return $data;
|
|
|
}
|
|
|
foreach($data as $key => $val){
|
|
|
if(in_array($key,$field)){
|
|
|
$more = strpos($key,'images');
|
|
|
- $water_icon = false;
|
|
|
- if($key == 'image' || $key == 'images' || $key == 'avatar' || $key == 'photo_images'){
|
|
|
- $water_icon = true;
|
|
|
- }
|
|
|
- $data[$key] = one_domain_image($val,$more,$extend,$water_icon);
|
|
|
+ $data[$key] = one_domain_image($val,$more);
|
|
|
}
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
//支持单个字段,需要增加domain_cdnurl
|
|
|
//支持image,images
|
|
|
-function one_domain_image($one,$more = false,$extend = [],$water_icon = false){
|
|
|
+function one_domain_image($one,$more = false){
|
|
|
if(!$one){
|
|
|
return $one;
|
|
|
}
|
|
@@ -531,35 +526,23 @@ function one_domain_image($one,$more = false,$extend = [],$water_icon = false){
|
|
|
//逗号隔开的多个图片
|
|
|
$one = explode(',',$one);
|
|
|
foreach($one as $k => $v){
|
|
|
- $one[$k] = localpath_to_netpath($v,$extend,$water_icon);
|
|
|
+ $one[$k] = localpath_to_netpath($v);
|
|
|
}
|
|
|
$one = implode(',',$one);
|
|
|
}else{
|
|
|
- $one = localpath_to_netpath($one,$extend,$water_icon);
|
|
|
+ $one = localpath_to_netpath($one);
|
|
|
}
|
|
|
return $one;
|
|
|
}
|
|
|
//本地地址转换为网络地址
|
|
|
-function localpath_to_netpath($path,$extend = [],$water_icon = false)
|
|
|
+function localpath_to_netpath($path)
|
|
|
{
|
|
|
- //水印参数
|
|
|
- $water_param = '';
|
|
|
- if($water_icon == true){
|
|
|
- $username = isset($extend['username']) ? $extend['username'] : 'Tken';
|
|
|
- $water_param = water_param($username);
|
|
|
- }
|
|
|
-
|
|
|
- //
|
|
|
if (empty($path)) {
|
|
|
return '';
|
|
|
} elseif (strrpos($path, 'http') !== false) {
|
|
|
- if(strrpos($path, 'https://oss.tken.vip') !== false) {
|
|
|
- return $path.$water_param; //oss的才加水印参数
|
|
|
- }else{
|
|
|
- return $path;
|
|
|
- }
|
|
|
+ return $path;
|
|
|
} else {
|
|
|
- return config('domain_cdnurl') . str_replace("\\", "/", $path).$water_param; //加水印
|
|
|
+ return config('domain_cdnurl') . str_replace("\\", "/", $path);
|
|
|
}
|
|
|
}
|
|
|
|