Authored by hf

do debug call product detail page api

... ... @@ -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'; // 地址树数据
}
... ...
... ... @@ -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();
... ...
... ... @@ -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);
... ...
... ... @@ -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;
}
... ...
... ... @@ -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');
... ...