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
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
9c385adc2c0251987a3a4c0fc6701bde147a3fb5
1 parent
8641e3ca
code review by fei.hong: do format new arrival codes
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
14 deletions
library/WebPlugin/DataProcess/Process.php
library/WebPlugin/Helpers.php
yohobuy/www.yohobuy.com/application/controllers/Common.php
library/WebPlugin/DataProcess/Process.php
View file @
9c385ad
...
...
@@ -867,7 +867,7 @@ class Process
'img'
=>
$val
[
'src'
]
);
}
$floor
[
'moreBrand'
]
=
'http://yohobuy.com/brands'
;
$floor
[
'moreBrand'
]
=
Helpers
::
url
(
'/brands'
)
;
$type_key
=
sprintf
(
"%s_%s"
,
$type
,
$key
);
$cacheKey
=
sprintf
(
"%s_%s"
,
WebCacheConfig
::
KEY_WEB_INDEX_BRANDS_LIST_DATA
,
$type_key
);
Cache
::
set
(
$cacheKey
,
$floor
,
86400
);
...
...
library/WebPlugin/Helpers.php
View file @
9c385ad
...
...
@@ -24,7 +24,7 @@ class Helpers
switch
(
$module
)
{
case
'default'
:
$url
=
'http://
m
.yohobuy.com'
;
$url
=
'http://
www
.yohobuy.com'
;
break
;
case
'guang'
:
// 逛
$url
=
'http://guang'
.
SUB_DOMAIN
;
...
...
yohobuy/www.yohobuy.com/application/controllers/Common.php
View file @
9c385ad
<?php
use
Action\WebAction
;
use
Index\HomeModel
;
use
Configs\WebCacheConfig
;
use
LibModels\Web\Home\IndexData
;
use
WebPlugin\Cache
;
use
Configs\WebCacheConfig
;
use
Api\Yohobuy
;
use
WebPlugin\Images
;
use
WebPlugin\Helpers
;
...
...
@@ -16,15 +15,27 @@ class CommonController extends WebAction
*/
public
function
getIndexResourceBrandAction
()
{
$data
=
array
();
do
{
if
(
!
$this
->
isAjax
())
{
break
;
}
$type
=
$this
->
get
(
'type'
);
if
(
empty
(
$type
))
{
break
;
}
}
while
(
false
);
// 首页资源品牌,采用内存存储
$type
=
$this
->
get
(
'type'
);
$data
=
array
();
if
(
!
empty
(
$type
))
{
$key
=
WebCacheConfig
::
KEY_WEB_INDEX_BRANDS_LIST_DATA
.
'_'
.
$type
;
// array('logoBrand'=>'','moreBrand'=>'')
$data
=
Cache
::
get
(
$key
);
}
echo
$this
->
echoJson
(
$data
);
$this
->
echoJson
(
$data
);
}
/**
...
...
@@ -36,7 +47,7 @@ class CommonController extends WebAction
*/
public
function
getNewArrivalAction
()
{
$result
=
$data
=
array
();
$result
=
array
();
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
...
...
@@ -53,23 +64,29 @@ class CommonController extends WebAction
$pageCount
=
(
int
)
$this
->
post
(
'pageCount'
,
8
);
if
(
!
in_array
(
$channel
,
$channels
))
{
break
;
}
else
{
$data
=
HomeModel
::
getNewArrival
(
$channel
);
}
if
(
$pageIndex
<
0
)
{
$data
=
HomeModel
::
getNewArrival
(
$channel
);
if
(
empty
(
$data
))
{
break
;
}
if
(
$pageIndex
<
0
)
{
$pageIndex
=
0
;
}
if
(
$pageCount
<
0
||
$pageCount
>
50
)
{
if
(
$pageCount
<
0
||
$pageCount
>
50
)
{
$pageCount
=
20
;
}
$result
=
array_slice
(
$data
,
$pageIndex
,
$pageCount
);
if
(
empty
(
$result
))
{
$data
=
array_slice
(
$data
,
$pageIndex
,
$pageCount
);
if
(
empty
(
$data
))
{
break
;
}
$result
=
array
(
'code'
=>
200
,
'goods'
=>
$
result
'goods'
=>
$
data
);
$data
=
array
();
}
while
(
false
);
$this
->
echoJson
(
$result
);
...
...
Please
register
or
login
to post a comment