Authored by hf

do add guang search api docs


guang.m.yohobuy.com/guang/index/clear?type=boys
guang.m.yohobuy.com/guang/index/clear?type=girls
guang.m.yohobuy.com/guang/index/clear?type=kids
guang.m.yohobuy.com/guang/index/clear?type=lifestyle
http://new.yohobuy.com/cache/clear?key=Default_Kids_index&token=yoho9646abcdef
http://new.yohobuy.com/cache/clear?key=Default_Lifestyle_index&token=yoho9646abcdef
http://new.yohobuy.com/cache/clear?key=Default_Woman_index&token=yoho9646abcdef
##http://new.yohobuy.com/cache/clear?key=Default_Default_index&token=yoho9646abcdef
其中token就按照上述中去填写,key代表具体要清的缓存的键
具体key的对应关系如下:
key 说明
Default_Kids_index 潮童页面缓存
Default_Lifestyle_index 创意生活页面缓存
Default_Woman_index 女生页面缓存
Default_Default_index 男生
\ No newline at end of file
... ...
No preview for this file type
No preview for this file type
... ... @@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract
* 获取Session
*
* @param string $name 名称
* @return mixed
*/
public function getSession($name)
{
... ... @@ -270,12 +271,18 @@ class AbstractAction extends Controller_Abstract
/**
* 获取当前登录的用户ID
*
* @param bool $useSession 是否使用Session会话
* @return int
* @todo
*/
protected function getUid()
protected function getUid($useSession = false)
{
if (!$this->_uid) {
// 从SESSION获取
if ($useSession) {
$this->_uid = $this->getSession('_UID');
}
// 从COOKIE获取
else {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
... ... @@ -285,6 +292,7 @@ class AbstractAction extends Controller_Abstract
}
}
}
}
return $this->_uid;
}
... ...
<?php
use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
use LibModels\Wap\Home\OrderData;
... ... @@ -13,18 +11,33 @@ use LibModels\Wap\Home\OrderData;
* @package
* @copyright yoho.inc
* @version 1.0 (2015-10-28 16:28:32)
* @author fei.hong <fei.hong@yoho.cn>
*/
class HomeController extends AbstractAction
{
protected $_uid;
// /**
// * 初始化
// */
// public function init()
// {
// // 检查用户是否登录, 未登录则跳转到登录页
// $uid = $this->getUid(true);
// if (!$uid) {
// $this->go(Helpers::url('/signin.html'));
// }
//
// parent::init();
// }
/**
* 个人中心入口
*/
public function indexAction() {
public function indexAction()
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心', true, SITE_MAIN);
$this->setNavHeader('个人中心');
// $uid = $this->getUid();
$uid = 8826435;
... ... @@ -45,7 +58,8 @@ class HomeController extends AbstractAction
/**
* 用户收藏的商品
*/
public function favoriteAction() {
public function favoriteAction()
{
$uid = $this->getUid();
$favProducts = \Index\UserModel::getFavProductData($uid);
... ... @@ -160,7 +174,8 @@ class HomeController extends AbstractAction
/**
* 用户收藏的品牌
*/
public function favoritebrandAction() {
public function favoritebrandAction()
{
$uid = $this->getUid();
$gender = Helpers::getGenderByCookie();
... ... @@ -170,11 +185,12 @@ class HomeController extends AbstractAction
}
/**
* 个人信息
* 我的个人信息
*/
public function personalDetailsAction() {
public function mydetailsAction()
{
$this->setTitle('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
$this->setNavHeader('个人信息');
// $uid = $this->getUid();
$uid = 967016;
... ... @@ -186,9 +202,10 @@ class HomeController extends AbstractAction
/**
* YOHO币
*/
public function currencyAction() {
public function currencyAction()
{
$this->setTitle('YOHO币');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$this->setNavHeader('优惠券');
$uid = 967016;
$currency = \Index\UserModel::getYohoCoinData($uid);
... ... @@ -200,10 +217,11 @@ class HomeController extends AbstractAction
/**
* 优惠券
*/
public function couponsAction() {
public function couponsAction()
{
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$this->setNavHeader('优惠券');
// $uid = $this->getUid();
$uid = 8826435;
$status = $this->get('status', 0);
... ... @@ -219,7 +237,8 @@ class HomeController extends AbstractAction
/**
* 我的消息
*/
public function messageAction() {
public function messageAction()
{
// $uid = $this->getUid();
$page = $this->get('page', 0);
$size = $this->get('size', 10);
... ... @@ -233,10 +252,11 @@ class HomeController extends AbstractAction
/**
* 地址管理
*/
public function addressAction() {
public function addressAction()
{
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理', true, SITE_MAIN);
$this->setNavHeader('地址管理');
// $uid = $this->getUid();
$uid = 967016;
... ... @@ -257,7 +277,8 @@ class HomeController extends AbstractAction
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction() {
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
... ... @@ -284,7 +305,8 @@ class HomeController extends AbstractAction
/**
* 设置默认地址
*/
public function defaultAddressAction() {
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
... ... @@ -303,12 +325,13 @@ class HomeController extends AbstractAction
}
//在线客服
public function onlineServiceAction() {
public function onlineServiceAction()
{
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
$this->setNavHeader('在线客服');
$service = home\OnlineModel::getOnlineServiceInfo();
$service = \Home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online_service', array(
'onlineServicePage' => true,
... ... @@ -318,12 +341,13 @@ class HomeController extends AbstractAction
}
//在线客服-具体详情
public function onlineServiceDetailAction() {
public function onlineServiceDetailAction()
{
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
$service = \Home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
... ... @@ -333,17 +357,19 @@ class HomeController extends AbstractAction
/**
* 我的逛
*/
public function myGuangAction() {
public function myGuangAction()
{
echo 'My Guang';
}
/**
* 意见反馈
*/
public function suggestAction() {
public function suggestAction()
{
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
$this->setNavHeader('意见反馈');
$udid = $this->getUdid();
$page = $this->get('page', 1);
... ... @@ -382,7 +408,8 @@ class HomeController extends AbstractAction
/**
* 意见反馈-提交表单
*/
public function suggest_subAction() {
public function suggest_subAction()
{
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
... ... @@ -405,7 +432,8 @@ class HomeController extends AbstractAction
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction() {
public function savesuggestAction()
{
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
... ... @@ -419,7 +447,8 @@ class HomeController extends AbstractAction
/**
* 会员等级展示页
*/
public function gradeAction() {
public function gradeAction()
{
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
... ... @@ -438,7 +467,8 @@ class HomeController extends AbstractAction
* 会员特权查看页
*/
public function preferentialAction() {
public function preferentialAction()
{
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
... ... @@ -446,7 +476,7 @@ class HomeController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid();
$data = GradeModel::getPreferential($channel, $uid);
$data = \Home\GradeModel::getPreferential($channel, $uid);
$data['pageFooter'] = true;
$this->_view->display('privilege', $data);
}
... ... @@ -455,7 +485,8 @@ class HomeController extends AbstractAction
* 我的订单页面
*/
public function orderAction() {
public function orderAction()
{
//获得type值
$type = $this->get('type', 1);
$this->setTitle('我的订单');
... ... @@ -475,7 +506,8 @@ class HomeController extends AbstractAction
}
//ajax请求订单页面
public function getOrderAction() {
public function getOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -505,7 +537,8 @@ class HomeController extends AbstractAction
* 我的订单-取消订单
*/
public function cancelOrderAction() {
public function cancelOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
... ... @@ -528,7 +561,8 @@ class HomeController extends AbstractAction
* 我的订单-删除订单
*/
public function deleteOrderAction() {
public function deleteOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -549,7 +583,8 @@ class HomeController extends AbstractAction
/**
* 订单详情页
*/
public function orderDetailAction() {
public function orderDetailAction()
{
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
... ...
<?php
namespace home;
namespace Home;
use LibModels\Wap\Home\GradeData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
... ... @@ -15,7 +14,8 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public static function getGrade($gender, $channel, $uid) {
public static function getGrade($gender, $channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ... @@ -82,7 +82,8 @@ class GradeModel
* 获取个人中心-会员特权详情页
*/
public function getPreferential($channel, $uid) {
public function getPreferential($channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ...
<?php
namespace home;
namespace Home;
use LibModels\Wap\Home\OnlineData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
... ... @@ -20,13 +19,10 @@ class OnlineModel
$cateInfo = $res['data'];
$question = array();
$tab = array();
if ($cateInfo)
{
foreach ($cateInfo as $key => $value)
{
if ($cateInfo) {
foreach ($cateInfo as $key => $value) {
//强制截成3个tab
if ($key > 2)
{
if ($key > 2) {
break;
}
$tab[$key]['tabid'] = 'tab' . $value['id'];
... ... @@ -37,12 +33,10 @@ class OnlineModel
$question[$key]['current'] = (!$key) ? TRUE : FALSE;
$sub = $value['sub'];
$qTmp = array();
if ($sub)
{
foreach ($sub as $sk => $sv)
{
if ($sub) {
foreach ($sub as $sk => $sv) {
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'] . '&cateName=' . $sv['category_name'];
}
}
$question[$key]['list'] = $qTmp;
... ... @@ -64,19 +58,15 @@ class OnlineModel
public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone')
{
$result = array();
if (!$cateId)
{
if (!$cateId) {
return $result;
}
$res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
$questionInfo = $res['data'];
if ($questionInfo)
{
if ($questionInfo) {
$list = array();
if ($questionInfo)
{
foreach ($questionInfo as $qk => $qv)
{
if ($questionInfo) {
foreach ($questionInfo as $qk => $qv) {
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
... ...