Authored by 周少峰

return images error

@@ -22,21 +22,21 @@ class Yohobuy @@ -22,21 +22,21 @@ class Yohobuy
22 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 22 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
23 23
24 //java API 24 //java API
25 - const API_URL = 'http://api.yoho.yohoops.org/';//  
26 - const API_URL2 = 'http://api.yoho.yohoops.org/';//  
27 - const SERVICE_URL = 'http://service.yoho.yohoops.org/';  
28 - const YOHOBUY_URL = 'http://www.yohobuy.com/';  
29 - const API_OLD = 'http://api2.open.yohobuy.com/'; 25 +// const API_URL = 'http://api.yoho.yohoops.org/';//
  26 +// const API_URL2 = 'http://api.yoho.yohoops.org/';//
  27 +// const SERVICE_URL = 'http://service.yoho.yohoops.org/';
  28 +// const YOHOBUY_URL = 'http://www.yohobuy.com/';
  29 +// const API_OLD = 'http://api2.open.yohobuy.com/';
30 // 支付回调地址 30 // 支付回调地址
31 - const SERVICE_NOTIFY = 'http://service.yoho.cn/'; 31 +// const SERVICE_NOTIFY = 'http://service.yoho.cn/';
32 32
33 // 测试环境 */ 33 // 测试环境 */
34 - /*const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' 34 + const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
35 const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 35 const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
36 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 36 const YOHOBUY_URL = 'http://www.yohobuy.com/';
37 const API_OLD = 'http://test2.open.yohobuy.com/'; 37 const API_OLD = 'http://test2.open.yohobuy.com/';
38 // 支付回调地址 38 // 支付回调地址
39 - const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';*/ 39 + const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
40 40
41 /* 预览环境 */ 41 /* 预览环境 */
42 // const API_URL = 'http://preapi.yoho.cn/'; 42 // const API_URL = 'http://preapi.yoho.cn/';
@@ -106,8 +106,9 @@ class Images @@ -106,8 +106,9 @@ class Images
106 /** 106 /**
107 * 图片上传 107 * 图片上传
108 * @param string $name 文件表单name, 即用于$_FILES[$name] 108 * @param string $name 文件表单name, 即用于$_FILES[$name]
  109 + * @param string $path
109 */ 110 */
110 - public static function saveImage($name) 111 + public static function saveImage($name, $path = 'suggest')
111 { 112 {
112 if (empty($_FILES[$name])) { 113 if (empty($_FILES[$name])) {
113 return array(); 114 return array();
@@ -124,7 +125,7 @@ class Images @@ -124,7 +125,7 @@ class Images
124 $images[$files['name']] = $files['tmp_name']; 125 $images[$files['name']] = $files['tmp_name'];
125 } 126 }
126 127
127 - return self::uploadStreamImage($images); 128 + return self::uploadStreamImage($images, $path);
128 } 129 }
129 130
130 /** 131 /**
@@ -132,9 +133,10 @@ class Images @@ -132,9 +133,10 @@ class Images
132 * 133 *
133 * @param string | array(filename => absolute file path) $file 134 * @param string | array(filename => absolute file path) $file
134 * url:http://upload.static.yohobuy.com?project=sns&fileData=xxx 135 * url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
  136 + * @param string $path
135 * @return mixed 137 * @return mixed
136 */ 138 */
137 - public static function uploadStreamImage($file) 139 + public static function uploadStreamImage($file, $path = 'suggest')
138 { 140 {
139 $end = "\r\n"; 141 $end = "\r\n";
140 $twoHyphens = "--"; 142 $twoHyphens = "--";
@@ -158,7 +160,7 @@ class Images @@ -158,7 +160,7 @@ class Images
158 $stream .= $twoHyphens . $boundary . $end; 160 $stream .= $twoHyphens . $boundary . $end;
159 $stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end; 161 $stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end;
160 $stream .= $end; 162 $stream .= $end;
161 - $stream .= "suggest"; //project sns 163 + $stream .= $path; //project sns
162 $stream .= $end; 164 $stream .= $end;
163 $stream .= $twoHyphens . $boundary . $twoHyphens . $end; 165 $stream .= $twoHyphens . $boundary . $twoHyphens . $end;
164 $opts = array( 166 $opts = array(
@@ -479,7 +479,7 @@ class ReturnsModel @@ -479,7 +479,7 @@ class ReturnsModel
479 // if (!in_array($_FILES['fileData']['type'],$type)) { 479 // if (!in_array($_FILES['fileData']['type'],$type)) {
480 // return array('code'=>'400','message'=>'图片格式错误'); 480 // return array('code'=>'400','message'=>'图片格式错误');
481 // } 481 // }
482 - $result = Images::saveImage($filename); 482 + $result = Images::saveImage($filename, 'evidenceImages');
483 } 483 }
484 484
485 return $result; 485 return $result;