Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
yyq
9 years ago
Commit
9db4e69b7621b81f4d5e922681e7f26fd9586226
2 parents
328b91d4
88342ad1
Merge branch 'hotfix/returnImage'
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
15 deletions
library/Api/Yohobuy.php
library/Plugin/Images.php
yohobuy/www.yohobuy.com/application/models/Home/Returns.php
library/Api/Yohobuy.php
View file @
9db4e69
...
...
@@ -22,21 +22,21 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
//java API
const
API_URL
=
'http://api.yoho.yohoops.org/'
;
//
const
API_URL2
=
'http://api.yoho.yohoops.org/'
;
//
const
SERVICE_URL
=
'http://service.yoho.yohoops.org/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
const
API_OLD
=
'http://api2.open.yohobuy.com/'
;
// const API_URL = 'http://api.yoho.yohoops.org/';//
// const API_URL2 = 'http://api.yoho.yohoops.org/';//
// const SERVICE_URL = 'http://service.yoho.yohoops.org/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
// 支付回调地址
const
SERVICE_NOTIFY
=
'http://service.yoho.cn/'
;
//
const SERVICE_NOTIFY = 'http://service.yoho.cn/';
// 测试环境 */
/*
const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
const
API_URL
=
'http://testapi.yoho.cn:28078/'
;
// 'http://192.168.102.205:8080/gateway/'
const
SERVICE_URL
=
'http://testservice.yoho.cn:28077/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
const
API_OLD
=
'http://test2.open.yohobuy.com/'
;
// 支付回调地址
const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
*/
const
SERVICE_NOTIFY
=
'http://testservice.yoho.cn:28077/'
;
/* 预览环境 */
// const API_URL = 'http://preapi.yoho.cn/';
...
...
library/Plugin/Images.php
View file @
9db4e69
...
...
@@ -106,8 +106,9 @@ class Images
/**
* 图片上传
* @param string $name 文件表单name, 即用于$_FILES[$name]
* @param string $path
*/
public
static
function
saveImage
(
$name
)
public
static
function
saveImage
(
$name
,
$path
=
'suggest'
)
{
if
(
empty
(
$_FILES
[
$name
]))
{
return
array
();
...
...
@@ -124,7 +125,7 @@ class Images
$images
[
$files
[
'name'
]]
=
$files
[
'tmp_name'
];
}
return
self
::
uploadStreamImage
(
$images
);
return
self
::
uploadStreamImage
(
$images
,
$path
);
}
/**
...
...
@@ -132,9 +133,10 @@ class Images
*
* @param string | array(filename => absolute file path) $file
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
* @param string $path
* @return mixed
*/
public
static
function
uploadStreamImage
(
$file
)
public
static
function
uploadStreamImage
(
$file
,
$path
=
'suggest'
)
{
$end
=
"
\r\n
"
;
$twoHyphens
=
"--"
;
...
...
@@ -158,7 +160,7 @@ class Images
$stream
.=
$twoHyphens
.
$boundary
.
$end
;
$stream
.=
"Content-Disposition: form-data; "
.
"name=
\"
project
\"
"
.
$end
;
$stream
.=
$end
;
$stream
.=
"suggest"
;
//project sns
$stream
.=
$path
;
//project sns
$stream
.=
$end
;
$stream
.=
$twoHyphens
.
$boundary
.
$twoHyphens
.
$end
;
$opts
=
array
(
...
...
@@ -177,14 +179,14 @@ class Images
if
(
count
(
$file
)
==
1
||
!
is_array
(
$file
))
{
$imgRelUrl
=
current
(
$result
[
'data'
][
'imagesList'
]);
$imgList
[
'imgList'
][]
=
array
(
'imgUrl'
=>
self
::
getSourceUrl
(
$imgRelUrl
,
'suggest'
)
.
$imgExtra
,
'imgUrl'
=>
self
::
getSourceUrl
(
$imgRelUrl
,
$path
)
.
$imgExtra
,
'imgRelUrl'
=>
$imgRelUrl
);
}
else
{
$img
=
array
();
foreach
(
$result
[
'data'
][
'imagesList'
]
as
$val
)
{
$img
=
array
();
$img
[
'imgUrl'
]
=
self
::
getSourceUrl
(
$val
,
'suggest'
)
.
$imgExtra
;
$img
[
'imgUrl'
]
=
self
::
getSourceUrl
(
$val
,
$path
)
.
$imgExtra
;
$img
[
'imgRelUrl'
]
=
$val
;
$imgList
[
'imgList'
][]
=
$img
;
}
...
...
yohobuy/www.yohobuy.com/application/models/Home/Returns.php
View file @
9db4e69
...
...
@@ -479,7 +479,7 @@ class ReturnsModel
// if (!in_array($_FILES['fileData']['type'],$type)) {
// return array('code'=>'400','message'=>'图片格式错误');
// }
$result
=
Images
::
saveImage
(
$filename
);
$result
=
Images
::
saveImage
(
$filename
,
'evidenceImages'
);
}
return
$result
;
...
...
Please
register
or
login
to post a comment