Authored by hf

do debug call product detail page api

... ... @@ -29,7 +29,7 @@ class DetailData
*/
public static function baseInfo($productId, $uid)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => $productId, 'userId' => $uid) );
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => intval($productId), 'userId' => intval($uid)) );
}
/**
... ... @@ -40,7 +40,7 @@ class DetailData
*/
public static function sizeInfo($productSkn)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => $productSkn) );
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn) ) );
}
}
... ...
... ... @@ -87,8 +87,6 @@
<div class="gap-block"></div>
{{> product/product_description}}
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag">{{numInCart}}</span>
... ...
{{> product/product_description}}
\ No newline at end of file
... ...
... ... @@ -20,20 +20,20 @@ class HomeController extends AbstractAction
protected $_uid;
// /**
// * 初始化
// */
// public function init()
// {
// // 检查用户是否登录, 未登录则跳转到登录页
// $uid = $this->getUid(true);
// $action = $this->getRequest()->getActionName();
// if (!$uid && $action !== 'index') {
// $this->go(Helpers::url('/signin.html'));
// }
//
// parent::init();
// }
/**
* 初始化
*/
public function init()
{
// 检查用户是否登录, 未登录则跳转到登录页
$uid = 8826435; //$this->getUid(true);
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
$this->go(Helpers::url('/signin.html'));
}
parent::init();
}
/**
* 个人中心入口
... ... @@ -51,7 +51,6 @@ class HomeController extends AbstractAction
$uid = $this->getUid();
if ($uid) {
$data['isLogin'] = true;
$uid = 8826435;
$data += \Index\UserModel::getUserProfileData($uid);
$data += \Index\UserModel::getInfoNumData($uid);
... ... @@ -74,7 +73,6 @@ class HomeController extends AbstractAction
$tab = $this->get('tab', '');
$uid = $this->getUid();
$uid = 8826435;
$gender = Helpers::getGenderByCookie();
$favProducts = \Index\UserModel::getFavProductData($uid);
... ... @@ -102,20 +100,16 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
if ($this->isAjax()) {
$uid = $this->getUid();
$fav_id = $this->post('fav_id', 0);
$result = \Index\UserModel::favoriteDelete($uid, $fav_id);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -128,8 +122,7 @@ class HomeController extends AbstractAction
$this->setTitle('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = $this->getUid();
$data = \Index\UserModel::getUserProfileData($uid);
$data['personalDetailsPage'] = true;
$data['pageFooter'] = true;
... ... @@ -144,8 +137,7 @@ class HomeController extends AbstractAction
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
// $uid = $this->getUid();
$uid = 8826435;
$uid = $this->getUid();
$currency = \Index\UserModel::getYohoCoinData($uid);
$currency['pageFooter'] = true;
... ... @@ -159,9 +151,8 @@ class HomeController extends AbstractAction
{
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$this->setNavHeader('优惠券');
$uid = $this->getUid();
$status = $this->get('status', 0);
$coupons = array(
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
... ... @@ -175,11 +166,10 @@ class HomeController extends AbstractAction
*/
public function messageAction()
{
// $uid = $this->getUid();
$uid = $this->getUid();
$page = $this->get('page', 0);
$size = $this->get('size', 10);
$uid = 8826435;
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
print_r($messages);
... ... @@ -192,16 +182,12 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$this->setNavHeader('地址管理');
$uid = $this->getUid();
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($addressList);
$this->_view->display('address', array(
'addressPage' => true,
'pageFooter' => true,
... ... @@ -217,10 +203,8 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
... ... @@ -232,12 +216,9 @@ class HomeController extends AbstractAction
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -249,21 +230,15 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -275,21 +250,16 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$id = $this->post('id', '');
$result = \Index\UserModel::deleteAddress($uid, $id);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -316,8 +286,7 @@ class HomeController extends AbstractAction
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0)
{
if ($cateId > 0) {
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
... ... @@ -333,25 +302,19 @@ class HomeController extends AbstractAction
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
$uid=5687179;
$gender = Helpers::getGenderByCookie();
$yh_channel = Helpers::getChannelByCookie();
$guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit);
$totalPage = $guangInfo['totalPage'];
unset($guangInfo['totalPage']);
if ($page == 1)
{
if ($page == 1) {
$this->setTitle('我收藏的');
$this->setNavHeader('我收藏的', true, '');
$this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
}
else if ($page > 1 && $page<=$totalPage)
{
} else if ($page > 1 && $page <= $totalPage) {
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
}
else if ($page > 1 && $page>$totalPage)
{
echo ' ';//退出循环
} else if ($page > 1 && $page > $totalPage) {
echo ' '; //退出循环
}
}
... ... @@ -383,7 +346,6 @@ class HomeController extends AbstractAction
*/
public function suggestSubAction()
{
// 设置网站标题
$this->setTitle('反馈问题');
... ... @@ -417,8 +379,7 @@ class HomeController extends AbstractAction
*/
public function savesuggestAction()
{
if ($this->isAjax())
{
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->post('suggest_type', 2);
... ... @@ -433,8 +394,7 @@ class HomeController extends AbstractAction
*/
public function upAndDownAction()
{
if ($this->isAjax())
{
if ($this->isAjax()) {
$uid = $this->getUid();
$udid = $this->getUdid();
$suggest_id = $this->post('suggest_id', 0);
... ... @@ -457,7 +417,6 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid();
$uid = '10267443'; //临时测试用
$data = GradeModel::getGrade($gender, $channel, $uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
... ... @@ -492,12 +451,9 @@ class HomeController extends AbstractAction
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$data = OrderModel::getNavs($type);
if (!empty($data))
{
if (!empty($data)) {
$order['navs'] = $data;
}
else
{
} else {
$this->error();
}
//渲染模板
... ... @@ -512,8 +468,7 @@ class HomeController extends AbstractAction
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
... ... @@ -523,7 +478,6 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$uid = $this->getUid();
$uid = '10267443'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
/* 如果取不到订单数据时,分两种情况:
... ... @@ -531,18 +485,12 @@ class HomeController extends AbstractAction
2、page=1时,就给一个随便逛逛的链接。
* */
$order = array();
if (!empty($data))
{
if (!empty($data)) {
$order['orders'] = $data;
}
else
{
if ($page > 1)
{
} else {
if ($page > 1) {
echo " ";
}
elseif ($page == 1)
{
} elseif ($page == 1) {
$order['walkwayUrl'] = self::strollAction();
}
}
... ... @@ -558,14 +506,12 @@ class HomeController extends AbstractAction
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以取消订单
$order_code = $this->get('id');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.close';
... ... @@ -582,14 +528,12 @@ class HomeController extends AbstractAction
public function delOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以删除订单
$order_code = $this->get('id');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.delOrderByCode';
... ...
... ... @@ -161,16 +161,14 @@ class DetailModel
}
}
// 调用尺码需要的SKN号
if (isset($baseInfo['erpProductId'])) {
$result['skn'] = $baseInfo['erpProductId'];
}
// 底部悬浮的购物车信息
// 悬浮的购物车信息
$result['cartInfo'] = array(
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'],
);
// 底部简介的URL链接
$result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
}
return $result;
... ... @@ -206,11 +204,8 @@ class DetailModel
$result['goodsDescription']['detail'][] = $value['standardName'] . ':' . $value['standardVal'];
}
}
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true);
if ($productIntro) {
$result['goodsDescription']['desc'] = strtr($productIntro, array('<p>' => '', '\r\n\t' => ''));
}
if (isset($sizeInfo['phrase'])) {
$result['goodsDescription']['desc'] = $sizeInfo['phrase'];
}
// 尺码信息
... ...
... ... @@ -16,17 +16,19 @@ class DetailController extends AbstractAction
*/
public function indexAction()
{
$productId = $this->param('productId', 22399);
$productId = $this->param('productId');
$productId = 22399;
if (!is_numeric($productId)) {
$this->error();
}
$goodsId = $this->param('goodsId', 382089);
$goodsId = $this->param('goodsId');
$goodsId = 32443;
if (!is_numeric($goodsId)) {
$this->error();
}
$uid = $this->getUid();
$data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid);
$data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); var_dump($data);
if (array() === $data) {
$this->error();
}
... ... @@ -41,6 +43,24 @@ class DetailController extends AbstractAction
$this->_view->display('index', $data);
}
/**
* 尺码描述信息
*/
public function introAction()
{
$productSkn = $this->param('productSkn');
if (!is_numeric($productSkn)) {
$this->error();
}
$data = \Product\DetailModel::getSizeInfo($productSkn);
if (array() === $data) {
echo ' ';
exit();
}
$this->_view->display('intro', $data);
}
public function commentsAction()
{
$data = array(
... ...
... ... @@ -117,4 +117,19 @@ routes.brandsearch.route.module = Category
routes.brandsearch.route.controller = Brand
routes.brandsearch.route.action = Search
; 商品详情
routes.product.type = "regex"
routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"
routes.product.route.module = Product
routes.product.route.controller = Detail
routes.product.route.action = Index
routes.product.map.1 = productId
routes.product.map.2 = goodsId
routes.buy.type = "regex"
routes.buy.match = "#/product/intro_([0-9]+)/(.*).html#"
routes.buy.route.module = Product
routes.buy.route.controller = Detail
routes.buy.route.action = Intro
routes.buy.map.1 = productSkn
... ...
... ... @@ -4,19 +4,3 @@ routes.goodsfilter.match = "/search/filter"
routes.goodsfilter.route.module = Index
routes.goodsfilter.route.controller = Search
routes.goodsfilter.route.action = Filter
routes.product.type = "regex"
routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"
routes.product.route.module = Product
routes.product.route.controller = Detail
routes.product.route.action = Index
routes.product.map.1 = productId
routes.product.map.2 = goodsId
routes.buy.type = "regex"
routes.buy.match = "#/product/buy_([0-9]+)_([0-9]+).html#"
routes.buy.route.module = Product
routes.buy.route.controller = Detail
routes.buy.route.action = Index
routes.buy.map.1 = productId
routes.buy.map.2 = goodsId
\ No newline at end of file
... ...