Authored by hf

code review by hf: do format php codes

Showing 40 changed files with 211 additions and 188 deletions

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
=================
WAP清缓存专用链接
=================
友情提醒:
1. 该链接请不要向公司外部人员透露,注意保密!
2. 每次在使用以下链接时,请不要不停的刷新访问,最多只需要访问3次,缓存100%清除,如果发现页面还没有清除现象,可以联系技术 QQ: 692139929
3. 以下是目前提供的部分清缓存链接,不是所有页面都可以清除缓存!
#男首 (BOYS)
guang.m.yohobuy.com/guang/index/clear?type=boys&key=9646abcdef
#女首 (GIRLS)
guang.m.yohobuy.com/guang/index/clear?type=girls&key=9646abcdef
#潮童 (KIDS)
guang.m.yohobuy.com/guang/index/clear?type=kids&key=9646abcdef
#创意生活 (LIFE STYLE)
guang.m.yohobuy.com/guang/index/clear?type=lifestyle&key=9646abcdef
#新品到着 (NEW)
guang.m.yohobuy.com/guang/index/clear?type=new&key=9646abcdef
#折扣精选 (SALE)
guang.m.yohobuy.com/guang/index/clear?type=sale&key=9646abcdef
===================
PC清缓存专用链接
===================
http://new.yohobuy.com/cache/clear?key=Default_Kids_index&token=yoho9646abcdef
... ...
... ... @@ -24,7 +24,6 @@ class BoysController extends AbstractAction
// 设置COOKIE标识用户访问过该页面了
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
// 设置网站标题
$this->setTitle('男生首页');
// 显示侧边栏
... ...
... ... @@ -13,7 +13,7 @@ use Action\AbstractAction;
*/
class DownloadController extends AbstractAction
{
/**
* 下载APP
*/
... ... @@ -22,5 +22,5 @@ class DownloadController extends AbstractAction
// 跳转到老站s
// $this->go(OLD_MAIN . '/download/mkapp');
}
}
... ...
... ... @@ -16,10 +16,8 @@ class GirlsController extends AbstractAction
{
// 设置浏览器缓存5分钟
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS);
// 设置网站标题
$this->setTitle('女生首页');
// 显示侧边栏
... ...
... ... @@ -18,4 +18,4 @@ class HelpController extends AbstractAction
$this->_view->display('share-order');
}
}
\ No newline at end of file
}
... ...
... ... @@ -874,8 +874,7 @@ class HomeController extends AbstractAction
$order = WxPayApi::unifiedOrder($input);
$jsApiParameters = $tools->GetJsApiParameters($order);
$this->echoJson(array('code' => 200, 'data' => array('jsApiParameters' => json_decode($jsApiParameters) )) );
$this->echoJson(array('code' => 200, 'data' => array('jsApiParameters' => json_decode($jsApiParameters))));
} while (false);
}
... ...
... ... @@ -23,18 +23,18 @@ class IndexController extends AbstractAction
// 设置浏览器缓存5分钟
$this->setExpires(300);
}
$result = Index\HomeModel::getChannel();
$result['background'] = Index\HomeModel::getBgImage();
$result['channelPage'] = true;
$result['showDownloadApp'] = true;
$result['searchUrl'] = Helpers::url('', null, 'search');
$result['pageFooter'] = true;
// 渲染模板
$this->_view->display('index', $result);
}
/**
* 设置升级公告路由
*
... ... @@ -42,7 +42,7 @@ class IndexController extends AbstractAction
public function systemUpdateAction()
{
$this->setTitle('关于系统升级的公告');
$this->_view->display('systemUpdate');
}
... ...
... ... @@ -16,10 +16,8 @@ class KidsController extends AbstractAction
{
// 设置浏览器缓存5分钟
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_KIDS);
// 设置网站标题
$this->setTitle('潮童首页');
// 显示侧边栏
... ...
... ... @@ -16,10 +16,8 @@ class LifestyleController extends AbstractAction
{
// 设置浏览器缓存5分钟
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_LIFESTYLE);
// 设置网站标题
$this->setTitle('创意生活首页');
// 显示侧边栏
... ...
... ... @@ -101,9 +101,9 @@ class SearchController extends AbstractAction
// 跳转到品牌商品列表页
if ($domain !== null) {
$url = Helpers::url('', array(
'from' => 'search',
'query' => $query
), $domain);
'from' => 'search',
'query' => $query
), $domain);
$this->go($url);
}
}
... ... @@ -129,8 +129,7 @@ class SearchController extends AbstractAction
} while (false);
$classNames = array();
}
else {
} else {
$condition['query'] = '';
}
... ...
... ... @@ -61,8 +61,8 @@ class BrandModel
// 搜索链接地址
$result['searchUrl'] = Helpers::url('/brands/search', null);
// 资源位处理
$result['topData'] = FloorProcess::getContent(array('list' => $brand['brandTop']), $channel);
// 资源位处理
$result['topData'] = FloorProcess::getContent(array('list' => $brand['brandTop']), $channel);
/* 按字母'A-Z'分组的品牌列表 */
if (!empty($brand['brandList']['brands'])) {
... ... @@ -103,7 +103,7 @@ class BrandModel
// 是否显示app下载浮层标识
$result['showDownloadApp'] = true;
$result['pageFooter'] = true;
$brand = BrandData::getBrandsData($channel);
if (!empty($brand['data']['brands'])) {
$list = array();
... ...
... ... @@ -43,12 +43,12 @@ class ClassModel
break;
}
$genderArr = array('boy' => '1,3', 'girl' => '2,3', 'kids' => '1,2,3', 'lifestyle' => '1,2,3');
$genderArr = array('boy' => '1,3', 'girl' => '2,3', 'kids' => '1,2,3', 'lifestyle' => '1,2,3');
$oneClass = array();
$item = array();
foreach ($data['data'] as $k => $v) {
$oneClass = array('name' => ucfirst(rtrim($k, 's')), 'ca' => array());
foreach ($v as $val) {
$item = array();
$item['name'] = $val['category_name'];
... ... @@ -56,12 +56,12 @@ class ClassModel
// 首先添加一级分类
$item['sub'][] = array(
'name' => '全部'.$item['name'],
'name' => '全部' . $item['name'],
'id' => $item['id'],
'url' => Helpers::url('/', array(
'sort' => $item['id'],
'sort_name' => $item['name'],
'gender' => $genderArr[$k]), 'list')
'sort' => $item['id'],
'sort_name' => $item['name'],
'gender' => $genderArr[$k]), 'list')
);
$subitem = array();
... ... @@ -70,10 +70,10 @@ class ClassModel
$subitem['name'] = $value['category_name'];
$subitem['id'] = $value['relation_parameter']['sort'];
$subitem['url'] = Helpers::url('/', array(
'sort' => $value['relation_parameter']['sort'],
'sort_name' => $value['category_name'],
'gender' => $genderArr[$k]
), 'list');
'sort' => $value['relation_parameter']['sort'],
'sort_name' => $value['category_name'],
'gender' => $genderArr[$k]
), 'list');
$item['sub'][] = $subitem;
}
... ... @@ -118,8 +118,8 @@ class ClassModel
return $result;
}
}
$classes= ClassData::getClassesData();
$classes = ClassData::getClassesData();
if (!empty($classes['data'])) {
$id = 0;
foreach ($classes['data'] as $data) {
... ...
... ... @@ -179,8 +179,8 @@ class IndexModel
}
}
// 分页需要参数
$data['guang']['gender'] = $gender;
// 分页需要参数
$data['guang']['gender'] = $gender;
// 显示底部
$data['pageFooter'] = true;
... ... @@ -261,29 +261,29 @@ class IndexModel
private static function genIntro($id)
{
$result = '';
$data = DetailData::intro($id);
if (!empty($data)) {
foreach ($data as $value) {
// 文字
if (isset($value['text'])) {
$result .= trim( strip_tags( htmlspecialchars_decode($value['text']['data']['text']) ) ) . '<br/>';
$result .= trim(strip_tags(htmlspecialchars_decode($value['text']['data']['text']))) . '<br/>';
}
// 单张图
elseif (isset($value['singleImage'])) {
$result .= '<img src="' . Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640) . '"/><br/>';
}
}
// 多张小图
elseif (isset($value['smallPic']['data'])) {
foreach ($value['smallPic']['data'] as $small) {
$result .= '<img src="' . Helpers::getImageUrl($small['src'], 315, 420) . '"/>';
}
$result .= '<br/>';
$result .= '<br/>';
}
}
}
$data = array();
return $result;
}
... ...
... ... @@ -51,7 +51,7 @@ class PlusstarModel
}
$result = array();
$brandList = PlusstarData::firstBrandList($gender, $channel);
$brandList = PlusstarData::firstBrandList($gender, $channel);
if (!empty($brandList['recom']['data']['list'][0]['data'])) {
$result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true);
//$result['ps']['sName'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : '';
... ... @@ -107,7 +107,7 @@ class PlusstarModel
}
$result = array();
$brandList = PlusstarData::brandList($gender, $channel);
$brandList = PlusstarData::brandList($gender, $channel);
if (!empty($brandList['star']['data']['list'][0]['data'])) {
$result['ps']['star'] = self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false);
//$result['ps']['pName'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : '';
... ...
... ... @@ -16,7 +16,8 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public static function getGrade($channel, $uid) {
public static function getGrade($channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ... @@ -27,7 +28,7 @@ class GradeModel
return $result;
}
}
//调用接口获取数据
$data = GradeData::getGradeData($channel, $uid);
if (!empty($data['grade'])) {
... ... @@ -49,13 +50,13 @@ class GradeModel
//今年总消费
$result['vipGrade']['costOfThisYear'] = sprintf("%.2f", $data['grade']['current_year_cost']);
//升级下一等级会员的进度;
if($data['grade']['next_need_cost'] == 0){
if ($data['grade']['next_need_cost'] == 0) {
//当vip等级升至顶级时,进度条满格
$result['vipGrade']['percent'] = 100;
} else {
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
}
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = sprintf("%.2f", $data['grade']['upgrade_need_cost']);
... ... @@ -83,12 +84,13 @@ class GradeModel
return $result;
}
/*
* 获取个人中心-会员特权详情页
*/
public static function getPreferential($channel, $uid) {
public static function getPreferential($channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ... @@ -99,7 +101,7 @@ class GradeModel
return $result;
}
}
//调取接口获得数据
$data = GradeData::getPreferentialData($channel, $uid);
if (isset($data['code']) && $data['code'] == 200) {
... ...
... ... @@ -13,10 +13,11 @@ class HelpModel
/*
* 获取帮助中心列表
*/
public static function serviceInfo()
{
$iHelp = array();
$cateInfo = HelpData::serviceInfo();
if (!empty($cateInfo['data'])) {
foreach ($cateInfo['data'] as $key => $value) {
... ... @@ -25,7 +26,7 @@ class HelpModel
$iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']));
}
}
return $iHelp;
}
... ...
... ... @@ -39,7 +39,7 @@ class OnlineModel
if ($sub) {
foreach ($sub as $sk => $sv) {
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'].'_'.$sv['category_name']));
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'] . '_' . $sv['category_name']));
}
}
$question[$key]['list'] = $qTmp;
... ... @@ -71,14 +71,13 @@ class OnlineModel
}
$res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
if (isset($res['code']) && $res['code'] === 200) {
$questionInfo = $res['data'];
$questionInfo = $res['data'];
$list = array();
foreach ($questionInfo as $qk => $qv) {
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
!empty($list) && $result['list'] = $list;
!empty($list) && $result['list'] = $list;
}
return $result;
... ...
... ... @@ -110,8 +110,7 @@ class CartModel
/* 预售购物车 */
$result['presellGoodsCount'] = $advanceCount;
$result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
} while(false);
} while (false);
return $result;
}
... ... @@ -150,7 +149,7 @@ class CartModel
$result['code'] = $select['code'];
$result['message'] = $select['message'];
}
}while(0);
} while (0);
return $result;
}
... ... @@ -275,7 +274,7 @@ class CartModel
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
} while (0);
return $result;
}
... ... @@ -305,7 +304,7 @@ class CartModel
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}
}while(0);
} while (0);
return $result;
}
... ... @@ -322,7 +321,7 @@ class CartModel
{
$result = array();
$pay = CartData::cartPay($uid, $cartType);
$pay = CartData::cartPay($uid, $cartType);
// 商品为空返回
if (!$pay || empty($pay['data']['goods_list'])) {
... ... @@ -476,7 +475,6 @@ class CartModel
$result['needInvoice'] = $orderInfo['invoice'];
$result['invoiceText'] = $orderInfo['invoiceText'];
}
}
// 留言
... ... @@ -538,7 +536,7 @@ class CartModel
if ($coupon && isset($coupon['code'])) {
$result = $coupon;
}
}while(0);
} while (0);
return $result;
}
... ... @@ -573,7 +571,7 @@ class CartModel
$count = count($result);
$result = array('count' => $count);
}
}while(0);
} while (0);
return $result;
}
... ... @@ -618,7 +616,6 @@ class CartModel
return $result;
}
/**
* 处理购物车商品、加价购商品、赠品详情数据
*
... ... @@ -703,8 +700,8 @@ class CartModel
foreach ($sizeArr as $key => $value) {
$sizeStorageStr = '';
foreach ($colorStorageGroup as $colorArr) {
if (isset($colorArr[ $value['name'] ])) {
$sizeStorageStr .= $colorArr[ $value['name'] ] . '/';
if (isset($colorArr[$value['name']])) {
$sizeStorageStr .= $colorArr[$value['name']] . '/';
} else {
$sizeStorageStr .= '0/';
}
... ... @@ -795,12 +792,12 @@ class CartModel
// 结算数据
$result['formulaPrice'] = $data['shopping_cart_data']['promotion_formula'];
/*$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
$result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);*/
/* $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
$result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); */
$result['count'] = $data['shopping_cart_data']['selected_goods_count'];
$result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0);
$result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] > 0);
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);
}while(0);
} while (0);
return $result;
}
... ...
... ... @@ -374,7 +374,7 @@ class HomeModel
}
$result['channelList'][] = $build;
}
}
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ... @@ -386,7 +386,7 @@ class HomeModel
Cache::set($key, $result);
}
}
// 当接口和缓存都挂了时候,返回静态的数据
if (empty($result)) {
$result = array(
... ...
... ... @@ -37,7 +37,7 @@ class SideModel
}
// 调用接口获取后台配置的侧边栏数据
$side = SideData::leftNav();
$side = SideData::leftNav();
if (!empty($side['data'])) {
foreach ($side['data'] as $key => $value) {
// 逛的按照原来的做法,使用配置
... ... @@ -59,7 +59,7 @@ class SideModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result);
Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result);
}
}
... ... @@ -68,7 +68,7 @@ class SideModel
return $result;
}
/**
* 获取并生成左侧边栏中逛的数据
*
... ... @@ -79,11 +79,11 @@ class SideModel
{
// 判断逛的背景色
$color = false;
if($guangChoosed === 'girls') {
if ($guangChoosed === 'girls') {
$color = '#FF88AE';
} else if($guangChoosed === 'kids') {
} else if ($guangChoosed === 'kids') {
$color = '#7ad9f9';
} else if($guangChoosed === 'lifestyle') {
} else if ($guangChoosed === 'lifestyle') {
$color = '#4f4138';
}
... ...
... ... @@ -386,24 +386,24 @@ class UserModel
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
// 处理YOHO币数据
if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){
if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) {
$coinList = $yohoCoin['data']['coinlist'];
// 获取有货币总数
$total = self::getYohoCoinData($uid);
$data['money'] = !empty($total) ? $total['yohoCoin']['coinNum'] : 0;
foreach($coinList as $key => $val){
foreach ($coinList as $key => $val) {
$result[$key]['title'] = $val['message'];
$result[$key]['time'] = $val['date'];
if($val['num'] > 0){
$val['num'] = '+'.$val['num'];
if ($val['num'] > 0) {
$val['num'] = '+' . $val['num'];
}
$result[$key]['count'] = $val['num'];
}
}
$data['list'] = $result;
return $data;
}
... ... @@ -811,11 +811,11 @@ class UserModel
public static function getHelpDetailData($code)
{
$result = array();
if (isset($code)) {
$result = UserData::helpDetailData($code);
}
return $result;
}
... ...
... ... @@ -113,7 +113,7 @@ class DetailModel
if (empty($productId)) {
$productId = isset($baseInfo['id']) ? $baseInfo['id'] : 0;
}
$result['feedbacks'] = array();
// 商品咨询
... ... @@ -227,8 +227,8 @@ class DetailModel
foreach ($sizeArr as $key => $value) {
$sizeStorageStr = '';
foreach ($colorStorageGroup as $colorArr) {
if (isset($colorArr[ $value['name'] ])) {
$sizeStorageStr .= $colorArr[ $value['name'] ] . '/';
if (isset($colorArr[$value['name']])) {
$sizeStorageStr .= $colorArr[$value['name']] . '/';
} else {
$sizeStorageStr .= '0/';
}
... ...
... ... @@ -20,6 +20,7 @@ use Plugin\Cache;
*/
class ListModel
{
/**
* 获取品类商品列表数据
*
... ... @@ -167,7 +168,9 @@ class ListModel
}
// 调用接口查询数据
$brandLogo = BrandData::getBrandLogo($id); var_dump($brandLogo); exit;
$brandLogo = BrandData::getBrandLogo($id);
var_dump($brandLogo);
exit;
// 处理返回的数据
if (isset($brandLogo['data'][0])) {
$result = array(
... ... @@ -191,8 +194,8 @@ class ListModel
return $result;
}
/**
/**
* 根据品牌ID获取品牌LOGO
*
* @param int $id 品牌ID
... ... @@ -217,7 +220,7 @@ class ListModel
// 处理返回的数据
if (isset($brandLogo['data'])) {
$result = array(
'id' => $brandLogo['data']['id'],
'id' => $brandLogo['data']['id'],
'url' => Helpers::url('', null, $brandLogo['data']['brand_domain']),
'thumb' => Helpers::getImageUrl($brandLogo['data']['brand_ico'], 75, 40),
'name' => $brandLogo['data']['brand_name'],
... ...
... ... @@ -184,7 +184,7 @@ class NewsaleModel
// 调用接口获取数据并封装
if (isset($newsale['code']) && !empty($newsale['data'])) {
if(count($newsale['data'][0]['data']) === 1) {
if (count($newsale['data'][0]['data']) === 1) {
$result = Helpers::formatBanner($newsale['data'][0]['data'][0], 640, 240);
} else {
foreach ($newsale['data'][0]['data'] as $one) {
... ...
... ... @@ -17,6 +17,7 @@ use Plugin\UnionTrans;
*/
class IndexController extends AbstractAction
{
/**
* 通过当前用户审判是否跳到登录
*
... ... @@ -34,6 +35,7 @@ class IndexController extends AbstractAction
/*
* 购物车首页
*/
public function indexAction()
{
$this->setTitle('购物车');
... ... @@ -55,6 +57,7 @@ class IndexController extends AbstractAction
/*
* 异步获取购物车数据
*/
public function getCartDataAction()
{
$result = array();
... ... @@ -143,6 +146,7 @@ class IndexController extends AbstractAction
/*
* 赠品页面
*/
public function giftAction()
{
$this->setTitle('赠品');
... ... @@ -161,6 +165,7 @@ class IndexController extends AbstractAction
/*
* 加价购页面
*/
public function advanceBuyAction()
{
$this->setTitle('加价购');
... ... @@ -179,6 +184,7 @@ class IndexController extends AbstractAction
/*
* 获取购物车商品数据
*/
public function goodinfoAction()
{
$result = array();
... ... @@ -234,7 +240,7 @@ class IndexController extends AbstractAction
$shoppingKey = $this->getSession('shoppingKey');
$uid = $this->getUid(true);
$sku= $this->post('sku', 0);
$sku = $this->post('sku', 0);
$increaseNum = $this->post('increaseNum', null);
$decreaseNum = $this->post('decreaseNum', null);
$result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
... ... @@ -255,10 +261,10 @@ class IndexController extends AbstractAction
$uid = $this->getUid(true);
$params = array();
$params['old_product_sku']= $this->post('old_product_sku', 0);
$params['new_product_sku']= $this->post('new_product_sku', 0);
$params['buy_number']= $this->post('buy_number', 0);
$params['selected']= $this->post('selected', null);
$params['old_product_sku'] = $this->post('old_product_sku', 0);
$params['new_product_sku'] = $this->post('new_product_sku', 0);
$params['buy_number'] = $this->post('buy_number', 0);
$params['selected'] = $this->post('selected', null);
$result = CartModel::modifyCartProduct($uid, $params, $shoppingKey);
}
... ... @@ -275,7 +281,6 @@ class IndexController extends AbstractAction
$this->setTitle('确认订单');
$this->setNavHeader('确认订单', Helpers::url('/cart/index/index'), false); // 不显示右上角home按钮
// 购物车商品为空跳转到购物车页面
$cartType = $this->get('cartType', '');
$cookieData = $this->getCookie('order-info', null);
... ... @@ -424,9 +429,9 @@ class IndexController extends AbstractAction
} else {
// 提交成功清除Cookie
$this->setCookie('order-info', null);
$this->echoJson($result);
if ($uid && !empty($result['data'])) {
try {
UnionTrans::set($uid, $result['data']['order_code'], $result['data']['order_amount']);
... ...
<?php
use Action\AbstractAction;
use Category\ClassModel;
use Plugin\Helpers;
... ... @@ -8,15 +9,16 @@ use Plugin\Helpers;
*/
class ClassController extends AbstractAction
{
public function indexAction()
{
$channel = Helpers::getChannelByCookie();
$classes = ClassModel::getClassData();
$classes = ClassModel::getClassData();
// 根据频道设置默认的焦点
if (!empty($classes)) {
$classes[$channel - 1]['focus'] = true;
}
$this->setTitle('商品分类');
$this->setNavHeader('商品分类');
... ... @@ -28,7 +30,8 @@ class ClassController extends AbstractAction
'searchUrl' => Helpers::url('/search', null, 'search'),
)
);
$this->_view->display('index', $data);
}
}
\ No newline at end of file
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Category\FocusData;
... ... @@ -7,22 +8,24 @@ use LibModels\Wap\Category\FocusData;
*/
class FocusController extends AbstractAction
{
public function indexAction()
{
// 获取关注数据
$gender = $this->get('gender', '1,3');
$focusData = FocusData::getFocusData(0, $gender);
// 获取关注数据
$gender = $this->get('gender', '1,3');
$focusData = FocusData::getFocusData(0, $gender);
$focus = array();
if($focusData['code'] == 200)
{
$focus = $focusData['data'];
}
$focus = array();
if ($focusData['code'] == 200) {
$focus = $focusData['data'];
}
echo '<pre>';
var_dump($focus);exit;
echo '<pre>';
var_dump($focus);
exit;
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('class', compact('focus'));
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('class', compact('focus'));
}
}
\ No newline at end of file
}
... ...
... ... @@ -257,7 +257,6 @@ class IndexController extends AbstractAction
$build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid);
}
$data['infos'] = $build;
} while (false);
if (isset($data)) {
... ... @@ -266,7 +265,7 @@ class IndexController extends AbstractAction
echo ' ';
}
}
/**
* @todo 清缓存
*/
... ... @@ -276,7 +275,7 @@ class IndexController extends AbstractAction
if ($key !== '9646abcdef') {
exit();
}
$type = $this->get('type');
switch (strval($type)) {
case 'boys':
... ...
... ... @@ -187,7 +187,7 @@ class InfoController extends AbstractAction
// 标识有微信分享
$data['hasWxShare'] = true;
$this->_view->display('index', $data);
$detail = array();
... ...
... ... @@ -38,7 +38,6 @@ class OptController extends AbstractAction
$opt = $this->post('opt', 'ok');
$udid = $this->getUdid();
$result = OptData::praiseArticle($udid, $id, $opt);
} while (false);
$this->echoJson($result);
... ... @@ -72,7 +71,7 @@ class OptController extends AbstractAction
if (empty($uid) || !is_numeric($uid)) {
break;
}
/* 执行点赞或取消操作 */
$opt = $this->post('opt', 'ok');
$data = OptData::collectArticle($uid, $id, $opt);
... ... @@ -80,9 +79,8 @@ class OptController extends AbstractAction
$result = array('code' => 400, 'message' => '操作失败', 'data' => '');
break;
}
$result = array('code' => 200, 'message' => '成功', 'data' => '');
} while (false);
$this->echoJson($result);
... ... @@ -113,7 +111,7 @@ class OptController extends AbstractAction
}
/* 检查用户是否登录 */
$uid = $this->getUid();
$uid = $this->getUid();
if (!$uid) {
$uid = $this->getSession('uid');
}
... ... @@ -130,7 +128,6 @@ class OptController extends AbstractAction
/* 收藏 */
$result = BrandData::favorite($id, $uid);
} while (false);
$this->echoJson($result);
... ...
... ... @@ -132,7 +132,7 @@ class PlusstarController extends AbstractAction
$data['psDetail'] = true;
$data['ps']['id'] = $brandId;
$data['ps']['banner'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['cover_img'], 640, 309);
$data['ps']['logo'] = Images::getSourceUrl($brandInfo['getBrandInfo']['data']['brand_ico'],'brandLogo');
$data['ps']['logo'] = Images::getSourceUrl($brandInfo['getBrandInfo']['data']['brand_ico'], 'brandLogo');
$data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name'];
$data['ps']['isLike'] = $brandInfo['getUidBrandFav'];
$data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? false : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array('&nbsp;' => ' '));
... ... @@ -147,7 +147,7 @@ class PlusstarController extends AbstractAction
if ($isApp) {
$url = $defaultUrl;
$url .= '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
. $id . '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' . $brandId . '"}},"priority":"Y"}}';
. $id . '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' . $brandId . '"}},"priority":"Y"}}';
} else {
$url = Helpers::url('/signin.html', array('refer' => $defaultUrl));
}
... ... @@ -161,7 +161,7 @@ class PlusstarController extends AbstractAction
foreach ($brandInfo['getArticleByBrand'] as $value) {
$data['ps']['infos'][] = Helpers::formatArticle($value, false, $isApp, false, $uid);
}
//jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
if ($isApp && !$this->getSession('uid')) {
$data['ps']['jumpToApp'] = 1;
... ... @@ -182,9 +182,8 @@ class PlusstarController extends AbstractAction
$this->setTitle($data['shareTitle'], false, '');
$this->setDescription($data['shareDesc']);
$brandInfo = array();
} while (false);
if (array() === $data) {
... ...
... ... @@ -54,7 +54,7 @@ RSS;
'<source>有货</source>',
'</item>', "\n";
}
echo "</channel>\n</rss>";
}
... ...
... ... @@ -52,7 +52,7 @@ class BackController extends AbstractAction
$result = BackData::sendCodeToEmail($email);
if ($result['code'] === 200) {
$result['data'] = Helpers::url('/passport/back/resendemail', array(
'email' => $email,
'email' => $email,
));
}
} while (false);
... ... @@ -127,7 +127,7 @@ class BackController extends AbstractAction
$data = BackData::modifyPasswordByEmail($pwd, $code);
$result = array('code' => 200, 'data' => Helpers::url('/signin.html') );
$result = array('code' => 200, 'data' => Helpers::url('/signin.html'));
if (strpos($data, 'history.back') !== false) {
$result['code'] = 400;
$result['message'] = '修改失败';
... ... @@ -182,8 +182,8 @@ class BackController extends AbstractAction
if ($result['code'] === 200) {
$result['data'] = Helpers::url('/passport/back/mobilecode', array(
'phoneNum' => $phoneNum,
'areaCode' => $areaCode,
'phoneNum' => $phoneNum,
'areaCode' => $areaCode,
));
}
} while (false);
... ... @@ -229,9 +229,9 @@ class BackController extends AbstractAction
$result = BackData::validateMobileCode($phoneNum, $code, $areaCode);
if ($result['code'] === 200) {
$result['data'] = Helpers::url('/passport/back/backcode', array(
'phoneNum' => $phoneNum,
'token' => $result['data']['token'],
'areaCode' => $areaCode,
'phoneNum' => $phoneNum,
'token' => $result['data']['token'],
'areaCode' => $areaCode,
));
}
... ...
... ... @@ -49,7 +49,7 @@ class BindController extends AbstractAction
public function codeAction()
{
$this->setTitle('验证手机');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickname = $this->get('nickname');
... ... @@ -129,19 +129,18 @@ class BindController extends AbstractAction
if (!isset($res['code'])) {
break;
}
if ($res['code'] == 200) {
$next = Helpers::url('/passport/bind/code', array(
'isReg' => $res['data']['is_register'],
'openId' => $openId,
'sourceType' => $sourceType,
'areaCode' => $areaCode,
'phoneNum' => $phoneNum,
'nickname' => $nickname,
'isReg' => $res['data']['is_register'],
'openId' => $openId,
'sourceType' => $sourceType,
'areaCode' => $areaCode,
'phoneNum' => $phoneNum,
'nickname' => $nickname,
));
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
}
else {
} else {
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
}
} while (false);
... ... @@ -226,13 +225,13 @@ class BindController extends AbstractAction
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
// $nickname = $this->post('nickname');//nickname不同步信息
$password = !empty($this->post('password'))?$this->post('password'):'';
$password = !empty($this->post('password')) ? $this->post('password') : '';
if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) {
break;
}
$res = BindData::bindMobile($openId,$sourceType, $phoneNum, $areaCode, $password);
$res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password);
if (!isset($res['code'])) {
break;
}
... ... @@ -241,8 +240,7 @@ class BindController extends AbstractAction
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
} else {
$refer = rawurldecode($refer);
}
... ... @@ -252,8 +250,7 @@ class BindController extends AbstractAction
$this->setSession('_TOKEN', $token);
$refer = Helpers::syncUserSession($res['data']['uid'], $refer);
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
}
else {
} else {
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
}
} while (false);
... ...
... ... @@ -227,7 +227,7 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ...
... ... @@ -81,8 +81,7 @@ class RegController extends AbstractAction
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)
|| !Helpers::verifyToken($mobile, $token)) {
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !Helpers::verifyToken($mobile, $token)) {
$this->error();
}
... ... @@ -126,7 +125,7 @@ class RegController extends AbstractAction
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
break;
}
... ... @@ -273,7 +272,7 @@ class RegController extends AbstractAction
}
$data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$data['data']['href'] = $refer;
$token = Helpers::makeToken($data['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
... ...
... ... @@ -27,7 +27,7 @@ class DetailController extends AbstractAction
$this->error();
}
$uid = $this->getUid();
$vipLevel = 0;
if (isset($this->_vip)) {
$vipLevel = Helpers::getVipLevel($this->_vip);
... ... @@ -47,7 +47,7 @@ class DetailController extends AbstractAction
// 渲染模板
$this->_view->display('index', $data);
}
/**
* 商品详情 (SKN)
*
... ... @@ -60,7 +60,7 @@ class DetailController extends AbstractAction
$this->error();
}
$uid = $this->getUid();
$vipLevel = 0;
if (isset($this->_vip)) {
$vipLevel = Helpers::getVipLevel($this->_vip);
... ... @@ -172,10 +172,10 @@ class DetailController extends AbstractAction
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/'))));
}
$this->setTitle('我要咨询');
$this->setNavHeader('我要咨询');
$productId = $this->get('product_id', 0);
// 渲染模板
... ... @@ -185,7 +185,7 @@ class DetailController extends AbstractAction
'formUrl' => Helpers::url('/product/detail/consultsubmit'),
));
}
/**
* 添加咨询操作
*
... ... @@ -196,14 +196,14 @@ class DetailController extends AbstractAction
public function consultsubmitAction()
{
$result = array('code' => 400, 'message' => '请输入咨询内容', 'data' => '');
if ($this->isAjax()) {
$uid = $this->getUid();
$productId = $this->post('product_id', 0);
$content = $this->post('content');
$result = DetailData::addConsult($uid, $productId, $content);
}
$this->echoJson($result);
}
... ...
... ... @@ -5,15 +5,18 @@ use Action\AbstractAction;
/**
* 会员等级
*/
class GradeController extends AbstractAction{
/**
* 会员等级展示页
*/
public function indexAction(){
class GradeController extends AbstractAction
{
/**
* 会员等级展示页
*/
public function indexAction()
{
//$data =
echo "1";
//$data = '1';
//$this -> _view -> display('index',$data);
}
}
... ...
... ... @@ -110,7 +110,7 @@ class NewsaleController extends AbstractAction
// 获取性别
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$channel = Helpers::getChannelByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
... ... @@ -150,7 +150,7 @@ class NewsaleController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::selectData($data);
}
... ... @@ -189,7 +189,7 @@ class NewsaleController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
... ...