Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
f7e81dd6c503c1a011ddee7f46086b0a54541760
2 parents
dcc22191
39d64e45
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
226 additions
and
3 deletions
library/Configs/CacheConfig.php
library/LibModels/Wap/Home/GradeData.php
template/m.yohobuy.com/actions/index/home/privilege.phtml
template/m.yohobuy.com/actions/index/home/vip-grade.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/home/Grade.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Grade.php
library/Configs/CacheConfig.php
View file @
f7e81dd
...
...
@@ -43,5 +43,8 @@ class CacheConfig
const
KEY_ACTION_SEARCH_SEARCH
=
'key_action_search_search'
;
// 搜索的数据
const
KEY_ACTION_SEARCH_FILTER
=
'key_action_search_filter'
;
// 搜索的过滤条件
const
KEY_ACTION_HOME_GRADE
=
'key_action_home_grade'
;
//会员等级
const
KEY_ACTION_HOME_PREFERENTIAL
=
'key_action_home_preferential'
;
//会员特权详情
}
...
...
library/LibModels/Wap/Home/GradeData.php
0 → 100644
View file @
f7e81dd
<?php
namespace
LibModels\Wap\Home
;
use
Api\Yohobuy
;
use
Api\Sign
;
/*
* 个人中心-会员等级接口操作类
*/
class
GradeData
{
/**
* 获取会员等级数据
* @param string $yh_channel 频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他
* @param string $uid 用户id
* @return array 接口返回的会员等级数据
*/
public
function
getGradeData
(
$channel
,
$uid
)
{
$param
=
Yohobuy
::
param
();
$param
[
'yh_channel'
]
=
$channel
;
$param
[
'uid'
]
=
$uid
;
$param
[
'method'
]
=
'app.Passport.vip'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 获取会员特权详情数据
* @param string $yh_channel 频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他
* @param string $uid 用户id
* @return array 接口返回的会员特权详情数据
*/
public
function
getPreferentialData
(
$channel
,
$uid
)
{
$param
=
Yohobuy
::
param
();
$param
[
'yh_channel'
]
=
$channel
;
$param
[
'uid'
]
=
$uid
;
$param
[
'method'
]
=
'app.passport.getPrivilege'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 获取用户基本信息数据??获取不到
*/
// public function getUserProfileData($gender, $uid, $channel) {
// $param = Yohobuy::param();
// $param['gender'] = $gender;
// $param['uid'] = $uid;
// $param['yh_channel'] = $channel;
// $param['method'] = 'app.passport.profile';
// $param['client_secret'] = Sign::getSign($param);
// var_dump(Yohobuy::post(Yohobuy::API_URL,$param));
// }
}
...
...
template/m.yohobuy.com/actions/index/home/privilege.phtml
View file @
f7e81dd
{
{>
layout/header
}
}
<div
class=
"vip-grade-page yoho-page"
>
{
{#
vipGrade
}
}
{
{>
me/privilege
}
}
{
{>
me/
vip-grade/
privilege
}
}
{
{/
vipGrade
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/home/vip-grade.phtml
View file @
f7e81dd
...
...
@@ -23,9 +23,9 @@
</div>
{
{/unless
}
}
<a
class=
"all-privilege block"
>
<a
class=
"all-privilege block"
href=
"{{allUrl}}"
>
查看全部VIP特权
<span
class=
"iconfont
"
>
604
;</span>
<span
class="iconfont>
604
;</span>
</a>
{
{/
vipGrade
}
}
</div>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
f7e81dd
<?php
use
Action\AbstractAction
;
use
home\GradeModel
;
use
Plugin\Helpers
;
/**
...
...
@@ -225,5 +226,36 @@ class HomeController extends AbstractAction
}
}
/**
* 会员等级展示页
*/
public
function
gradeAction
(){
//设置网站seo信息
$this
->
setTitle
(
'会员等级'
);
//显示网站导航头部信息
$this
->
setNavHeader
(
'会员等级'
);
$gender
=
Helpers
::
getGenderByCookie
();
$channel
=
Helpers
::
getChannelByCookie
();
$uid
=
$this
->
getUid
();
$uid
=
'10267443'
;
//临时测试用
$data
=
GradeModel
::
getGrade
(
$gender
,
$channel
,
$uid
);
$this
->
_view
->
display
(
'vip-grade'
,
$data
);
}
/*
*会员特权查看页
*/
public
function
preferentialAction
(){
//设置网站seo信息
$this
->
setTitle
(
'会员等级'
);
//显示网站导航头部信息
$this
->
setNavHeader
(
'会员特权详情'
);
$channel
=
Helpers
::
getChannelByCookie
();
$uid
=
$this
->
getUid
();
$data
=
GradeModel
::
getPreferential
(
$channel
,
$uid
);
$this
->
_view
->
display
(
'privilege'
,
$data
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/home/Grade.php
0 → 100644
View file @
f7e81dd
<?php
namespace
home
;
use
LibModels\Wap\Home\GradeData
;
use
Action\AbstractAction
;
use
Plugin\Helpers
;
/**
* 会员等级相关数据处理
*/
class
GradeModel
{
/*
* 获取个人中心-会员等级数据
*/
public
function
getGrade
(
$gender
,
$channel
,
$uid
)
{
$result
=
array
();
if
(
USE_CACHE
)
{
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
CacheConfig
::
KEY_ACTION_HOME_GRADE
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
//调用接口获取数据
$data
=
GradeData
::
getGradeData
(
$channel
,
$uid
);
if
(
isset
(
$data
[
'code'
])
&&
$data
[
'code'
]
===
200
&&
isset
(
$data
[
'data'
]))
{
switch
(
intval
(
$data
[
'data'
][
'current_vip_level'
]))
{
case
0
://
普通会员
$result
[
'vipGrade'
][
'vip0'
]
=
true
;
break
;
case
1
://
银卡会员
$result
[
'vipGrade'
][
'vip1'
]
=
true
;
break
;
case
2
://
金卡会员
$result
[
'vipGrade'
][
'vip2'
]
=
true
;
break
;
case
3
://
白金会员
$result
[
'vipGrade'
][
'vip3'
]
=
true
;
break
;
}
//今年总消费
$result
[
'vipGrade'
][
'costOfThisYear'
]
=
$data
[
'data'
][
'current_year_cost'
];
//升级下一等级会员的进度;
$result
[
'vipGrade'
][
'percent'
]
=
100
*
(
round
(
round
(
$data
[
'data'
][
'current_total_cost'
],
2
)
/
round
(
$data
[
'data'
][
'next_need_cost'
],
2
),
2
));
//距离升级所需消费金额
if
(
$data
[
'data'
][
'current_vip_level'
]
!=
3
)
{
$result
[
'vipGrade'
][
'costGap'
]
=
$data
[
'data'
][
'upgrade_need_cost'
];
}
//消费总计
$result
[
'vipGrade'
][
'sumCost'
]
=
$data
[
'data'
][
'current_total_cost'
];
//username 接口问题取不到,暂时写uid
$result
[
'vipGrade'
][
'name'
]
=
$uid
;
$result
[
'vipGrade'
][
'allUrl'
]
=
Helpers
::
url
(
'/Home/preferential'
,
null
);
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
CacheConfig
::
KEY_ACTION_HOME_GRADE
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_ACTION_HOME_GRADE
,
$result
);
}
}
return
$result
;
}
/*
* 获取个人中心-会员特权详情页
*/
public
function
getPreferential
(
$channel
,
$uid
)
{
$result
=
array
();
if
(
USE_CACHE
)
{
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
CacheConfig
::
KEY_ACTION_HOME_PREFERENTIAL
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
//调取接口获得数据
$data
=
GradeData
::
getPreferentialData
(
$channel
,
$uid
);
if
(
isset
(
$data
[
'code'
])
&&
$data
[
'code'
]
==
200
)
{
$result
[
'vipGrade'
][
'privilege'
]
=
$data
[
'data'
];
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
CacheConfig
::
KEY_ACTION_HOME_GRADE
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_ACTION_HOME_PREFERENTIAL
,
$result
);
}
}
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Grade.php
0 → 100644
View file @
f7e81dd
<?php
use
Action\AbstractAction
;
/**
* 会员等级
*/
class
GradeController
extends
AbstractAction
{
/**
* 会员等级展示页
*/
public
function
indexAction
(){
//$data =
echo
"1"
;
//$data = '1';
//$this -> _view -> display('index',$data);
}
}
...
...
Please
register
or
login
to post a comment