Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

@@ -32,4 +32,58 @@ class CartData @@ -32,4 +32,58 @@ class CartData
32 return Yohobuy::get(Yohobuy::API_URL, $param); 32 return Yohobuy::get(Yohobuy::API_URL, $param);
33 } 33 }
34 34
  35 + /**
  36 + * 移出购物车
  37 + *
  38 + * @param int $uid 用户ID
  39 + * @param string $sku 商品sku列表
  40 + * @return array 接口返回的数据
  41 + */
  42 + public static function removeFromCart($uid, $sku)
  43 + {
  44 + $param = Yohobuy::param();
  45 + $param['method'] = 'app.Shopping.remove';
  46 + $param['product_sku_list'] = $sku;
  47 + $param['uid'] = $uid;
  48 + $param['client_secret'] = Sign::getSign($param);
  49 +
  50 + return Yohobuy::get(Yohobuy::API_URL, $param);
  51 + }
  52 +
  53 + /**
  54 + * 修改购物车商品数据
  55 + *
  56 + * @param int $uid 用户ID
  57 + * @param string $swapData 商品数据
  58 + * @return array 接口返回的数据
  59 + */
  60 + public static function modifyCartProduct($uid, $swapData)
  61 + {
  62 + $param = Yohobuy::param();
  63 + $param['method'] = 'app.Shopping.swap';
  64 + $param['swap_data'] = $swapData;
  65 + $param['uid'] = $uid;
  66 + $param['client_secret'] = Sign::getSign($param);
  67 +
  68 + return Yohobuy::get(Yohobuy::API_URL, $param);
  69 + }
  70 +
  71 + /**
  72 + * 移入收藏夹
  73 + *
  74 + * @param int $uid 用户ID
  75 + * @param string $sku 商品sku列表
  76 + * @return array 接口返回的数据
  77 + */
  78 + public static function addToFav($uid, $sku)
  79 + {
  80 + $param = Yohobuy::param();
  81 + $param['method'] = 'app.Shopping.addfavorite';
  82 + $param['product_sku_list'] = $sku;
  83 + $param['uid'] = $uid;
  84 + $param['client_secret'] = Sign::getSign($param);
  85 +
  86 + return Yohobuy::get(Yohobuy::API_URL, $param);
  87 + }
  88 +
35 } 89 }
@@ -22,15 +22,16 @@ class BrandData @@ -22,15 +22,16 @@ class BrandData
22 * 22 *
23 * @param int $id 品牌ID 23 * @param int $id 品牌ID
24 * @param int $uid 用户ID 24 * @param int $uid 用户ID
  25 + * @param bool $isBrand 是品牌还是商品
25 * @return array 26 * @return array
26 */ 27 */
27 - public static function favorite($id, $uid) 28 + public static function favorite($id, $uid, $isBrand = true)
28 { 29 {
29 $param = Yohobuy::param(); 30 $param = Yohobuy::param();
30 $param['method'] = 'app.favorite.add'; 31 $param['method'] = 'app.favorite.add';
31 $param['id'] = $id; 32 $param['id'] = $id;
32 $param['uid'] = $uid; 33 $param['uid'] = $uid;
33 - $param['type'] = 'brand'; 34 + $param['type'] = $isBrand ? 'brand' : 'product';
34 $param['client_secret'] = Sign::getSign($param); 35 $param['client_secret'] = Sign::getSign($param);
35 36
36 return Yohobuy::post(Yohobuy::API_URL, $param); 37 return Yohobuy::post(Yohobuy::API_URL, $param);
@@ -41,15 +42,16 @@ class BrandData @@ -41,15 +42,16 @@ class BrandData
41 * 42 *
42 * @param int $id 品牌ID 43 * @param int $id 品牌ID
43 * @param int $uid 用户ID 44 * @param int $uid 用户ID
  45 + * @param bool $isBrand 是品牌还是商品
44 * @return array 46 * @return array
45 */ 47 */
46 - public static function favoriteCancel($id, $uid) 48 + public static function favoriteCancel($id, $uid, $isBrand = true)
47 { 49 {
48 $param = Yohobuy::param(); 50 $param = Yohobuy::param();
49 $param['method'] = 'app.favorite.cancel'; 51 $param['method'] = 'app.favorite.cancel';
50 $param['fav_id'] = $id; 52 $param['fav_id'] = $id;
51 $param['uid'] = $uid; 53 $param['uid'] = $uid;
52 - $param['type'] = 'brand'; 54 + $param['type'] = $isBrand ? 'brand' : 'product';
53 $param['client_secret'] = Sign::getSign($param); 55 $param['client_secret'] = Sign::getSign($param);
54 56
55 return Yohobuy::post(Yohobuy::API_URL, $param); 57 return Yohobuy::post(Yohobuy::API_URL, $param);
@@ -205,14 +205,14 @@ class Helpers @@ -205,14 +205,14 @@ class Helpers
205 $result['name'] = $productData['product_name']; 205 $result['name'] = $productData['product_name'];
206 $result['price'] = empty($productData['market_price']) ? false : $productData['market_price']; 206 $result['price'] = empty($productData['market_price']) ? false : $productData['market_price'];
207 $result['salePrice'] = $productData['sales_price']; 207 $result['salePrice'] = $productData['sales_price'];
208 - if ($showPoint) {  
209 - $result['price'] && $result['price'] .= '.00';  
210 - $result['salePrice'] && $result['salePrice'] .= '.00';  
211 - } 208 + if ($showPoint) {
  209 + $result['price'] && $result['price'] .= '.00';
  210 + $result['salePrice'] && $result['salePrice'] .= '.00';
  211 + }
212 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); 212 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
213 $result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_' 213 $result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
214 - . $productData['goods_list'][0]['goods_id']  
215 - . '/' . $productData['cn_alphabet'] . '.html'; 214 + . $productData['goods_list'][0]['goods_id']
  215 + . '/' . $productData['cn_alphabet'] . '.html';
216 // APP访问需要加附加的参数 216 // APP访问需要加附加的参数
217 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 217 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
218 if ($isApp) { 218 if ($isApp) {
@@ -64,7 +64,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -64,7 +64,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
64 id = $this.closest('.shopping-cart-good').data('id'), 64 id = $this.closest('.shopping-cart-good').data('id'),
65 url; 65 url;
66 66
67 - if ($this.closest('.put-in-favorite')) { 67 + if ($this.closest('.put-in-favorite').length > 0) {
68 68
69 //移入收藏夹 69 //移入收藏夹
70 url = '/shoppingCart/col'; 70 url = '/shoppingCart/col';
  1 +.iHelp{
  2 + width: 100%;
  3 + height: auto;
  4 + overflow: hidden;
  5 + .helpSearch{
  6 + width: 90%;
  7 + height: 84rem / $pxConvertRem;
  8 + overflow: hidden;
  9 + position: relative;
  10 + margin: 0 auto;
  11 + input{
  12 + width: 100%;
  13 + height: 100%;
  14 + overflow: hidden;
  15 + border:none;
  16 + font-size: 54em / $pxConvertRem;
  17 + }
  18 + i{
  19 + height: 100%;
  20 + line-height: 88rem / $pxConvertRem;
  21 + position: absolute;
  22 + right: 20rem / $pxConvertRem;
  23 + top: 0;
  24 + color: #e0e0e0;
  25 + }
  26 + }
  27 + ul{
  28 + width: 100%;
  29 + height: auto;
  30 + overflow: hidden;
  31 + display: block;
  32 + border-top: 1px solid #e0e0e0;
  33 + li{
  34 + width: 95%;
  35 + height: 80rem / $pxConvertRem;
  36 + line-height: 84rem / $pxConvertRem;
  37 + overflow: hidden;
  38 + font-size: 54em / $pxConvertRem;
  39 + border-bottom: 1px solid #e0e0e0;
  40 + float: right;
  41 + color: #444444;
  42 + &:last-of-type{
  43 + border-bottom:none;
  44 + }
  45 + span{
  46 + width: 88%;
  47 + height: 100%;
  48 + overflow: hidden;
  49 + float: left;
  50 + }
  51 + i{
  52 + color: #e0e0e0;
  53 + }
  54 + }
  55 + }
  56 +}
1 $vip: sprite-map("me/vip/*.png", $spacing: 10px); 1 $vip: sprite-map("me/vip/*.png", $spacing: 10px);
2 $fav: sprite-map("me/fav/*.png", $spacing: 5px); 2 $fav: sprite-map("me/fav/*.png", $spacing: 5px);
3 3
4 -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang"; 4 +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp";
5 5
  1 +{{> layout/header}}
  2 +<div class="iHelp">
  3 + <div class="helpSearch">
  4 + <input type="text">
  5 + <i class="iconfont">&#xe60f;</i>
  6 + </div>
  7 + <ul>
  8 + {{# iHelp}}
  9 + <li><a href="{{ url }}"><span>{{ name }}</span><i class="iconfont num">&#xe604;</i></a></li>
  10 + {{/ iHelp}}
  11 + </ul>
  12 +</div>
  13 +{{> layout/footer}}
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 </a> 94 </a>
95 </div> 95 </div>
96 <div class="group-list"> 96 <div class="group-list">
97 - <a class="list-item" href="/help.html"> 97 + <a class="list-item" href="/home/IHelp">
98 <span class="iconfont icon">&#xe639;</span> 98 <span class="iconfont icon">&#xe639;</span>
99 帮助 99 帮助
100 <span class="iconfont num">&#xe604;</span> 100 <span class="iconfont num">&#xe604;</span>
@@ -14,7 +14,6 @@ use Index\UserModel as UserModel; @@ -14,7 +14,6 @@ use Index\UserModel as UserModel;
14 * @package 14 * @package
15 * @copyright yoho.inc 15 * @copyright yoho.inc
16 * @version 1.0 (2015-10-28 16:28:32) 16 * @version 1.0 (2015-10-28 16:28:32)
17 - * @author fei.hong <fei.hong@yoho.cn>  
18 */ 17 */
19 class HomeController extends AbstractAction 18 class HomeController extends AbstractAction
20 { 19 {
@@ -27,7 +26,12 @@ class HomeController extends AbstractAction @@ -27,7 +26,12 @@ class HomeController extends AbstractAction
27 public function init() 26 public function init()
28 { 27 {
29 // 检查用户是否登录, 未登录则跳转到登录页 28 // 检查用户是否登录, 未登录则跳转到登录页
30 - $uid = 8826435; //$this->getUid(true); 29 + // @todo 为了方便测试,支持传uid参数
  30 + $uid = $this->getUid();
  31 + if (!$uid) {
  32 + $uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
  33 + }
  34 +
31 $action = $this->getRequest()->getActionName(); 35 $action = $this->getRequest()->getActionName();
32 if (!$uid && $action !== 'index') { 36 if (!$uid && $action !== 'index') {
33 $this->go(Helpers::url('/signin.html')); 37 $this->go(Helpers::url('/signin.html'));
@@ -654,4 +658,28 @@ class HomeController extends AbstractAction @@ -654,4 +658,28 @@ class HomeController extends AbstractAction
654 $this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true)); 658 $this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
655 } 659 }
656 660
657 -} 661 + /**
  662 + * 帮助列表页
  663 + */
  664 + private function IHelpAction()
  665 + {
  666 + $this->setTitle('帮助中心');
  667 + $this->setNavHeader('帮助中心');
  668 + $data = array(
  669 + 'iHelp' => array(
  670 + array('name' => '新用户注册','url' => 'http://m.dev.yohobuy.com/' ),
  671 + array('name' => '交款须知' ,'url' => 'http://m.dev.yohobuy.com/'),
  672 + array('name' => '服务条款' ,'url' => 'http://m.dev.yohobuy.com/'),
  673 + array('name' => '网站订购流程' ,'url' => 'http://m.dev.yohobuy.com/'),
  674 + array('name' => '会员登录' ,'url' => 'http://m.dev.yohobuy.com/'),
  675 + array('name' => '网站订单修改' ,'url' => 'http://m.dev.yohobuy.com/'),
  676 + array('name' => 'YOHO币' ,'url' => 'http://m.dev.yohobuy.com/'),
  677 + array('name' => '常见问题' ,'url' => 'http://m.dev.yohobuy.com/'),
  678 + array('name' => '支付方式' ,'url' => 'http://m.dev.yohobuy.com/'),
  679 + array('name' => '发票制度说明' ,'url' => 'http://m.dev.yohobuy.com/'),
  680 + array('name' => '配送时间' ,'url' => 'http://m.dev.yohobuy.com/')
  681 + )
  682 + );
  683 + $this->_view->display('i-help', $data);
  684 + }
  685 +}
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use Index\CartModel;
  5 +use Plugin\Helpers;
4 6
5 /** 7 /**
6 * 购物车 8 * 购物车
7 */ 9 */
8 class ShoppingCartController extends AbstractAction 10 class ShoppingCartController extends AbstractAction
9 { 11 {
  12 + protected $_uid;
  13 +
  14 + /**
  15 + * 初始化
  16 + */
  17 + public function init()
  18 + {
  19 + // 检查用户是否登录, 未登录则跳转到登录页
  20 + $this->_uid = $this->getUid();
  21 + if (!$this->_uid) {
  22 + $this->go(Helpers::url('/signin.html'));
  23 + }
  24 +
  25 + parent::init();
  26 + }
  27 +
  28 + /*
  29 + * 首页
  30 + */
10 public function indexAction() 31 public function indexAction()
11 { 32 {
12 $this->setTitle('购物车'); 33 $this->setTitle('购物车');
13 $this->setNavHeader('购物车'); 34 $this->setNavHeader('购物车');
14 35
15 - $uid = $this->getUid();  
16 $data = array( 36 $data = array(
17 'shoppingCartPage' => true, 37 'shoppingCartPage' => true,
18 - 'shoppingCart' => \Index\CartModel::getCartData($uid) 38 + 'shoppingCart' => CartModel::getCartData($this->_uid)
19 ); 39 );
20 40
21 // 渲染模板 41 // 渲染模板
22 $this->_view->display('index', $data); 42 $this->_view->display('index', $data);
23 } 43 }
24 44
  45 + /**
  46 + * 移出购物车
  47 + */
  48 + public function delAction()
  49 + {
  50 + $result = array();
  51 +
  52 + if ($this->isAjax()) {
  53 + $productId = $this->post('id', 0);
  54 + $result = CartModel::removeFromCart($this->_uid, $productId);
  55 + }
  56 +
  57 + if (empty($result)) {
  58 + echo ' ';
  59 + } else {
  60 + $this->echoJson($result);
  61 + }
  62 + }
  63 +
  64 + /**
  65 + * 移入收藏夹
  66 + */
  67 + public function colAction()
  68 + {
  69 + $result = array();
  70 +
  71 + if ($this->isAjax()) {
  72 + $productId = $this->post('id', 0);
  73 + $result = CartModel::addToFav($this->_uid, $productId);
  74 + }
  75 +
  76 + if (empty($result)) {
  77 + echo ' ';
  78 + } else {
  79 + $this->echoJson($result);
  80 + }
  81 + }
  82 +
  83 + /**
  84 + * 修改购物车商品数据
  85 + */
  86 + public function modifyAction()
  87 + {
  88 + $result = array();
  89 +
  90 + if ($this->isAjax()) {
  91 +
  92 + $params = array();
  93 + $params['old_product_sku']= $this->post('old_product_sku', 0);
  94 + $params['new_product_sku']= $this->post('new_product_sku', 0);
  95 + $params['buy_number']= $this->post('buy_number', 0);
  96 + $params['selected']= $this->post('selected', null);
  97 + $result = CartModel::modifyCartProduct($this->_uid, $params);
  98 + }
  99 +
  100 + if (empty($result)) {
  101 + echo ' ';
  102 + } else {
  103 + $this->echoJson($result);
  104 + }
  105 + }
  106 +
25 public function giftAdvanceAction() 107 public function giftAdvanceAction()
26 { 108 {
27 $data = array( 109 $data = array(
@@ -51,6 +51,75 @@ class CartModel @@ -51,6 +51,75 @@ class CartModel
51 return $result; 51 return $result;
52 } 52 }
53 53
  54 + /**
  55 + * 移出购物车
  56 + *
  57 + * @param int $uid 用户ID
  58 + * @param string $sku 商品sku列表
  59 + * @return array 接口返回的数据
  60 + */
  61 + public static function removeFromCart($uid, $sku)
  62 + {
  63 + $result = array('code' => 400, 'message' => '出错啦~');
  64 +
  65 + // 处理sku
  66 + $sku_list = json_encode(array($sku => 1));
  67 +
  68 + $remove = CartData::removeFromCart($uid, $sku_list);
  69 + if ($remove && isset($remove['code'])) {
  70 + $result['code'] = $remove['code'];
  71 + $result['message'] = $remove['message'];
  72 + }
  73 +
  74 + return $result;
  75 + }
  76 +
  77 + /**
  78 + * 移入收藏夹
  79 + *
  80 + * @param int $uid 用户ID
  81 + * @param string $sku 商品sku列表
  82 + * @return array 接口返回的数据
  83 + */
  84 + public static function addToFav($uid, $sku)
  85 + {
  86 + $result = array('code' => 400, 'message' => '出错啦~');
  87 +
  88 + // 处理sku
  89 + $sku_list = json_encode(array($sku => 1));
  90 +
  91 + $add = CartData::addToFav($uid, $sku_list);
  92 + if ($add && isset($add['code'])) {
  93 + $result['code'] = $add['code'];
  94 + $result['message'] = $add['message'];
  95 + }
  96 +
  97 + return $result;
  98 + }
  99 +
  100 + /**
  101 + * 修改购物车商品数据
  102 + *
  103 + * @param int $uid 用户ID
  104 + * @param string $param 要更改的数据
  105 + * @return array 接口返回的数据
  106 + */
  107 + public static function modifyCartProduct($uid, $param)
  108 + {
  109 + $result = array('code' => 400, 'message' => '出错啦~');
  110 +
  111 + // 处理要更改的数据
  112 + $swapData = json_encode(array($param));
  113 +
  114 + $modify = CartData::addToFav($uid, $swapData);
  115 + if ($modify && isset($modify['code'])) {
  116 + $result['code'] = $modify['code'];
  117 + $result['message'] = $modify['message'];
  118 + }
  119 +
  120 + return $result;
  121 + }
  122 +
54 123
55 /** 124 /**
56 * 处理不同类型的购物车数据 125 * 处理不同类型的购物车数据
@@ -65,7 +134,7 @@ class CartModel @@ -65,7 +134,7 @@ class CartModel
65 $oneGoods = array(); 134 $oneGoods = array();
66 // 购买的商品列表 135 // 购买的商品列表
67 foreach ($data['goods_list'] as $value) { 136 foreach ($data['goods_list'] as $value) {
68 - $oneGoods['id'] = $value['product_id']; 137 + $oneGoods['id'] = $value['product_sku'];
69 $oneGoods['name'] = $value['product_name']; 138 $oneGoods['name'] = $value['product_name'];
70 $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120); 139 $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
71 $oneGoods['color'] = $value['color_name']; 140 $oneGoods['color'] = $value['color_name'];
@@ -31,15 +31,44 @@ class DetailModel @@ -31,15 +31,44 @@ class DetailModel
31 31
32 if (is_numeric($productId) && is_numeric($goodsId)) { 32 if (is_numeric($productId) && is_numeric($goodsId)) {
33 // 调用服务 33 // 调用服务
34 - $baseInfo = DetailData::baseInfo($productId, $uid); 34 + $baseInfo = DetailData::baseInfo($productId, $uid);
  35 +
  36 + // 判断商品是否在架
  37 + if (empty($baseInfo['status'])) {
  38 + return $result;
  39 + }
35 40
36 // 商品名称 41 // 商品名称
37 if (isset($baseInfo['productName'])) { 42 if (isset($baseInfo['productName'])) {
38 $result['goodsName'] = $baseInfo['productName']; 43 $result['goodsName'] = $baseInfo['productName'];
39 - } else {  
40 - return $result;  
41 - } 44 + }
42 45
  46 + // 商品标签
  47 + if (!empty($baseInfo['productTagBoList'])) {
  48 + foreach ($baseInfo['productTagBoList'] as $value) {
  49 + switch ($value['tagLabel']) {
  50 + case 'is_soon_sold_out': // 即将售磬
  51 + $result['tags']['is_soon_sold_out'] = true;
  52 + break;
  53 + case 'is_new': // 新品
  54 + $result['tags']['is_new'] = true;
  55 + break;
  56 + case 'is_discount': // 在售
  57 + $result['tags']['is_discount'] = true;
  58 + break;
  59 + case 'is_limited': // 限量
  60 + $result['tags']['is_limited'] = true;
  61 + break;
  62 + case 'is_yohood': // YOHOOD
  63 + $result['tags']['is_yohood'] = true;
  64 + break;
  65 + case 'is_advance': // 再到着
  66 + $result['tags']['is_advance'] = true;
  67 + break;
  68 + }
  69 + }
  70 + }
  71 +
43 // 商品价格 72 // 商品价格
44 if (isset($baseInfo['productPriceBo'])) { 73 if (isset($baseInfo['productPriceBo'])) {
45 $result['goodsPrice'] = array(); 74 $result['goodsPrice'] = array();
@@ -176,6 +205,7 @@ class DetailModel @@ -176,6 +205,7 @@ class DetailModel
176 205
177 // 底部简介的URL链接 206 // 底部简介的URL链接
178 $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html'); 207 $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
  208 + $result['id'] = $productId;
179 } 209 }
180 210
181 return $result; 211 return $result;
@@ -60,7 +60,55 @@ class OptController extends AbstractAction @@ -60,7 +60,55 @@ class OptController extends AbstractAction
60 $result = array('code' => 401, 'message' => '参数不正确', 'data' => false); 60 $result = array('code' => 401, 'message' => '参数不正确', 'data' => false);
61 break; 61 break;
62 } 62 }
  63 + } while (false);
  64 +
  65 + $this->echoJson($result);
  66 + }
  67 +
  68 + /**
  69 + * 商品收藏/取消收藏
  70 + *
  71 + * @param int id 商品ID
  72 + * @param string opt 操作标识("ok":表示收藏,"cancel":表示取消收藏)
  73 + * @return json
  74 + */
  75 + public function favoriteProductAction()
  76 + {
  77 + $result = array('code' => 401, 'message' => '参数不正确', 'data' => false);
63 78
  79 + do {
  80 + /* 判断是否是AJAX请求 */
  81 + if (!$this->isAjax()) {
  82 + break;
  83 + }
  84 +
  85 + /* 判断品牌ID是否有效 */
  86 + $id = $this->post('id');
  87 + if (!is_numeric($id)) {
  88 + break;
  89 + }
  90 +
  91 + /* 判断用户是否登录 */
  92 + $uid = $this->getUid();
  93 + if (!$uid) {
  94 + $referer = $this->server('HTTP_REFERER', SITE_MAIN);
  95 + $result = array('code' => 400, 'message' => '未登录', 'data' => Helpers::url('/signin.html', array('refer' => $referer)));
  96 + break;
  97 + }
  98 +
  99 + /* 取消收藏 */
  100 + $opt = $this->post('opt', 'ok');
  101 + if ($opt !== 'ok') {
  102 + $result = BrandData::favoriteCancel($id, $uid, false);
  103 + break;
  104 + }
  105 +
  106 + /* 收藏 */
  107 + $result = BrandData::favorite($id, $uid, false);
  108 + if (!isset($result['code'])) {
  109 + $result = array('code' => 401, 'message' => '参数不正确', 'data' => false);
  110 + break;
  111 + }
64 } while (false); 112 } while (false);
65 113
66 $this->echoJson($result); 114 $this->echoJson($result);
@@ -33,12 +33,12 @@ application.debug = False @@ -33,12 +33,12 @@ application.debug = False
33 application.servers.config = APPLICATION_PATH "/configs/core" 33 application.servers.config = APPLICATION_PATH "/configs/core"
34 34
35 ;出错的时候是否抛出异常 35 ;出错的时候是否抛出异常
36 -application.dispatcher.throwException = False 36 +application.dispatcher.throwException = True
37 37
38 ;是否使用默认的异常 捕获Controller, 如果开启, 在有未捕获的异常的时候, 38 ;是否使用默认的异常 捕获Controller, 如果开启, 在有未捕获的异常的时候,
39 ;控制权会交给ErrorController的errorAction 方法, 39 ;控制权会交给ErrorController的errorAction 方法,
40 ;可以通过$request->getException()获得此异常对象 40 ;可以通过$request->getException()获得此异常对象
41 -application.dispatcher.catchException = False 41 +application.dispatcher.catchException = True
42 42
43 ;模板预编译目录,该目录需要有读写权限 43 ;模板预编译目录,该目录需要有读写权限
44 application.template.compile = ROOT_PATH "/compile/m.yohobuy.com" 44 application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
@@ -126,10 +126,10 @@ routes.product.route.action = Index @@ -126,10 +126,10 @@ routes.product.route.action = Index
126 routes.product.map.1 = productId 126 routes.product.map.1 = productId
127 routes.product.map.2 = goodsId 127 routes.product.map.2 = goodsId
128 128
129 -routes.buy.type = "regex"  
130 -routes.buy.match = "#/product/intro_([0-9]+)/(.*).html#"  
131 -routes.buy.route.module = Product  
132 -routes.buy.route.controller = Detail  
133 -routes.buy.route.action = Intro  
134 -routes.buy.map.1 = productSkn 129 +routes.productintro.type = "regex"
  130 +routes.productintro.match = "#/product/intro_([0-9]+)/(.*).html#"
  131 +routes.productintro.route.module = Product
  132 +routes.productintro.route.controller = Detail
  133 +routes.productintro.route.action = Intro
  134 +routes.productintro.map.1 = productSkn
135 135
  1 +<?php
  2 +use Yaf\Application;
  3 +
  4 +define('SITE_MAIN', 'http://m.yohobuy.com'); // 网站主域名
  5 +define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
  6 +define('COOKIE_DOMAIN', '.m.yohobuy.com'); // COOKIE作用域
  7 +define('SUB_DOMAIN', '.m.yohobuy.com'); // 子域名后缀
  8 +define('USE_CACHE', false); // 缓存的开关
  9 +define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
  10 +define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
  11 +defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'preview');
  12 +
  13 +$application = new Application(APPLICATION_PATH . '/configs/application.preview.ini');
  14 +$application->bootstrap()->run();