|  | @@ -494,32 +494,32 @@ function list_birthday_age($list){
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //结果集信息里,多个字段需要增加domain_cdnurl
 | 
	
		
			
				|  |  | -function list_domain_image($list,$field){
 | 
	
		
			
				|  |  | +function list_domain_image($list,$field,$extend = []){
 | 
	
		
			
				|  |  |      if(!$list || empty($list)){
 | 
	
		
			
				|  |  |          return $list;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      foreach($list as $vo => $info){
 | 
	
		
			
				|  |  | -        $list[$vo] = info_domain_image($info,$field);
 | 
	
		
			
				|  |  | +        $list[$vo] = info_domain_image($info,$field,$extend);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      return $list;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  //单条信息里,多个字段需要增加domain_cdnurl
 | 
	
		
			
				|  |  |  //支持image,images
 | 
	
		
			
				|  |  | -function info_domain_image($data,$field){
 | 
	
		
			
				|  |  | +function info_domain_image($data,$field,$extend = []){
 | 
	
		
			
				|  |  |      if(!$data || empty($data)){
 | 
	
		
			
				|  |  |          return $data;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      foreach($data as $key => $val){
 | 
	
		
			
				|  |  |          if(in_array($key,$field)){
 | 
	
		
			
				|  |  |              $more = strpos($key,'images');
 | 
	
		
			
				|  |  | -            $data[$key] = one_domain_image($val,$more);
 | 
	
		
			
				|  |  | +            $data[$key] = one_domain_image($val,$more,$extend);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      return $data;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  //支持单个字段,需要增加domain_cdnurl
 | 
	
		
			
				|  |  |  //支持image,images
 | 
	
		
			
				|  |  | -function one_domain_image($one,$more = false){
 | 
	
		
			
				|  |  | +function one_domain_image($one,$more = false,$extend = []){
 | 
	
		
			
				|  |  |      if(!$one){
 | 
	
		
			
				|  |  |          return $one;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -527,23 +527,32 @@ function one_domain_image($one,$more = false){
 | 
	
		
			
				|  |  |          //逗号隔开的多个图片
 | 
	
		
			
				|  |  |          $one = explode(',',$one);
 | 
	
		
			
				|  |  |          foreach($one as $k => $v){
 | 
	
		
			
				|  |  | -            $one[$k] = localpath_to_netpath($v);
 | 
	
		
			
				|  |  | +            $one[$k] = localpath_to_netpath($v,$extend);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          $one = implode(',',$one);
 | 
	
		
			
				|  |  |      }else{
 | 
	
		
			
				|  |  | -        $one = localpath_to_netpath($one);
 | 
	
		
			
				|  |  | +        $one = localpath_to_netpath($one,$extend);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      return $one;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  //本地地址转换为网络地址
 | 
	
		
			
				|  |  | -function localpath_to_netpath($path)
 | 
	
		
			
				|  |  | +function localpath_to_netpath($path,$extend = [])
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | +    //水印参数
 | 
	
		
			
				|  |  | +    $u_id = isset($extend['u_id']) ? $extend['u_id'] : 'Tken';
 | 
	
		
			
				|  |  | +    $water_icon = water_icon($u_id);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    //
 | 
	
		
			
				|  |  |      if (empty($path)) {
 | 
	
		
			
				|  |  |          return '';
 | 
	
		
			
				|  |  |      } elseif (strrpos($path, 'http') !== false) {
 | 
	
		
			
				|  |  | -        return $path;
 | 
	
		
			
				|  |  | +        if(strrpos($path, 'https://oss.tken.vip') !== false) {
 | 
	
		
			
				|  |  | +            return $path.$water_icon;  //oss的才加水印参数
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            return $path;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  | -        return config('domain_cdnurl') . str_replace("\\", "/", $path);
 | 
	
		
			
				|  |  | +        return config('domain_cdnurl') . str_replace("\\", "/", $path).$water_icon; //加水印
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -852,4 +861,17 @@ if (!function_exists('httpurllocal')) {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return $url;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 七牛云水印链接
 | 
	
		
			
				|  |  | + * 传入用户展示id
 | 
	
		
			
				|  |  | + * https://developer.qiniu.com/dora/1316/image-watermarking-processing-watermark
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +function water_icon($username){
 | 
	
		
			
				|  |  | +    $shuiyin_img = 'kodo://tken'.config('site.shuiyin') ?: 'kodo://tken/logo.png';
 | 
	
		
			
				|  |  | +    $username    = $username ?: 'Tken';
 | 
	
		
			
				|  |  | +    $param_str = '?watermark/3/image/'.base64_encode($shuiyin_img).'/dissolve/50/ws/0.1/wst/0/text/'.base64_encode('@'.$username).'/fontsize/300/dissolve/80/gravity/SouthWest/dx/20/dy/20/fill/'.base64_encode('#FFFFFF');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return $param_str;
 | 
	
		
			
				|  |  |  }
 |