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
Rock Zhang
9 years ago
Commit
32ecc9360f6cb732524b139d97e130159cd08b06
1 parent
5ba8f735
添加有货币页面总部的banner数据
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
library/Configs/CacheConfig.php
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
library/Configs/CacheConfig.php
View file @
32ecc93
...
...
@@ -58,4 +58,6 @@ class CacheConfig
const
KEY_INDEX_BRANDS_LIST_DATA
=
'key_index_brands_list_data'
;
//频道brands数据
const
KEY_CODE_YOHOCOIN_BANNER
=
'key_code_yohocoin_banner'
;
// 有货币banner数据
}
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
32ecc93
...
...
@@ -261,6 +261,8 @@ class HomeController extends AbstractAction
$this
->
setNavHeader
(
'YOHO币'
,
true
,
false
);
$currency
=
UserModel
::
getYohoCoinData
(
$this
->
_uid
);
// banenr数据
$currency
[
'banner'
]
=
UserModel
::
getYohoCoinBanner
();
$currency
[
'pageFooter'
]
=
true
;
$this
->
_view
->
display
(
'currency'
,
$currency
);
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
32ecc93
...
...
@@ -3,6 +3,7 @@
namespace
Index
;
use
Configs\CacheConfig
;
use
LibModels\Wap\Home\IndexData
;
use
LibModels\Wap\Home\UserData
;
use
Plugin\Cache
;
use
Plugin\Helpers
;
...
...
@@ -18,6 +19,7 @@ use Plugin\Images;
*/
class
UserModel
{
const
CODE_YOHOCOIN_BANNER
=
'a2ec977c027d0cd9cdccb356ddf16b08'
;
/**
* 处理用户个人详情数据
...
...
@@ -372,6 +374,45 @@ class UserModel
return
$result
;
}
public
static
function
getYohoCoinBanner
()
{
$result
=
false
;
if
(
USE_CACHE
)
{
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
CacheConfig
::
KEY_CODE_YOHOCOIN_BANNER
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
// 调用接口获取数据
$banner
=
IndexData
::
getBannerStart
(
self
::
CODE_YOHOCOIN_BANNER
);
if
(
isset
(
$banner
[
'code'
])
&&
$banner
[
'code'
]
==
200
&&
!
empty
(
$banner
[
'data'
]))
{
$result
=
array
();
// 处理数据
foreach
(
$banner
[
'data'
]
as
$val
)
{
foreach
(
$val
[
'data'
]
as
$single
)
{
$result
[
'url'
]
=
''
;
$result
[
'img'
]
=
Helpers
::
getImageUrl
(
$single
[
'src'
],
640
,
200
);
}
}
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
CacheConfig
::
KEY_CODE_YOHOCOIN_BANNER
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_CODE_YOHOCOIN_BANNER
,
$result
);
}
}
return
$result
;
}
/**
* 处理YOHO币变化履历数据
*
...
...
Please
register
or
login
to post a comment