Authored by Rock Zhang

修复意见反馈上传图片返回的图片地址不正确的bug

@@ -24,9 +24,6 @@ class Images @@ -24,9 +24,6 @@ class Images
24 ), 24 ),
25 'yhb-head' => 'head.static.yhbimg.com' 25 'yhb-head' => 'head.static.yhbimg.com'
26 ); 26 );
27 - private static $staticDomain = array(  
28 - 'bucket' => ''  
29 - );  
30 private static $qiniuDomain = 'yhfair.qiniudn.com'; 27 private static $qiniuDomain = 'yhfair.qiniudn.com';
31 28
32 /** 29 /**
@@ -171,7 +168,7 @@ class Images @@ -171,7 +168,7 @@ class Images
171 $stream .= $twoHyphens.$boundary.$end; 168 $stream .= $twoHyphens.$boundary.$end;
172 $stream .="Content-Disposition: form-data; "."name=\"project\"".$end; 169 $stream .="Content-Disposition: form-data; "."name=\"project\"".$end;
173 $stream .= $end; 170 $stream .= $end;
174 - $stream .= "sns";//project sns 171 + $stream .= "suggest";//project sns
175 $stream .= $end; 172 $stream .= $end;
176 $stream .= $twoHyphens .$boundary .$twoHyphens .$end; 173 $stream .= $twoHyphens .$boundary .$twoHyphens .$end;
177 $opts = array( 174 $opts = array(
@@ -185,7 +182,18 @@ class Images @@ -185,7 +182,18 @@ class Images
185 $result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true); 182 $result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true);
186 if(!empty($result['data']['imagesList'])) 183 if(!empty($result['data']['imagesList']))
187 { 184 {
188 - return count($file) == 1 || !is_array($file) ? current($result['data']['imagesList']) : $result['data']['imagesList'] ; 185 + if(count($file) == 1 || !is_array($file))
  186 + {
  187 + return self::getSourceUrl(current($result['data']['imagesList']), 'suggest');
  188 + }
  189 + else
  190 + {
  191 + foreach ($result['data']['imagesList'] as &$val) {
  192 + $val = self::getSourceUrl($val, 'suggest');
  193 + }
  194 +
  195 + return $result['data']['imagesList'];
  196 + }
189 } 197 }
190 else 198 else
191 { 199 {