Authored by yangyang

解决home.php冲突,保留order控制器

@@ -955,7 +955,7 @@ @@ -955,7 +955,7 @@
955 //订单 955 //订单
956 { 956 {
957 orderNum: '', 957 orderNum: '',
958 - tradingStatus: '', 958 + orderStatus: '',
959 goods: [ 959 goods: [
960 { 960 {
961 id: '', 961 id: '',
@@ -1014,11 +1014,10 @@ @@ -1014,11 +1014,10 @@
1014 ... //订单商品 1014 ... //订单商品
1015 } 1015 }
1016 ], 1016 ],
1017 - sumPrice: ''  
1018 - salePrice: ''  
1019 - freight: ''  
1020 - coupon: ''  
1021 - yohoCoin: '' 1017 + sumPrice: '',
  1018 + salePrice: '',
  1019 + freight: '',
  1020 + yohoCoin: '',
1022 price: '' 1021 price: ''
1023 } 1022 }
1024 } 1023 }
@@ -161,7 +161,7 @@ class UserData @@ -161,7 +161,7 @@ class UserData
161 public static function couponData($uid, $status, $page = 1, $limit = 10) 161 public static function couponData($uid, $status, $page = 1, $limit = 10)
162 { 162 {
163 $param = Yohobuy::param(); 163 $param = Yohobuy::param();
164 - $param['method'] = 'app.yohocoin.lists'; 164 + $param['method'] = 'app.coupons.li';
165 $param['uid'] = $uid; 165 $param['uid'] = $uid;
166 $param['status'] = $status; 166 $param['status'] = $status;
167 $param['page'] = $page; 167 $param['page'] = $page;
@@ -188,6 +188,76 @@ class UserData @@ -188,6 +188,76 @@ class UserData
188 } 188 }
189 189
190 /** 190 /**
  191 + * 获取三级地址列表数据
  192 + *
  193 + * @param int $uid 用户ID
  194 + * @return array 地址接口返回的数据
  195 + */
  196 + public static function addressListData($uid)
  197 + {
  198 + $param = Yohobuy::param();
  199 + $param['method'] = 'app.address.getlist';
  200 + $param['uid'] = $uid;
  201 + $param['client_secret'] = Sign::getSign($param);
  202 +
  203 + return Yohobuy::get(Yohobuy::API_URL, $param);
  204 + }
  205 +
  206 + /**
  207 + * 保存地址数据
  208 + *
  209 + * @param int $uid 用户ID
  210 + * @param string $address 地址信息
  211 + * @param int $area_code 城市码
  212 + * @param string $consignee 收货人
  213 + * @param string $email 邮箱地址
  214 + * @param int $id 地址唯一标识符id
  215 + * @param string $mobile 手机号码
  216 + * @param string $zip_code 邮编
  217 + * @return array 地址接口返回的数据
  218 + */
  219 + public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code)
  220 + {
  221 + $param = Yohobuy::param();
  222 + $param['address'] = $address;
  223 + $param['area_code'] = $area_code;
  224 + $param['consignee'] = $consignee;
  225 + $param['email'] = $email;
  226 +
  227 + if ($id !== null) { // 修改
  228 + $param['id'] = $id;
  229 + $param['method'] = 'app.address.update';
  230 + } else { // 添加
  231 + $param['method'] = 'app.address.add';
  232 + }
  233 +
  234 + $param['mobile'] = $mobile;
  235 + $param['zip_code'] = $zip_code;
  236 + $param['uid'] = $uid;
  237 + $param['client_secret'] = Sign::getSign($param);
  238 +
  239 + return Yohobuy::get(Yohobuy::API_URL, $param);
  240 + }
  241 +
  242 + /**
  243 + * 设置默认地址
  244 + *
  245 + * @param int $uid 用户ID
  246 + * @param int $id 地址唯一标识符id
  247 + * @return array 接口返回的数据
  248 + */
  249 + public static function setDefaultAddress($uid, $id)
  250 + {
  251 + $param = Yohobuy::param();
  252 + $param['id'] = $id;
  253 + $param['method'] = 'app.address.setdefault';
  254 + $param['uid'] = $uid;
  255 + $param['client_secret'] = Sign::getSign($param);
  256 +
  257 + return Yohobuy::get(Yohobuy::API_URL, $param);
  258 + }
  259 +
  260 + /**
191 * 意见反馈数据 261 * 意见反馈数据
192 * 262 *
193 * @param string $udid 客户端唯一标识 263 * @param string $udid 客户端唯一标识
@@ -4,12 +4,4 @@ @@ -4,12 +4,4 @@
4 * @date: 2015/11/12 4 * @date: 2015/11/12
5 */ 5 */
6 6
7 -var Swiper = require('yoho.iswiper');  
8 -  
9 -var recommendSwiper;  
10 -  
11 -recommendSwiper = new Swiper('.swiper-recommend', {  
12 - lazyLoading: true,  
13 - lazyLoadingInPrevNext: true,  
14 - slidesPerView: 'auto'  
15 -});  
  7 +require('../product/recommend-for-you.js');
@@ -10,20 +10,38 @@ var $ = require('jquery'), @@ -10,20 +10,38 @@ var $ = require('jquery'),
10 10
11 var orderId = $('#order-detail').data('id'); 11 var orderId = $('#order-detail').data('id');
12 12
13 -var delHammer; 13 +var optHammer;
14 14
15 lazyLoad(); 15 lazyLoad();
16 16
17 //订单删除 17 //订单删除
18 -delHammer = new Hammer(document.getElementsByClassName('btn-del')[0]);  
19 -delHammer.on('tap', function() {  
20 - if (confirm('确定删除订单吗?')) {  
21 - $.ajax({  
22 - type: 'GET',  
23 - url: '/home/delOrder',  
24 - data: {  
25 - id: orderId  
26 - }  
27 - }); 18 +optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
  19 +optHammer.on('tap', function(e) {
  20 + var $cur = $(e.target);
  21 +
  22 + if ($cur.hasClass('btn-del')) {
  23 +
  24 + //删除订单
  25 + if (confirm('确定删除订单吗?')) {
  26 + $.ajax({
  27 + type: 'GET',
  28 + url: '/home/delOrder',
  29 + data: {
  30 + id: orderId
  31 + }
  32 + });
  33 + }
  34 + } else if ($cur.hasClass('btn-cancel')) {
  35 +
  36 + //取消订单
  37 + if (confirm('确定取消订单吗?')) {
  38 + $.ajax({
  39 + type: 'GET',
  40 + url: '/home/cancelOrder',
  41 + data: {
  42 + id: orderId
  43 + }
  44 + });
  45 + }
28 } 46 }
29 }); 47 });
  1 +/**
  2 + * 为您优选
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/11/16
  5 + */
  6 +
  7 +
  8 +var Swiper = require('yoho.iswiper');
  9 +
  10 +var recommendSwiper;
  11 +
  12 +recommendSwiper = new Swiper('.swiper-recommend', {
  13 +
  14 + // lazyLoading: true,
  15 + // lazyLoadingInPrevNext: true,
  16 + slidesPerView: 'auto'
  17 +});
1 -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address", "online-service"; 1 +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service";
  2 +
@@ -15,6 +15,30 @@ @@ -15,6 +15,30 @@
15 } 15 }
16 } 16 }
17 17
  18 + .sub {
  19 + position: relative;
  20 +
  21 + .iconfont {
  22 + left: 0;
  23 + }
  24 + }
  25 +
  26 + .logistics {
  27 + display: block;
  28 +
  29 + .icon-right {
  30 + right: 25rem / $pxConvertRem;
  31 + left: auto;
  32 + color: #b0b0b0;
  33 + }
  34 +
  35 + .sub-content {
  36 + border-top: 1px solid #e0e0e0;
  37 + margin-top: 20rem / $pxConvertRem;
  38 + padding-top: 20rem / $pxConvertRem;
  39 + }
  40 + }
  41 +
18 .owner-info { 42 .owner-info {
19 border-bottom: 1px solid #e0e0e0; 43 border-bottom: 1px solid #e0e0e0;
20 line-height: 1.5; 44 line-height: 1.5;
@@ -41,6 +65,7 @@ @@ -41,6 +65,7 @@
41 margin: 20rem / $pxConvertRem 0; 65 margin: 20rem / $pxConvertRem 0;
42 border-top: 1px solid #e0e0e0; 66 border-top: 1px solid #e0e0e0;
43 border-bottom: 1px solid #e0e0e0; 67 border-bottom: 1px solid #e0e0e0;
  68 + padding-right: 0;
44 } 69 }
45 70
46 .sub-content span { 71 .sub-content span {
@@ -98,4 +123,11 @@ @@ -98,4 +123,11 @@
98 text-align: center; 123 text-align: center;
99 border: 1px solid #000; 124 border: 1px solid #000;
100 } 125 }
  126 +
  127 + .btn-pay {
  128 + color: #fff;
  129 + border: none;
  130 + background: #d0021b;
  131 + margin-left: 10rem / $pxConvertRem;
  132 + }
101 } 133 }
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 border-bottom: 1px solid #e0e0e0; 18 border-bottom: 1px solid #e0e0e0;
19 } 19 }
20 20
21 - .trading-status { 21 + .order-status {
22 float: right; 22 float: right;
23 } 23 }
24 24
1 -@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank";  
  1 +@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank", "_recommend-for-you.scss";
@@ -87,6 +87,6 @@ @@ -87,6 +87,6 @@
87 </div> 87 </div>
88 </div> 88 </div>
89 89
90 - {{> me/recommend-for-you}} 90 + {{> product/recommend-for-you}}
91 </div> 91 </div>
92 {{> layout/footer}} 92 {{> layout/footer}}
@@ -3,12 +3,11 @@ @@ -3,12 +3,11 @@
3 {{# service}} 3 {{# service}}
4 <div class="question"> 4 <div class="question">
5 <div class="question-title">问题查询</div> 5 <div class="question-title">问题查询</div>
6 - <div class="question-tab">  
7 - <span class="tab-item" data-tab="order">订单问题</span>  
8 - <span class="line"></span>  
9 - <span class="tab-item current" data-tab="shopping">购物问题</span>  
10 - <span class="line"></span>  
11 - <span class="tab-item" data-tab="other">其他问题</span> 6 + <div class="question-tab">
  7 + {{#tab}}
  8 + <span class="tab-item {{#current}}current{{/current}}" data-tab="{{tabid}}">{{tabname}}</span>
  9 + {{#iscut}}<span class="line"></span>{{/iscut}}
  10 + {{/tab}}
12 </div> 11 </div>
13 {{#question}} 12 {{#question}}
14 <ul class="question-list {{#current}}current{{/current}}" data-tab-name="{{name}}"> 13 <ul class="question-list {{#current}}current{{/current}}" data-tab-name="{{name}}">
@@ -26,7 +25,7 @@ @@ -26,7 +25,7 @@
26 {{/ service}} 25 {{/ service}}
27 <div class="connect-info"> 26 <div class="connect-info">
28 <div class="connect-item connect-online"> 27 <div class="connect-item connect-online">
29 - <a href="#" title="在线客服"> 28 + <a href="http://chat80.live800.com/live800/chatClient/chatbox.jsp?companyID=493979&amp;configID=123576&amp;jid=9277320930" target="_blank" title="在线客服">
30 <span class="icon iconfont icon-chat">&#xe620;</span> 29 <span class="icon iconfont icon-chat">&#xe620;</span>
31 在线客服 30 在线客服
32 <span class="iconfont icon-yoho-enter">&#xe604;</span> 31 <span class="iconfont icon-yoho-enter">&#xe604;</span>
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <span>物流公司:{{logisticsCompany}}</span> 32 <span>物流公司:{{logisticsCompany}}</span>
33 <span>快递单号:{{logisticsNum}}</span> 33 <span>快递单号:{{logisticsNum}}</span>
34 </p> 34 </p>
35 - <span class="iconfont">&#xe614;</span> 35 + <span class="iconfont icon-right">&#xe614;</span>
36 </a> 36 </a>
37 {{/if}} 37 {{/if}}
38 </section> 38 </section>
@@ -57,10 +57,6 @@ @@ -57,10 +57,6 @@
57 <span>+¥{{freight}}</span> 57 <span>+¥{{freight}}</span>
58 </li> 58 </li>
59 <li> 59 <li>
60 - 优惠券  
61 - <span>-¥{{coupon}}</span>  
62 - </li>  
63 - <li>  
64 YOHO币 60 YOHO币
65 <span>-¥{{yohoCoin}}</span> 61 <span>-¥{{yohoCoin}}</span>
66 </li> 62 </li>
1 <div class="order" data-id="{{orderNum}}"> 1 <div class="order" data-id="{{orderNum}}">
2 <header class="header"> 2 <header class="header">
3 订单编号:{{orderNum}} 3 订单编号:{{orderNum}}
4 - <span class="trading-status">{{tradingStatus}}</span> 4 + <span class="order-status">{{orderStatus}}</span>
5 </header> 5 </header>
6 <section class="order-goods"> 6 <section class="order-goods">
7 {{# goods}} 7 {{# goods}}
@@ -2,17 +2,17 @@ @@ -2,17 +2,17 @@
2 <div class="recommend-for-you"> 2 <div class="recommend-for-you">
3 <div class="title">为您优选新品</div> 3 <div class="title">为您优选新品</div>
4 <div class="swiper-recommend"> 4 <div class="swiper-recommend">
5 - <div class="swiper-wrapper"> 5 + <ul class="swiper-wrapper">
6 {{#recommendList}} 6 {{#recommendList}}
7 - <div class="swiper-slider"> 7 + <li class="swiper-slider">
8 <img class="img-box" src="{{thumb}}"> 8 <img class="img-box" src="{{thumb}}">
9 <div class="price"> 9 <div class="price">
10 <span class="sale-price"{{salePrice}}</span> 10 <span class="sale-price"{{salePrice}}</span>
11 <span class="old-price"{{price}}</span> 11 <span class="old-price"{{price}}</span>
12 </div> 12 </div>
13 - </div> 13 + </li>
14 {{/recommendList}} 14 {{/recommendList}}
15 - </div> 15 + </ul>
16 </div> 16 </div>
17 </div> 17 </div>
18 {{/ recommendForYou}} 18 {{/ recommendForYou}}
@@ -146,9 +146,20 @@ class HomeController extends AbstractAction @@ -146,9 +146,20 @@ class HomeController extends AbstractAction
146 $uid = 967016; 146 $uid = 967016;
147 $currency = \Index\UserModel::getYohoCoinData($uid); 147 $currency = \Index\UserModel::getYohoCoinData($uid);
148 148
149 - $this->_view->display('currency', $currency); 149 + $this->setTitle('优惠券');
  150 + $this->setNavHeader('优惠券', true, SITE_MAIN);
  151 + // $uid = $this->getUid();
  152 + $uid = 8826435;
  153 + $coupons = array(
  154 + 'couponsUrl' => array(
  155 + \Index\UserModel::getCouponData($uid, 0),
  156 + \Index\UserModel::getCouponData($uid, 1),
  157 + ),
  158 + 'couponsPage' => true
  159 + );
  160 +
  161 + $this->_view->display('coupons', $coupons);
150 } 162 }
151 -  
152 /** 163 /**
153 * 优惠券 164 * 优惠券
154 */ 165 */
@@ -193,38 +204,70 @@ class HomeController extends AbstractAction @@ -193,38 +204,70 @@ class HomeController extends AbstractAction
193 // $uid = $this->getUid(); 204 // $uid = $this->getUid();
194 $uid = 967016; 205 $uid = 967016;
195 206
196 - $address = \Index\UserModel::getAddressData($uid); 207 + $address = \Index\UserModel::getAddressData($uid);
  208 + $addressList = \Index\UserModel::getAddressListData($uid);
197 209
198 // print_r($address); 210 // print_r($address);
199 211
200 $this->_view->display('address', array( 212 $this->_view->display('address', array(
201 'addressPage' => true, 213 'addressPage' => true,
202 'pageFooter' => true, 214 'pageFooter' => true,
203 - 'address' => $address 215 + 'address' => $address,
  216 + 'addressList' => $addressList
204 )); 217 ));
205 } 218 }
206 219
207 - /**  
208 - * 修改地址  
209 - */  
210 - public function editAddressAction() {  
211 - // 设置网站标题  
212 - $this->setTitle('修改地址');  
213 - $this->setNavHeader('修改地址', true, SITE_MAIN);  
214 -  
215 - // $uid = $this->getUid();  
216 - $uid = 967016;  
217 -  
218 - $address = \Index\UserModel::getAddressData($uid);  
219 -  
220 - // print_r($address);  
221 -  
222 - $this->_view->display('edit_address', array(  
223 - 'editAddressPage' => true,  
224 - 'pageFooter' => true,  
225 - 'address' => $address  
226 - ));  
227 - } 220 + /**
  221 + * 修改地址或者添加新地址
  222 + */
  223 + public function saveAddressAction()
  224 + {
  225 + $result = array();
  226 +
  227 + if ($this->isAjax()) {
  228 + // $uid = $this->getUid();
  229 + $uid = 967016;
  230 + $address = $this->post('address', '');
  231 + $area_code = $this->post('area_code', '');
  232 + $consignee = $this->post('consignee', '');
  233 + $email = $this->post('email', '');
  234 + $id = $this->post('id', null);
  235 + $mobile = $this->post('mobile', '');
  236 + $zip_code = $this->post('zip_code', '');
  237 +
  238 + $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
  239 + }
  240 +
  241 + if (empty($result)) {
  242 + echo ' ';
  243 + } else {
  244 + $this->echoJson($result);
  245 + }
  246 +
  247 + }
  248 +
  249 + /**
  250 + * 设置默认地址
  251 + */
  252 + public function defaultAddressAction()
  253 + {
  254 + $result = array();
  255 +
  256 + if ($this->isAjax()) {
  257 + // $uid = $this->getUid();
  258 + $uid = 967016;
  259 + $id = $this->post('id', '');
  260 +
  261 + $result = \Index\UserModel::setDefaultAddress($uid, $id);
  262 + }
  263 +
  264 + if (empty($result)) {
  265 + echo ' ';
  266 + } else {
  267 + $this->echoJson($result);
  268 + }
  269 +
  270 + }
228 271
229 //在线客服 272 //在线客服
230 public function onlineServiceAction() { 273 public function onlineServiceAction() {
@@ -245,9 +288,13 @@ class HomeController extends AbstractAction @@ -245,9 +288,13 @@ class HomeController extends AbstractAction
245 public function onlineServiceDetailAction() { 288 public function onlineServiceDetailAction() {
246 $service = array(); 289 $service = array();
247 $cateId = $this->get('cateId', 0); 290 $cateId = $this->get('cateId', 0);
248 - if ($cateId > 0) { 291 + $cateName = $this->get('cateName', '');
  292 + if ($cateId > 0)
  293 + {
249 $service = home\OnlineModel::getOnlineServiceDetail($cateId); 294 $service = home\OnlineModel::getOnlineServiceDetail($cateId);
250 } 295 }
  296 + $this->setTitle('在线客服');
  297 + $this->setNavHeader($cateName, true, '');
251 $this->_view->display('online_service_detail', $service); 298 $this->_view->display('online_service_detail', $service);
252 } 299 }
253 300
@@ -218,7 +218,7 @@ class UserModel @@ -218,7 +218,7 @@ class UserModel
218 218
219 // 处理优惠券数据 219 // 处理优惠券数据
220 if (isset($coupons['data']) && !empty($coupons['data'])) { 220 if (isset($coupons['data']) && !empty($coupons['data'])) {
221 - $result = $coupons['data']; 221 + $result = $coupons['data']['info'];
222 } 222 }
223 223
224 return $result; 224 return $result;
@@ -246,6 +246,96 @@ class UserModel @@ -246,6 +246,96 @@ class UserModel
246 } 246 }
247 247
248 /** 248 /**
  249 + * 处理地址列表数据
  250 + *
  251 + * @param int $uid 用户ID
  252 + * @return array|mixed 处理之后的地址列表数据
  253 + */
  254 + public static function getAddressListData($uid)
  255 + {
  256 + $result = array();
  257 +
  258 + // 调用接口获取地址列表数据
  259 + $address = UserData::addressListData($uid);
  260 +
  261 + // 处理地址数据
  262 + if (isset($address['data']) && !empty($address['data'])) {
  263 + $result = $address['data'];
  264 + }
  265 +
  266 + return $result;
  267 + }
  268 +
  269 + /**
  270 + * 保存地址数据
  271 + *
  272 + * @param int $uid 用户ID
  273 + * @param string $address 地址信息
  274 + * @param int $area_code 城市码
  275 + * @param string $consignee 收货人
  276 + * @param string $email 邮箱地址
  277 + * @param int $id 地址唯一标识符id
  278 + * @param string $mobile 手机号码
  279 + * @param string $zip_code 邮编
  280 + * @return array|mixed 处理之后的地址列表数据
  281 + */
  282 + public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code)
  283 + {
  284 + $result = array();
  285 +
  286 + // 参数验证
  287 + if (empty($uid)) {
  288 + $result['code'] = 400;
  289 + $result['message'] = '用户不可用';
  290 + } else if (empty($address)) {
  291 + $result['code'] = 401;
  292 + $result['message'] = '请输入可用的地址信息';
  293 + } else if (empty($area_code)) {
  294 + $result['code'] = 402;
  295 + $result['message'] = '地区码不可用';
  296 + } else if (empty($consignee)) {
  297 + $result['code'] = 403;
  298 + $result['message'] = '请输入收件人姓名';
  299 + } else if (!empty($email) && Helpers::verifyEmail($email)) {
  300 + $result['code'] = 404;
  301 + $result['message'] = '输入的邮箱地址格式不正确';
  302 + } else if (!empty($mobile) && Helpers::verifyMobile($mobile)) {
  303 + $result['code'] = 404;
  304 + $result['message'] = '输入的手机号码格式不正确';
  305 + } else {
  306 + // 调用接口保存地址数据
  307 + $address = UserData::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
  308 + // 处理返回结果
  309 + if (isset($address['code']) && $address['code'] == 200) {
  310 + $result = $address['data'];
  311 + }
  312 + }
  313 +
  314 + return $result;
  315 + }
  316 +
  317 + /**
  318 + * 设置默认地址
  319 + *
  320 + * @param int $uid 用户ID
  321 + * @param int $id 地址唯一标识符id
  322 + * @return array|mixed 处理之后的返回数据
  323 + */
  324 + public static function setDefaultAddress($uid, $id)
  325 + {
  326 + $result = array('code' => 400, 'message' => '错误');
  327 +
  328 + // 调用接口设置默认地址
  329 + $address = UserData::setDefaultAddress($uid, $id);
  330 + // 处理返回结果
  331 + if ($address && isset($address['code'])) {
  332 + $result = $address;
  333 + }
  334 +
  335 + return $result;
  336 + }
  337 +
  338 + /**
249 * 处理意见反馈数据 339 * 处理意见反馈数据
250 * 340 *
251 * @param string $udid 客户端唯一标识 341 * @param string $udid 客户端唯一标识
@@ -227,19 +227,30 @@ class NewsaleModel @@ -227,19 +227,30 @@ class NewsaleModel
227 return $result; 227 return $result;
228 } 228 }
229 229
230 - /**  
231 - * 筛选出来的热销排行榜商品数据处理  
232 - *  
233 - * @param array $data 筛选出来的原数据  
234 - * @return array 处理之后的数据  
235 - */  
236 - public static function selectTopData($data) 230 + /**
  231 + * 筛选出来的热销排行榜商品数据处理
  232 + *
  233 + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  234 + * @param string|null $sort 品类ID查询参数
  235 + * @param integer|null $tab_id Tab的ID
  236 + * @param boolean $notab 时候返回顶部tab的数据,默认返回
  237 + * @param integer $limit 查询返回的最大限制数, 默认为50
  238 + * @param integer $page 分页第几页, 默认第1页
  239 + * @return array 处理之后的数据
  240 + */
  241 + public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
237 { 242 {
238 $result = array(); 243 $result = array();
239 244
  245 + $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
  246 +
240 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { 247 if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
241 $result = NewSaleProcess::newSaleData($data['data']); 248 $result = NewSaleProcess::newSaleData($data['data']);
242 unset($result['filter']); 249 unset($result['filter']);
  250 +
  251 + if ($notab) {
  252 + unset($result['tabs']);
  253 + }
243 } 254 }
244 255
245 return $result; 256 return $result;
@@ -42,7 +42,7 @@ class OnlineModel @@ -42,7 +42,7 @@ class OnlineModel
42 foreach ($sub as $sk => $sv) 42 foreach ($sub as $sk => $sv)
43 { 43 {
44 $qTmp[$sk]['title'] = $sv['category_name']; 44 $qTmp[$sk]['title'] = $sv['category_name'];
45 - $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id']; 45 + $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name'];
46 } 46 }
47 } 47 }
48 $question[$key]['list'] = $qTmp; 48 $question[$key]['list'] = $qTmp;
@@ -106,12 +106,11 @@ class NewsaleController extends AbstractAction @@ -106,12 +106,11 @@ class NewsaleController extends AbstractAction
106 $tab_id = $this->get('tab_id', null); 106 $tab_id = $this->get('tab_id', null);
107 $limit = $this->get('limit', 50); 107 $limit = $this->get('limit', 50);
108 $page = $this->get('page', 1); 108 $page = $this->get('page', 1);
  109 + $notab = (boolean)$this->get('notab', false);
109 110
110 // 获取性别 111 // 获取性别
111 $gender = Helpers::getGenderByCookie(); 112 $gender = Helpers::getGenderByCookie();
112 -  
113 - $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);  
114 - $result = \Product\NewsaleModel::selectTopData($data); 113 + $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
115 } 114 }
116 115
117 if (empty($result)) { 116 if (empty($result)) {