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
hf
9 years ago
Commit
0b671883077b9596f7a701844f7b6d57a63d29b1
2 parents
d95bc13e
0a43c6a6
do debug call product detail page api
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
11 deletions
library/Configs/CacheConfig.php
library/LibModels/Wap/Home/UserData.php
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
library/Configs/CacheConfig.php
View file @
0b67188
...
...
@@ -45,4 +45,6 @@ class CacheConfig
const
KEY_ACTION_GUANG_DETAIL_DATA
=
'key_action_guang_detail_data'
;
// 逛内容详情
const
KEY_ACTION_GUANG_RSS_DATA
=
'key_action_guang_detail_data'
;
// 逛订阅内容
const
KEY_ACTION_ADDRESS_LIST_DATA
=
'key_action_address_list_data'
;
// 地址树数据
}
...
...
library/LibModels/Wap/Home/UserData.php
View file @
0b67188
...
...
@@ -171,12 +171,11 @@ class UserData
* 优惠券数据
*
* @param int $uid 用户ID
* @param int $status 优惠券状态,0表示未使用,1表示已使用
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @return array 优惠券接口返回的数据
*/
public
static
function
couponData
(
$uid
,
$
status
,
$
page
=
1
,
$limit
=
10
)
public
static
function
couponData
(
$uid
,
$page
=
1
,
$limit
=
10
)
{
$urlList
=
array
();
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
0b67188
...
...
@@ -149,13 +149,12 @@ class HomeController extends AbstractAction
*/
public
function
couponsAction
()
{
$this
->
setTitle
(
'优惠券'
);
$this
->
setNavHeader
(
'优惠券'
);
$uid
=
$this
->
getUid
();
$status
=
$this
->
get
(
'status'
,
0
);
$coupons
=
array
(
'couponsUrl'
=>
\Index\UserModel
::
getCouponData
(
$uid
,
$status
),
'couponsUrl'
=>
\Index\UserModel
::
getCouponData
(
$uid
),
'couponsPage'
=>
true
);
$this
->
_view
->
display
(
'coupons'
,
$coupons
);
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
0b67188
...
...
@@ -258,12 +258,12 @@ class UserModel
* @param int $uid 用户ID
* @return array|mixed 处理之后的优惠券数据
*/
public
static
function
getCouponData
(
$uid
,
$status
)
public
static
function
getCouponData
(
$uid
)
{
$result
=
array
();
// 调用接口获取优惠券数据
$coupons
=
UserData
::
couponData
(
$uid
,
$status
);
$coupons
=
UserData
::
couponData
(
$uid
);
// 处理优惠券数据
if
(
!
empty
(
$coupons
[
'unused'
]))
{
...
...
@@ -307,6 +307,15 @@ class UserModel
{
$result
=
array
();
if
(
USE_CACHE
)
{
$key
=
CacheConfig
::
KEY_ACTION_ADDRESS_LIST_DATA
;
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
$key
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
// 调用接口获取地址列表数据
$address
=
UserData
::
addressListData
(
$uid
);
...
...
@@ -315,6 +324,17 @@ class UserModel
$result
=
$address
[
'data'
];
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
}
return
$result
;
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
0b67188
...
...
@@ -186,15 +186,13 @@ class LoginController extends AbstractAction
$userInfo
=
$alipay
->
getUserInfo
(
$access
);
if
(
$userInfo
&&
$userInfo
[
'is_success'
]
===
'T'
&&
isset
(
$userInfo
[
'response'
][
'user_info'
][
'user_name'
]))
{
$nickname
=
$userInfo
[
'response'
][
'user_info'
][
'user_name'
];
$alipayEmail
=
$userInfo
[
'response'
][
'user_info'
][
'email'
];
//
$alipayEmail = $userInfo['response']['user_info']['email'];
}
var_dump
(
$userInfo
);
}
else
{
$nickname
=
$_GET
[
'real_name'
];
$alipayEmail
=
isset
(
$_GET
[
'email'
])
?
$_GET
[
'email'
]
:
''
;
//
$alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
}
var_dump
(
$access
);
$result
=
LoginData
::
signinByOpenID
(
$nickname
,
$access
[
'user_id'
],
'qq'
);
...
...
Please
register
or
login
to post a comment