Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
aaced7d8af021ee0b2689e12c203dfa257a2ec04
1 parent
51165e46
修改最新上架以及路由
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
5 deletions
library/Api/Yohobuy.php
library/LibModels/Web/Home/IndexData.php
yohobuy/www.yohobuy.com/application/Bootstrap.php
yohobuy/www.yohobuy.com/application/controllers/Common.php
yohobuy/www.yohobuy.com/application/models/Index/Home.php
library/Api/Yohobuy.php
View file @
aaced7d
...
...
@@ -71,6 +71,7 @@ class Yohobuy
}
// 苹果IPAD
elseif
(
strstr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'iPad'
))
{
return
'ipad'
;
}
elseif
(
stristr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'android'
))
{
...
...
@@ -78,7 +79,7 @@ class Yohobuy
}
// 其它
else
{
return
'
web
'
;
return
'
android
'
;
}
}
...
...
library/LibModels/Web/Home/IndexData.php
View file @
aaced7d
...
...
@@ -39,6 +39,6 @@ class IndexData
$params
[
'content_code'
]
=
$content_code
;
$params
[
'client_type'
]
=
$client_type
;
$params
[
'client_secret'
]
=
Sign
::
getSign
(
$params
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'operations/api/v5/resource/get'
,
$params
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
URL_OPERATIONS_RESOURCE_GET
,
$params
);
}
}
\ No newline at end of file
...
...
yohobuy/www.yohobuy.com/application/Bootstrap.php
View file @
aaced7d
...
...
@@ -70,8 +70,12 @@ class Bootstrap extends Bootstrap_Abstract
$module
=
'Index'
;
$controller
=
'Index'
;
$action
=
'Index'
;
$levelNum
=
2
;
if
(
APPLICATION_ENV
==
'developer'
)
{
$levelNum
=
3
;
}
// 三级域名
if
(
2
===
$level
)
{
if
(
$levelNum
===
$level
)
{
$subDomain
=
strval
(
$hostParts
[
0
]);
switch
(
strtolower
(
$subDomain
))
{
case
'www'
:
...
...
yohobuy/www.yohobuy.com/application/controllers/Common.php
View file @
aaced7d
...
...
@@ -3,6 +3,7 @@ use Action\WebAction;
use
Index\HomeModel
;
use
Plugin\Cache
;
use
Configs\CacheConfig
;
use
Api\Yohobuy
;
class
CommonController
extends
WebAction
{
...
...
@@ -58,10 +59,47 @@ class CommonController extends WebAction
}
$result
=
array
(
'code'
=>
200
,
'
commodity
'
=>
$result
'
goods
'
=>
$result
);
}
while
(
false
);
$this
->
echoJson
(
$result
);
}
/**
* 获取资源位banner
*
* @return jsonp
*/
public
function
getbannerAction
()
{
$url
=
'http://service.api.yohobuy.com/operations/api/v4/resource/get?'
;
$content_code
=
$this
->
_get
(
'content_code'
,
''
);
$client_type
=
$this
->
_get
(
'client_type'
,
'web'
);
$callback
=
$this
->
_get
(
'callback'
,
''
);
$params
=
array
(
'content_code'
=>
$content_code
,
'client_type'
=>
$client_type
);
$data
=
Yohobuy
::
get
(
$url
.
http_build_query
(
$params
));
if
(
empty
(
$data
))
{
return
$this
->
helpJsonCallbackResult
(
$callback
,
200
,
'没有数据'
,
''
);
}
else
{
$data
=
json_decode
(
$data
,
true
);
$banner
=
''
;
if
(
isset
(
$data
[
'data'
][
0
][
'data'
]))
{
$banner
=
current
(
$data
[
'data'
][
0
][
'data'
]);
if
(
!
empty
(
$banner
))
{
$banner
[
'src'
]
=
Images
::
getImageUrl
(
$banner
[
'src'
],
2600
,
60
,
2
);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
}
}
}
return
$this
->
helpJsonCallbackResult
(
$callback
,
$data
[
'code'
],
$data
[
'message'
],
$banner
);
}
}
\ No newline at end of file
...
...
yohobuy/www.yohobuy.com/application/models/Index/Home.php
View file @
aaced7d
...
...
@@ -210,7 +210,6 @@ class HomeModel
foreach
(
$goodsList
as
$goods
)
{
// 格式化数据
$val
=
Helpers
::
formatProduct
(
$goods
,
true
,
true
,
true
,
280
,
373
);
$val
[
'img'
]
=
$val
[
'thumb'
];
if
(
$val
[
'price'
]
==
false
)
{
$val
[
'price'
]
=
$val
[
'salePrice'
];
}
...
...
Please
register
or
login
to post a comment