Merge branch 'feature/wap323' into develop
Conflicts: library/LibModels/Wap/Product/DetailData.php
Showing
29 changed files
with
665 additions
and
53 deletions
@@ -31,6 +31,7 @@ class Yohobuy | @@ -31,6 +31,7 @@ class Yohobuy | ||
31 | 31 | ||
32 | // /* 测试环境 */ | 32 | // /* 测试环境 */ |
33 | // const API_URL = 'http://testapi.yoho.cn:28078/'; | 33 | // const API_URL = 'http://testapi.yoho.cn:28078/'; |
34 | +// const API_URL = 'http://192.168.102.205:8080/gateway/'; // 先临时使用网关 | ||
34 | // const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; | 35 | // const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; |
35 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 36 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
36 | // const API_OLD = 'http://test2.open.yohobuy.com/'; | 37 | // const API_OLD = 'http://test2.open.yohobuy.com/'; |
@@ -58,4 +58,6 @@ class CacheConfig | @@ -58,4 +58,6 @@ class CacheConfig | ||
58 | 58 | ||
59 | const KEY_INDEX_BRANDS_LIST_DATA = 'key_index_brands_list_data';//频道brands数据 | 59 | const KEY_INDEX_BRANDS_LIST_DATA = 'key_index_brands_list_data';//频道brands数据 |
60 | 60 | ||
61 | + const KEY_CODE_YOHOCOIN_BANNER = 'key_code_yohocoin_banner';// 有货币banner数据 | ||
62 | + | ||
61 | } | 63 | } |
@@ -198,11 +198,18 @@ class UserData | @@ -198,11 +198,18 @@ class UserData | ||
198 | */ | 198 | */ |
199 | public static function yohoCoinTotal($uid) | 199 | public static function yohoCoinTotal($uid) |
200 | { | 200 | { |
201 | - $param = Yohobuy::param(); | 201 | + /*$param = Yohobuy::param(); |
202 | $param['method'] = 'app.yohocoin.total'; | 202 | $param['method'] = 'app.yohocoin.total'; |
203 | $param['uid'] = $uid; | 203 | $param['uid'] = $uid; |
204 | $param['client_secret'] = Sign::getSign($param); | 204 | $param['client_secret'] = Sign::getSign($param); |
205 | 205 | ||
206 | + return Yohobuy::get(Yohobuy::API_URL, $param);*/ | ||
207 | + | ||
208 | + $param = Yohobuy::param(); | ||
209 | + $param['method'] = 'app.yoho.yohocoin'; | ||
210 | + $param['uid'] = $uid; | ||
211 | + $param['client_secret'] = Sign::getSign($param); | ||
212 | + | ||
206 | return Yohobuy::get(Yohobuy::API_URL, $param); | 213 | return Yohobuy::get(Yohobuy::API_URL, $param); |
207 | } | 214 | } |
208 | 215 |
@@ -64,16 +64,22 @@ class DetailData | @@ -64,16 +64,22 @@ class DetailData | ||
64 | /** | 64 | /** |
65 | * 咨询内容列表 | 65 | * 咨询内容列表 |
66 | * | 66 | * |
67 | + * @param int $uid 用户ID | ||
67 | * @param int $productId 产品ID | 68 | * @param int $productId 产品ID |
68 | * @param int $pageNum 页码数 | 69 | * @param int $pageNum 页码数 |
69 | * @param int $pageSize 每页显示个数 | 70 | * @param int $pageSize 每页显示个数 |
70 | * @return array | 71 | * @return array |
71 | */ | 72 | */ |
72 | - public static function consultList($productId, $pageNum, $pageSize) | 73 | + public static function consultList($uid, $productId, $pageNum, $pageSize) |
73 | { | 74 | { |
74 | $param = Yohobuy::param(); | 75 | $param = Yohobuy::param(); |
75 | - $param['method'] = 'h5.consult.li'; | 76 | + $param['method'] = 'app.consult.li'; |
76 | $param['product_id'] = $productId; | 77 | $param['product_id'] = $productId; |
78 | + | ||
79 | + if (!empty($uid)) { | ||
80 | + $param['uid'] = $uid; | ||
81 | + } | ||
82 | + | ||
77 | $param['page'] = $pageNum; | 83 | $param['page'] = $pageNum; |
78 | $param['limit'] = $pageSize; | 84 | $param['limit'] = $pageSize; |
79 | $param['client_secret'] = Sign::getSign($param); | 85 | $param['client_secret'] = Sign::getSign($param); |
@@ -154,4 +160,40 @@ class DetailData | @@ -154,4 +160,40 @@ class DetailData | ||
154 | return Yohobuy::get(Yohobuy::API_URL, $param); | 160 | return Yohobuy::get(Yohobuy::API_URL, $param); |
155 | } | 161 | } |
156 | 162 | ||
163 | + /** | ||
164 | + * 咨询点赞 | ||
165 | + * | ||
166 | + * @param int $uid 用户ID | ||
167 | + * @param int $id 咨询ID | ||
168 | + * @return array | ||
169 | + */ | ||
170 | + public static function upvoteConsult($uid, $id) | ||
171 | + { | ||
172 | + $param = Yohobuy::param(); | ||
173 | + $param['method'] = 'app.consult.like'; | ||
174 | + $param['id'] = $id; | ||
175 | + $param['uid'] = $uid; | ||
176 | + $param['client_secret'] = Sign::getSign($param); | ||
177 | + | ||
178 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * 咨询有用 | ||
183 | + * | ||
184 | + * @param int $uid 用户ID | ||
185 | + * @param int $id 咨询ID | ||
186 | + * @return array | ||
187 | + */ | ||
188 | + public static function usefulConsult($uid, $id) | ||
189 | + { | ||
190 | + $param = Yohobuy::param(); | ||
191 | + $param['method'] = 'app.consult.useful'; | ||
192 | + $param['id'] = $id; | ||
193 | + $param['uid'] = $uid; | ||
194 | + $param['client_secret'] = Sign::getSign($param); | ||
195 | + | ||
196 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
197 | + } | ||
198 | + | ||
157 | } | 199 | } |
@@ -208,7 +208,7 @@ class FloorProcess | @@ -208,7 +208,7 @@ class FloorProcess | ||
208 | foreach ($data['list'] as &$one) { | 208 | foreach ($data['list'] as &$one) { |
209 | if (isset($one['url'])) { | 209 | if (isset($one['url'])) { |
210 | $one['url'] = Helpers::getFilterUrl($one['url']); | 210 | $one['url'] = Helpers::getFilterUrl($one['url']); |
211 | - isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type]; | 211 | +// isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type]; |
212 | } | 212 | } |
213 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); | 213 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); |
214 | unset($one['src']); | 214 | unset($one['src']); |
@@ -273,7 +273,7 @@ class FloorProcess | @@ -273,7 +273,7 @@ class FloorProcess | ||
273 | isset(self::$channel[$type]) && $urlParam['gender'] = self::$channel[$type]; | 273 | isset(self::$channel[$type]) && $urlParam['gender'] = self::$channel[$type]; |
274 | $value['more_url'] = Helpers::url('', $urlParam, 'guang'); | 274 | $value['more_url'] = Helpers::url('', $urlParam, 'guang'); |
275 | } | 275 | } |
276 | - if ($key == 'list') { | 276 | + if ($key == 'list' && is_array($value)) { |
277 | foreach ($value as &$one) { | 277 | foreach ($value as &$one) { |
278 | if (isset($one['url'])) { | 278 | if (isset($one['url'])) { |
279 | $one['url'] = Helpers::getFilterUrl($one['url']); | 279 | $one['url'] = Helpers::getFilterUrl($one['url']); |
@@ -379,9 +379,6 @@ class FloorProcess | @@ -379,9 +379,6 @@ class FloorProcess | ||
379 | */ | 379 | */ |
380 | private static function small_pic($data, $type) | 380 | private static function small_pic($data, $type) |
381 | { | 381 | { |
382 | - // 按照以前业务操作,不显示 | ||
383 | - return array(); | ||
384 | - | ||
385 | $result = array(); | 382 | $result = array(); |
386 | 383 | ||
387 | foreach ($data as &$one) { | 384 | foreach ($data as &$one) { |
@@ -391,7 +388,9 @@ class FloorProcess | @@ -391,7 +388,9 @@ class FloorProcess | ||
391 | $one['img'] = Helpers::getImageUrl($one['src'], 98, 98); | 388 | $one['img'] = Helpers::getImageUrl($one['src'], 98, 98); |
392 | unset($one['src']); | 389 | unset($one['src']); |
393 | } | 390 | } |
394 | - $result['small_pic'] = $data; | 391 | + if (!empty($data)) { |
392 | + $result['smallPic']['list'] = $data; | ||
393 | + } | ||
395 | 394 | ||
396 | return $result; | 395 | return $result; |
397 | } | 396 | } |
@@ -13,6 +13,7 @@ var swiper, | @@ -13,6 +13,7 @@ var swiper, | ||
13 | $fixTitleBar, | 13 | $fixTitleBar, |
14 | $brandList = $('.brand-list'), | 14 | $brandList = $('.brand-list'), |
15 | $icon = $('.search-icon'), | 15 | $icon = $('.search-icon'), |
16 | + $genderItem = $('.genderNav li'), | ||
16 | hotBrandsSwiper; | 17 | hotBrandsSwiper; |
17 | 18 | ||
18 | var searchH = $('.newbrand-search').outerHeight(), | 19 | var searchH = $('.newbrand-search').outerHeight(), |
@@ -177,3 +178,11 @@ if ($('.brand-search-page').length) { | @@ -177,3 +178,11 @@ if ($('.brand-search-page').length) { | ||
177 | }); | 178 | }); |
178 | 179 | ||
179 | } | 180 | } |
181 | + | ||
182 | +if ($genderItem.length > 0) { | ||
183 | + $genderItem.on('touchstart', function() { | ||
184 | + $('.genderNav ul .active').removeClass('active'); | ||
185 | + $(this).addClass('active'); | ||
186 | + window.location.search = 'channel=' + ($(this).data('id') + 1); | ||
187 | + }); | ||
188 | +} |
@@ -4,40 +4,45 @@ | @@ -4,40 +4,45 @@ | ||
4 | * @date: 2015/10/12 | 4 | * @date: 2015/10/12 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var $ = require('jquery'), | 7 | +module.exports = function(specificGender) { |
8 | + var $ = require('jquery'), | ||
8 | Hammer = require('yoho.hammer'), | 9 | Hammer = require('yoho.hammer'), |
9 | tip = require('../plugin/tip'), | 10 | tip = require('../plugin/tip'), |
10 | loading = require('../plugin/loading'), | 11 | loading = require('../plugin/loading'), |
11 | lazyLoad = require('yoho.lazyload'); | 12 | lazyLoad = require('yoho.lazyload'); |
12 | 13 | ||
13 | -var navHammer, | 14 | + var navHammer, |
14 | winH = $(window).height(), | 15 | winH = $(window).height(), |
15 | $goodList = $('#goods-list'), | 16 | $goodList = $('#goods-list'), |
16 | searching = false, | 17 | searching = false, |
17 | page = 0, | 18 | page = 0, |
18 | gender = null, | 19 | gender = null, |
19 | - kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false, | ||
20 | - lifestyleType = $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false, | ||
21 | num, | 20 | num, |
22 | url; | 21 | url; |
23 | 22 | ||
24 | -var $curNav, | 23 | + //The kidsType can be specified by the parameter. Add by @ZhaoBiao |
24 | + var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, | ||
25 | + lifestyleType = specificGender === 'lifestyle' || | ||
26 | + $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false; | ||
27 | + | ||
28 | + var $curNav, | ||
25 | index, | 29 | index, |
26 | $navList = $('#maybe-like-nav'); | 30 | $navList = $('#maybe-like-nav'); |
27 | 31 | ||
28 | -//ajax url | ||
29 | -if (kidsType) { | 32 | + //ajax url |
33 | + if (kidsType) { | ||
30 | url = '/product/recom/maylikekids'; | 34 | url = '/product/recom/maylikekids'; |
31 | -} else if (lifestyleType) { | 35 | + } else if (lifestyleType) { |
32 | url = '/product/recom/maylikelife'; | 36 | url = '/product/recom/maylikelife'; |
33 | -} else { | ||
34 | - gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3', | 37 | + } else { |
38 | + gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? | ||
39 | + '1,3' : '2,3', | ||
35 | url = '/product/recom/maylike?gender=' + gender; | 40 | url = '/product/recom/maylike?gender=' + gender; |
36 | -} | 41 | + } |
37 | 42 | ||
38 | -$curNav = $navList.children('.focus'); | 43 | + $curNav = $navList.children('.focus'); |
39 | 44 | ||
40 | -if (lifestyleType) { | 45 | + if (lifestyleType) { |
41 | navHammer = new Hammer($navList[0]); | 46 | navHammer = new Hammer($navList[0]); |
42 | navHammer.on('tap', function(e) { | 47 | navHammer.on('tap', function(e) { |
43 | var $this = $(e.target).closest('li'), | 48 | var $this = $(e.target).closest('li'), |
@@ -63,11 +68,11 @@ if (lifestyleType) { | @@ -63,11 +68,11 @@ if (lifestyleType) { | ||
63 | $(document).trigger('scroll'); //Trigger lazyLoad | 68 | $(document).trigger('scroll'); //Trigger lazyLoad |
64 | e.srcEvent.stopPropagation(); | 69 | e.srcEvent.stopPropagation(); |
65 | }); | 70 | }); |
66 | -} | 71 | + } |
67 | 72 | ||
68 | -loading.init($('.maybe-like')); | 73 | + loading.init($('.maybe-like')); |
69 | 74 | ||
70 | -function search() { | 75 | + function search() { |
71 | if (searching) { | 76 | if (searching) { |
72 | return; | 77 | return; |
73 | } | 78 | } |
@@ -131,19 +136,25 @@ function search() { | @@ -131,19 +136,25 @@ function search() { | ||
131 | loading.hideLoadingMask(); | 136 | loading.hideLoadingMask(); |
132 | } | 137 | } |
133 | }); | 138 | }); |
134 | -} | 139 | + } |
135 | 140 | ||
136 | -$('.maybe-like p').on('touchstart', function(e) { | 141 | + $('.maybe-like p').on('touchstart', function(e) { |
137 | search(); | 142 | search(); |
138 | -}); | 143 | + }); |
139 | 144 | ||
140 | -function scrollHandler() { | 145 | + function scrollHandler() { |
141 | if ($(window).scrollTop() + winH >= $(document).height() - 200) { | 146 | if ($(window).scrollTop() + winH >= $(document).height() - 200) { |
142 | search(); | 147 | search(); |
143 | } | 148 | } |
144 | -} | 149 | + } |
145 | 150 | ||
146 | -//srcoll to load more | ||
147 | -$(window).scroll(function() { | 151 | + // 优惠券页面直接加载你可能喜欢。add by @zhaobiao |
152 | + if (specificGender) { | ||
153 | + search(); | ||
154 | + } | ||
155 | + | ||
156 | + //srcoll to load more | ||
157 | + $(window).scroll(function() { | ||
148 | window.requestAnimationFrame(scrollHandler); | 158 | window.requestAnimationFrame(scrollHandler); |
149 | -}); | ||
159 | + }); | ||
160 | +}; |
static/js/me/currency-new.js
0 → 100644
@@ -9,11 +9,18 @@ var $ = require('jquery'), | @@ -9,11 +9,18 @@ var $ = require('jquery'), | ||
9 | 9 | ||
10 | var commentsNum,consultsNum; | 10 | var commentsNum,consultsNum; |
11 | 11 | ||
12 | -var navtabEle = document.getElementById('nav-tab'), | 12 | +var consultFooterEle = $('.consult-content-footer')[0], |
13 | + consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle), | ||
14 | + | ||
15 | + navtabEle = document.getElementById('nav-tab'), | ||
13 | navtabHammer = navtabEle && new Hammer(navtabEle), | 16 | navtabHammer = navtabEle && new Hammer(navtabEle), |
14 | 17 | ||
15 | gotoConsultEle = document.getElementById('goto-consult'), | 18 | gotoConsultEle = document.getElementById('goto-consult'), |
16 | - gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle); | 19 | + gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle), |
20 | + | ||
21 | + readmore = document.getElementById('readmore'), | ||
22 | + readmoreHammer = readmore && new Hammer(readmore); | ||
23 | + | ||
17 | 24 | ||
18 | 25 | ||
19 | (function() { | 26 | (function() { |
@@ -63,6 +70,12 @@ if (navtabHammer) { | @@ -63,6 +70,12 @@ if (navtabHammer) { | ||
63 | }); | 70 | }); |
64 | } | 71 | } |
65 | 72 | ||
73 | +if (consultFooterHammer) { | ||
74 | + consultFooterHammer.on('tap', function() { | ||
75 | + location.href = $(consultFooterEle).data('href'); | ||
76 | + }); | ||
77 | +} | ||
78 | + | ||
66 | if (gotoConsultHammer) { | 79 | if (gotoConsultHammer) { |
67 | gotoConsultHammer.on('tap', function() { | 80 | gotoConsultHammer.on('tap', function() { |
68 | location.href = $(gotoConsultEle).find('a').attr('href'); | 81 | location.href = $(gotoConsultEle).find('a').attr('href'); |
@@ -74,3 +87,16 @@ if ($('.goods-consults-page').length > 0) { | @@ -74,3 +87,16 @@ if ($('.goods-consults-page').length > 0) { | ||
74 | $('#yoho-header').css('position', 'fixed').css('top', '0'); | 87 | $('#yoho-header').css('position', 'fixed').css('top', '0'); |
75 | } | 88 | } |
76 | 89 | ||
90 | +if ($('.goods-consults-page').length > 0) { | ||
91 | + $('#yoho-footer').css('border-top', '1px solid #e0e0e0'); | ||
92 | +} | ||
93 | + | ||
94 | +if (readmoreHammer) { | ||
95 | + readmoreHammer.on('tap', function() { | ||
96 | + $('.readmore').hide(); | ||
97 | + $('.goods-consults .consult-item').show(); | ||
98 | + return false; | ||
99 | + }); | ||
100 | +} | ||
101 | + | ||
102 | +require('./fav'); |
static/js/product/detail/fav.js
0 → 100755
1 | +/** | ||
2 | + * 商品详情咨询页 --点赞和帮助功能 | ||
3 | + * @author: Lynnic | ||
4 | + * @date: 2015/12/09 | ||
5 | + */ | ||
6 | + | ||
7 | + var $ = require('jquery'), | ||
8 | + Hammer = require('yoho.hammer'), | ||
9 | + tip = require('../../plugin/tip'); | ||
10 | + | ||
11 | +var goodsConsultsEle = $('#goods-consults')[0], | ||
12 | + goodsConsultsHammer = goodsConsultsEle && new Hammer(goodsConsultsEle); | ||
13 | + | ||
14 | +function showCountPlus($el) { | ||
15 | + var $count = $el.find('.animate-count'); | ||
16 | + | ||
17 | + $count.css('display', 'inline'); | ||
18 | + $count.animate({ | ||
19 | + opacity: 0.25, | ||
20 | + fontSize: '0.7rem', | ||
21 | + right: '-=5' | ||
22 | + }, 300, function() { | ||
23 | + $count.css('display', 'none'); | ||
24 | + }); | ||
25 | +} | ||
26 | + | ||
27 | +if (goodsConsultsHammer) { | ||
28 | + | ||
29 | + goodsConsultsHammer.on('tap', function(e) { | ||
30 | + | ||
31 | + var $this = $(e.target).closest('li'), | ||
32 | + id = $this.closest('.consult-item').data('id'), | ||
33 | + count = $this.find('.count').html() - 0, | ||
34 | + url; | ||
35 | + | ||
36 | + if (!$this.hasClass('highlight')) { | ||
37 | + | ||
38 | + if ($this.hasClass('fav')) { | ||
39 | + url = '/product/detail/consultupvote'; | ||
40 | + } else if ($this.hasClass('useful')) { | ||
41 | + url = '/product/detail/consultuseful'; | ||
42 | + } | ||
43 | + | ||
44 | + $.ajax({ | ||
45 | + method: 'post', | ||
46 | + url: url, | ||
47 | + data: { | ||
48 | + id: id | ||
49 | + } | ||
50 | + }).done(function(data) { | ||
51 | + if (data.code === 200) { | ||
52 | + showCountPlus($this); | ||
53 | + $this.addClass('highlight'); | ||
54 | + $this.find('.count').html(count + 1); | ||
55 | + } else if (data.code === 401) { | ||
56 | + location.href = data.data;//未登录跳转登录页 | ||
57 | + } | ||
58 | + }).fail(function(data) { | ||
59 | + tip.show('网络断开连接了~'); | ||
60 | + }); | ||
61 | + | ||
62 | + } | ||
63 | + }); | ||
64 | +} |
1 | .brand-page { | 1 | .brand-page { |
2 | + .re-pos-search { | ||
3 | + top: 170rem / $pxConvertRem !important; | ||
4 | + } | ||
5 | + .genderNav { | ||
6 | + display: block; | ||
7 | + width: 100%; | ||
8 | + height: 80rem / $pxConvertRem; | ||
9 | + line-height: 80rem / $pxConvertRem; | ||
10 | + overflow: hidden; | ||
11 | + color: #aeaeae; | ||
12 | + z-index: 3; | ||
13 | + position: fixed; | ||
14 | + top: 90rem / $pxConvertRem; | ||
15 | + border-bottom: 1px solid #e1e1e1; | ||
16 | + background-color: #fff; | ||
17 | + | ||
18 | + ul{ | ||
19 | + width: 100%; | ||
20 | + height: 90%; | ||
21 | + overflow: hidden; | ||
22 | + li{ | ||
23 | + width: 25%; | ||
24 | + height: 100%; | ||
25 | + overflow: hidden; | ||
26 | + float: left; | ||
27 | + text-align: center; | ||
28 | + position: relative; | ||
29 | + font-size: 28rem / $pxConvertRem; | ||
30 | + i{ | ||
31 | + width: 100%; | ||
32 | + height: 40%; | ||
33 | + overflow: hidden; | ||
34 | + display: block; | ||
35 | + } | ||
36 | + span:not(.split-border){ | ||
37 | + width: 100%; | ||
38 | + height: auto; | ||
39 | + overflow: hidden; | ||
40 | + display: block; | ||
41 | + //line-height: 40rem / $pxConvertRem; | ||
42 | + } | ||
43 | + | ||
44 | + .split-border { | ||
45 | + display: inline-block; | ||
46 | + width: 2px; | ||
47 | + height: 1rem; | ||
48 | + background-color: #e1e1e1; | ||
49 | + position: absolute; | ||
50 | + top: 30%; | ||
51 | + right: 0; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + li:last-child { | ||
56 | + .split-border { | ||
57 | + display: none; | ||
58 | + } | ||
59 | + } | ||
60 | + | ||
61 | + li.active { | ||
62 | + color: #444; | ||
63 | + } | ||
64 | + } | ||
65 | + } | ||
2 | .newbrand-search { | 66 | .newbrand-search { |
3 | width: 93.75%; | 67 | width: 93.75%; |
4 | height: 60rem / $pxConvertRem; | 68 | height: 60rem / $pxConvertRem; |
1 | @import "header-download", "banner-top","banner-center","banner-bottom", "side-nav", "floor-header", "hot-brands", "fine-brands", "creative-life", "plus-star", "maybe-like", | 1 | @import "header-download", "banner-top","banner-center","banner-bottom", "side-nav", "floor-header", "hot-brands", "fine-brands", "creative-life", "plus-star", "maybe-like", |
2 | "icons-enter","trendsetter-collocation", | 2 | "icons-enter","trendsetter-collocation", |
3 | -"trend-topics","goods-category","hot-brands", "hot-category", "home-header"; | 3 | +"trend-topics","goods-category","hot-brands", "hot-category", "home-header", "thumb-row"; |
4 | 4 | ||
5 | .mobile-container{ | 5 | .mobile-container{ |
6 | width: 100%; | 6 | width: 100%; |
static/sass/home/_thumb-row.scss
0 → 100644
1 | +#thumb-row { | ||
2 | + @include flexbox(( | ||
3 | + display: box, | ||
4 | + box-pack: justify | ||
5 | + ), $version: 1); | ||
6 | + @include flexbox(( | ||
7 | + display: flex, | ||
8 | + justify-content: space-around | ||
9 | + ), $version: 3); | ||
10 | + background-color: #f0f0f0; | ||
11 | + text-align: center; | ||
12 | + padding: 32rem/$pxConvertRem 14rem/$pxConvertRem 0; | ||
13 | + | ||
14 | + .thumb-row-box { | ||
15 | + display: inline-block; | ||
16 | + width: 275rem/$pxConvertRem; | ||
17 | + height: 160rem/$pxConvertRem; | ||
18 | + border-radius: 4px; | ||
19 | + background-size: 100%; | ||
20 | + background-repeat: no-repeat; | ||
21 | + background-position: center; | ||
22 | + } | ||
23 | +} |
@@ -55,6 +55,7 @@ | @@ -55,6 +55,7 @@ | ||
55 | height: pxToRem(120px); | 55 | height: pxToRem(120px); |
56 | background-color: #ffffff; | 56 | background-color: #ffffff; |
57 | border-bottom: 1px solid $borderC; | 57 | border-bottom: 1px solid $borderC; |
58 | + z-index: 10; | ||
58 | i, | 59 | i, |
59 | span, | 60 | span, |
60 | a { | 61 | a { |
@@ -73,12 +74,20 @@ | @@ -73,12 +74,20 @@ | ||
73 | .goods-consults { | 74 | .goods-consults { |
74 | margin-top: 5.25rem; | 75 | margin-top: 5.25rem; |
75 | overflow: hidden; | 76 | overflow: hidden; |
77 | + .consult-item:nth-child(1) { | ||
78 | + display: block; | ||
79 | + } | ||
80 | + .consult-item:nth-child(2) { | ||
81 | + display: block; | ||
82 | + } | ||
83 | + | ||
76 | .consult-item { | 84 | .consult-item { |
77 | margin-top: pxToRem(30px); | 85 | margin-top: pxToRem(30px); |
78 | padding: pxToRem(20px) pxToRem(28px); | 86 | padding: pxToRem(20px) pxToRem(28px); |
79 | background-color: #fff; | 87 | background-color: #fff; |
80 | border-bottom: 1px solid $borderC; | 88 | border-bottom: 1px solid $borderC; |
81 | border-top: 1px solid $borderC; | 89 | border-top: 1px solid $borderC; |
90 | + display:none; | ||
82 | .question { | 91 | .question { |
83 | font-size: pxToRem(24px); | 92 | font-size: pxToRem(24px); |
84 | color: $mainFontC; | 93 | color: $mainFontC; |
@@ -114,6 +123,84 @@ | @@ -114,6 +123,84 @@ | ||
114 | overflow: hidden; | 123 | overflow: hidden; |
115 | } | 124 | } |
116 | } | 125 | } |
126 | + .operation { | ||
127 | + width: 120%; | ||
128 | + height: pxToRem(60px); | ||
129 | + line-height: pxToRem(80px); | ||
130 | + position: relative; | ||
131 | + right: 12%; | ||
132 | + border-top: 1px solid #e0e0e0; | ||
133 | + margin-top: pxToRem(20px); | ||
134 | + | ||
135 | + li{ | ||
136 | + &.highlight{ | ||
137 | + color: $basicBtnC; | ||
138 | + } | ||
139 | + font-size:pxToRem(28px); | ||
140 | + float:left; | ||
141 | + width: 50%; | ||
142 | + text-align: center; | ||
143 | + color:$subFontC; | ||
144 | + .iconfont{ | ||
145 | + display: inline-block; | ||
146 | + padding-right: 5px; | ||
147 | + font-size: inherit; | ||
148 | + } | ||
149 | + position: relative; | ||
150 | + .animate-count { | ||
151 | + display: none; | ||
152 | + position: absolute; | ||
153 | + top: 0; | ||
154 | + font-size: pxToRem(20px); | ||
155 | + z-index: 5; | ||
156 | + } | ||
157 | + i.count { | ||
158 | + position: absolute; | ||
159 | + } | ||
160 | + } | ||
161 | + li.fav { | ||
162 | + .animate-count { | ||
163 | + right: pxToRem(100px); | ||
164 | + } | ||
165 | + } | ||
166 | + | ||
167 | + li.useful { | ||
168 | + .animate-count { | ||
169 | + right: pxToRem(88px); | ||
170 | + } | ||
171 | + } | ||
172 | + } | ||
173 | + | ||
174 | + | ||
175 | + } | ||
176 | + } | ||
177 | + .readmore{ | ||
178 | + display: block; | ||
179 | + height: pxToRem(88px); | ||
180 | + line-height: pxToRem(88px); | ||
181 | + background-color: #fff; | ||
182 | + text-align: center; | ||
183 | + color: $subFontC; | ||
184 | + margin-top: pxToRem(30px); | ||
185 | + border-top: 1px solid $borderC; | ||
186 | + border-bottom: 1px solid $borderC; | ||
187 | + font-size: pxToRem(28px); | ||
188 | + i{ | ||
189 | + font-size: inherit; | ||
190 | + } | ||
191 | + } | ||
192 | + .faq-title{ | ||
193 | + height: pxToRem(88px); | ||
194 | + line-height: pxToRem(88px); | ||
195 | + text-align: center; | ||
196 | + font-size: pxToRem(32px); | ||
197 | + } | ||
198 | + .goods-consults .faq-item{ | ||
199 | + @extend .consult-item; | ||
200 | + margin-top: 0; | ||
201 | + margin-bottom: pxToRem(30px); | ||
202 | + .answer{ | ||
203 | + border-bottom: none; | ||
117 | } | 204 | } |
118 | } | 205 | } |
119 | // .gap-block { | 206 | // .gap-block { |
@@ -174,6 +261,9 @@ | @@ -174,6 +261,9 @@ | ||
174 | &.focus { | 261 | &.focus { |
175 | color: #000; | 262 | color: #000; |
176 | } | 263 | } |
264 | + .comments-num { | ||
265 | + display: none; | ||
266 | + } | ||
177 | } | 267 | } |
178 | .comment-nav { | 268 | .comment-nav { |
179 | border-right: 1px solid #ccc; | 269 | border-right: 1px solid #ccc; |
@@ -2,7 +2,18 @@ | @@ -2,7 +2,18 @@ | ||
2 | <div class="brand-page yoho-page"> | 2 | <div class="brand-page yoho-page"> |
3 | {{# channel}} | 3 | {{# channel}} |
4 | 4 | ||
5 | - <div class="newbrand-search"> | 5 | + <div class="genderNav"> |
6 | + <ul> | ||
7 | + {{# channels}} | ||
8 | + <li {{#if active}}class="active"{{/if}} data-id="{{@index}}"> | ||
9 | + <span>{{name}}</span> | ||
10 | + <span class="split-border"></span> | ||
11 | + </li> | ||
12 | + {{/channels}} | ||
13 | + </ul> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="newbrand-search re-pos-search"> | ||
6 | <div class="search-box clearfix"> | 17 | <div class="search-box clearfix"> |
7 | <a href="{{searchUrl}}" > | 18 | <a href="{{searchUrl}}" > |
8 | <input type="text" class="search-input" placeholder="查找品牌" readonly="true"> | 19 | <input type="text" class="search-input" placeholder="查找品牌" readonly="true"> |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | <div class="yoho-coin-new-page yoho-page"> | 2 | <div class="yoho-coin-new-page yoho-page"> |
3 | <div class="coin"> | 3 | <div class="coin"> |
4 | + {{# yohoCoin}} | ||
4 | <p class="coin-num"> | 5 | <p class="coin-num"> |
5 | - 7876 | 6 | + {{coinNum}} |
6 | </p> | 7 | </p> |
7 | <p class="info"> | 8 | <p class="info"> |
8 | <span class="dollar"></span> | 9 | <span class="dollar"></span> |
9 | 个 YOHO 币 | 10 | 个 YOHO 币 |
10 | </p> | 11 | </p> |
11 | - <a href="" class="more">查看明细</a> | 12 | + <a href="/home/currencyDetail" class="more">查看明细</a> |
13 | + {{#if notice}} | ||
12 | <div class="coin-tip"> | 14 | <div class="coin-tip"> |
13 | <span class="icon">!</span> | 15 | <span class="icon">!</span> |
14 | - 您有300个YOHO币即将于2017年12月31日过期,请尽快使用 | 16 | + {{notice}} |
15 | </div> | 17 | </div> |
18 | + {{/if}} | ||
19 | + {{/ yohoCoin}} | ||
16 | </div> | 20 | </div> |
17 | <div class="banner"> | 21 | <div class="banner"> |
18 | - <a href=""> | 22 | + {{#banner}} |
23 | + <a href="{{url}}"> | ||
19 | {{!-- 演示图片 --}} | 24 | {{!-- 演示图片 --}} |
20 | - <img src="http://temp.im/640x200" alt=""> | 25 | + <img src="{{img}}" alt="img"> |
21 | </a> | 26 | </a> |
27 | + {{/banner}} | ||
22 | </div> | 28 | </div> |
23 | 29 | ||
24 | {{> home/maybe_like}} | 30 | {{> home/maybe_like}} |
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | 优惠券 | 81 | 优惠券 |
82 | <span class="iconfont num">{{coupon_num}} </span> | 82 | <span class="iconfont num">{{coupon_num}} </span> |
83 | </a> | 83 | </a> |
84 | - <a class="list-item" href="/home/currencyDetail"> | 84 | + <a class="list-item" href="/home/currency"> |
85 | <span class="iconfont icon"></span> | 85 | <span class="iconfont icon"></span> |
86 | YOHO 币 | 86 | YOHO 币 |
87 | <span class="iconfont num">{{yoho_coin_num}} </span> | 87 | <span class="iconfont num">{{yoho_coin_num}} </span> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | {{# consults}} | 8 | {{# consults}} |
9 | <div class="goods-consults" id="goods-consults"> | 9 | <div class="goods-consults" id="goods-consults"> |
10 | {{#list}} | 10 | {{#list}} |
11 | - <div class="consult-item"> | 11 | + <div class="consult-item" data-id="{{id}}"> |
12 | <div class="question"> | 12 | <div class="question"> |
13 | <span class="iconfont"></span> | 13 | <span class="iconfont"></span> |
14 | <p> | 14 | <p> |
@@ -21,10 +21,57 @@ | @@ -21,10 +21,57 @@ | ||
21 | <span class="iconfont"></span> | 21 | <span class="iconfont"></span> |
22 | <p>{{answer}}</p> | 22 | <p>{{answer}}</p> |
23 | </div> | 23 | </div> |
24 | + | ||
25 | + <ul class="operation"> | ||
26 | + <li class="fav {{#if isLike}}highlight{{/if}}"> | ||
27 | + <i class="iconfont "></i> | ||
28 | + 赞 | ||
29 | + <i class="count">{{#if like}}{{like}}{{/if}}</i> | ||
30 | + <span class="animate-count">+1</span> | ||
31 | + </li> | ||
32 | + | ||
33 | + <li class="useful {{#if isUseful}}highlight{{/if}}"> | ||
34 | + <i class="iconfont "></i> | ||
35 | + 有用 | ||
36 | + <i class="count">{{#if useful}}{{useful}}{{/if}}</i> | ||
37 | + <span class="animate-count">+1</span> | ||
38 | + </li> | ||
39 | + </ul> | ||
40 | + | ||
24 | </div> | 41 | </div> |
25 | {{/list}} | 42 | {{/list}} |
26 | </div> | 43 | </div> |
27 | {{/ consults}} | 44 | {{/ consults}} |
28 | 45 | ||
46 | + {{#showReadMore}} | ||
47 | + <a href="javascript:;" id="readmore" class="readmore tap-hightlight" >查看更多 <i class="iconfont"></i></a> | ||
48 | + {{/showReadMore}} | ||
49 | + | ||
50 | + {{#faq}} | ||
51 | + <h1 class="faq-title"> | ||
52 | + 常见问题 | ||
53 | + </h1> | ||
54 | + {{/faq}} | ||
55 | + | ||
56 | + {{#faq}} | ||
57 | + <div class="goods-consults" style="margin-top:0"> | ||
58 | + {{#list}} | ||
59 | + <div class="faq-item"> | ||
60 | + <div class="question"> | ||
61 | + <span class="iconfont"></span> | ||
62 | + <p> | ||
63 | + {{question}} | ||
64 | + </p> | ||
65 | + </div> | ||
66 | + | ||
67 | + <div class="answer"> | ||
68 | + <span class="iconfont"></span> | ||
69 | + <p>{{answer}}</p> | ||
70 | + </div> | ||
71 | + </div> | ||
72 | + {{/list}} | ||
73 | + </div> | ||
74 | + {{/faq}} | ||
75 | + | ||
29 | </div> | 76 | </div> |
30 | {{> layout/footer}} | 77 | {{> layout/footer}} |
@@ -14,6 +14,11 @@ | @@ -14,6 +14,11 @@ | ||
14 | {{> home/banner}} | 14 | {{> home/banner}} |
15 | {{/ banner}} | 15 | {{/ banner}} |
16 | 16 | ||
17 | + {{! 两个小图}} | ||
18 | + {{# smallPic}} | ||
19 | + {{> home/thumb_row}} | ||
20 | + {{/ smallPic}} | ||
21 | + | ||
17 | {{! 热门品类}} | 22 | {{! 热门品类}} |
18 | {{# hotCategory}} | 23 | {{# hotCategory}} |
19 | {{> home/hot_category}} | 24 | {{> home/hot_category}} |
@@ -261,9 +261,12 @@ class HomeController extends AbstractAction | @@ -261,9 +261,12 @@ class HomeController extends AbstractAction | ||
261 | $this->setNavHeader('YOHO币', true, false); | 261 | $this->setNavHeader('YOHO币', true, false); |
262 | 262 | ||
263 | $currency = UserModel::getYohoCoinData($this->_uid); | 263 | $currency = UserModel::getYohoCoinData($this->_uid); |
264 | + // banenr数据 | ||
265 | + $currency['banner'] = UserModel::getYohoCoinBanner(); | ||
264 | $currency['pageFooter'] = true; | 266 | $currency['pageFooter'] = true; |
267 | + $currency['currencyPage'] = true; | ||
265 | 268 | ||
266 | - $this->_view->display('currency', $currency); | 269 | + $this->_view->display('currency-new', $currency); |
267 | } | 270 | } |
268 | 271 | ||
269 | /** | 272 | /** |
@@ -38,6 +38,24 @@ class BrandModel | @@ -38,6 +38,24 @@ class BrandModel | ||
38 | $result = array(); | 38 | $result = array(); |
39 | $brand = array(); | 39 | $brand = array(); |
40 | 40 | ||
41 | + // 设置品牌一览顶部频道导航 | ||
42 | + $channels = array( | ||
43 | + array( | ||
44 | + 'name' => 'Boy' | ||
45 | + ), | ||
46 | + array( | ||
47 | + 'name' => 'Girl' | ||
48 | + ), | ||
49 | + array( | ||
50 | + 'name' => 'Kid' | ||
51 | + ), | ||
52 | + array( | ||
53 | + 'name' => 'Lifestyle' | ||
54 | + ) | ||
55 | + ); | ||
56 | + $channels[$channel-1]['active'] = true; | ||
57 | + $result['channels'] = $channels; | ||
58 | + | ||
41 | /* 根据频道调用接口 */ | 59 | /* 根据频道调用接口 */ |
42 | switch (intval($channel)) { | 60 | switch (intval($channel)) { |
43 | case 1: // 男生 | 61 | case 1: // 男生 |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace Index; | 3 | namespace Index; |
4 | 4 | ||
5 | use Configs\CacheConfig; | 5 | use Configs\CacheConfig; |
6 | +use LibModels\Wap\Home\IndexData; | ||
6 | use LibModels\Wap\Home\UserData; | 7 | use LibModels\Wap\Home\UserData; |
7 | use Plugin\Cache; | 8 | use Plugin\Cache; |
8 | use Plugin\Helpers; | 9 | use Plugin\Helpers; |
@@ -18,6 +19,7 @@ use Plugin\Images; | @@ -18,6 +19,7 @@ use Plugin\Images; | ||
18 | */ | 19 | */ |
19 | class UserModel | 20 | class UserModel |
20 | { | 21 | { |
22 | + const CODE_YOHOCOIN_BANNER = '05afedf76886d732573f10f7451a1703'; | ||
21 | 23 | ||
22 | /** | 24 | /** |
23 | * 处理用户个人详情数据 | 25 | * 处理用户个人详情数据 |
@@ -358,14 +360,58 @@ class UserModel | @@ -358,14 +360,58 @@ class UserModel | ||
358 | */ | 360 | */ |
359 | public static function getYohoCoinData($uid) | 361 | public static function getYohoCoinData($uid) |
360 | { | 362 | { |
361 | - $result = array(); | 363 | + $result = array( |
364 | + 'yohoCoin' => array( | ||
365 | + 'coinNum' => 0 | ||
366 | + ) | ||
367 | + ); | ||
362 | 368 | ||
363 | // 调用接口获取YOHO币 | 369 | // 调用接口获取YOHO币 |
364 | $yohoCoin = UserData::yohoCoinTotal($uid); | 370 | $yohoCoin = UserData::yohoCoinTotal($uid); |
365 | 371 | ||
366 | // 处理YOHO币数据 | 372 | // 处理YOHO币数据 |
367 | if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) { | 373 | if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) { |
368 | - $result['yohoCoin']['coinNum'] = $yohoCoin['data']['total']; | 374 | + $result['yohoCoin']['coinNum'] = $yohoCoin['data']['yohocoin_num']; |
375 | + $result['yohoCoin']['notice'] = $yohoCoin['data']['notice']; | ||
376 | + } | ||
377 | + | ||
378 | + return $result; | ||
379 | + } | ||
380 | + | ||
381 | + public static function getYohoCoinBanner() | ||
382 | + { | ||
383 | + $result = false; | ||
384 | + | ||
385 | + if (USE_CACHE) { | ||
386 | + // 先尝试获取一级缓存(master), 有数据则直接返回. | ||
387 | + $result = Cache::get(CacheConfig::KEY_CODE_YOHOCOIN_BANNER, 'master'); | ||
388 | + if (!empty($result)) { | ||
389 | + return $result; | ||
390 | + } | ||
391 | + } | ||
392 | + | ||
393 | + // 调用接口获取数据 | ||
394 | + $banner = IndexData::getBannerStart(self::CODE_YOHOCOIN_BANNER); | ||
395 | + if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) { | ||
396 | + $result = array(); | ||
397 | + // 处理数据 | ||
398 | + foreach ($banner['data'] as $val) { | ||
399 | + foreach ($val['data'] as $single) { | ||
400 | + $result['url'] = ''; | ||
401 | + $result['img'] = Helpers::getImageUrl($single['src'], 640, 200); | ||
402 | + } | ||
403 | + } | ||
404 | + } | ||
405 | + | ||
406 | + if (USE_CACHE) { | ||
407 | + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | ||
408 | + if (empty($result)) { | ||
409 | + $result = Cache::get(CacheConfig::KEY_CODE_YOHOCOIN_BANNER, 'slave'); | ||
410 | + } | ||
411 | + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | ||
412 | + else { | ||
413 | + Cache::set(CacheConfig::KEY_CODE_YOHOCOIN_BANNER, $result); | ||
414 | + } | ||
369 | } | 415 | } |
370 | 416 | ||
371 | return $result; | 417 | return $result; |
@@ -550,23 +550,30 @@ class DetailModel | @@ -550,23 +550,30 @@ class DetailModel | ||
550 | /** | 550 | /** |
551 | * 获取咨询列表 | 551 | * 获取咨询列表 |
552 | * | 552 | * |
553 | + * @param int $uid 用户ID | ||
553 | * @param int $productId 产品ID | 554 | * @param int $productId 产品ID |
554 | * @param int $pageNum 页码数 | 555 | * @param int $pageNum 页码数 |
555 | * @param int $pageSize 每页显示个数 | 556 | * @param int $pageSize 每页显示个数 |
556 | * @return array | 557 | * @return array |
557 | */ | 558 | */ |
558 | - public static function getConsults($productId, $pageNum = 1, $pageSize = 300) | 559 | + public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 300) |
559 | { | 560 | { |
560 | $result = array(); | 561 | $result = array(); |
561 | 562 | ||
562 | if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { | 563 | if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { |
563 | - $consultList = DetailData::consultList($productId, $pageNum, $pageSize); | ||
564 | - if (!empty($consultList)) { | 564 | + $consultList = DetailData::consultList($uid, $productId, $pageNum, $pageSize); |
565 | + if (isset($consultList['code']) && $consultList['code'] === 200) { | ||
566 | + $consultList = $consultList['data']['list']; | ||
565 | $build = array(); | 567 | $build = array(); |
566 | foreach ($consultList as $value) { | 568 | foreach ($consultList as $value) { |
567 | $build['question'] = $value['ask']; | 569 | $build['question'] = $value['ask']; |
568 | - $build['time'] = $value['askTime']; | 570 | + $build['time'] = $value['ask_time']; |
569 | $build['answer'] = $value['answer']; | 571 | $build['answer'] = $value['answer']; |
572 | + $build['id'] = $value['id']; | ||
573 | + $build['isLike'] = $value['is_like'] === 'Y'; | ||
574 | + $build['like'] = $value['like']; | ||
575 | + $build['isUseful'] = $value['is_useful'] === 'Y'; | ||
576 | + $build['useful'] = $value['useful']; | ||
570 | $result[] = $build; | 577 | $result[] = $build; |
571 | } | 578 | } |
572 | } | 579 | } |
@@ -577,6 +584,70 @@ class DetailModel | @@ -577,6 +584,70 @@ class DetailModel | ||
577 | } | 584 | } |
578 | 585 | ||
579 | /** | 586 | /** |
587 | + * 咨询点赞 | ||
588 | + * | ||
589 | + * @param int $uid 用户ID | ||
590 | + * @param int $id 咨询ID | ||
591 | + * @param int $productId 商品ID | ||
592 | + * @return array | ||
593 | + */ | ||
594 | + public static function upvoteConsult($uid, $id, $productId) | ||
595 | + { | ||
596 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
597 | + | ||
598 | + do { | ||
599 | + $record = DetailData::upvoteConsult($uid, $id); | ||
600 | + | ||
601 | + if (empty($uid)) { | ||
602 | + $result['code'] = 401; | ||
603 | + $result['message'] = '用户id为空'; | ||
604 | + $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)))); | ||
605 | + break; | ||
606 | + } | ||
607 | + | ||
608 | + // 处理数据 | ||
609 | + if ($record && isset($record['code'])) { | ||
610 | + $result['code'] = $record['code']; | ||
611 | + $result['message'] = $record['message']; | ||
612 | + } | ||
613 | + }while(false); | ||
614 | + | ||
615 | + return $result; | ||
616 | + } | ||
617 | + | ||
618 | + /** | ||
619 | + * 咨询有用 | ||
620 | + * | ||
621 | + * @param int $uid 用户ID | ||
622 | + * @param int $id 咨询ID | ||
623 | + * @param int $productId 商品ID | ||
624 | + * @return array | ||
625 | + */ | ||
626 | + public static function usefulConsult($uid, $id, $productId) | ||
627 | + { | ||
628 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
629 | + | ||
630 | + do { | ||
631 | + $record = DetailData::usefulConsult($uid, $id); | ||
632 | + | ||
633 | + if (empty($uid)) { | ||
634 | + $result['code'] = 401; | ||
635 | + $result['message'] = '用户id为空'; | ||
636 | + $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)))); | ||
637 | + break; | ||
638 | + } | ||
639 | + | ||
640 | + // 处理数据 | ||
641 | + if ($record && isset($record['code'])) { | ||
642 | + $result['code'] = $record['code']; | ||
643 | + $result['message'] = $record['message']; | ||
644 | + } | ||
645 | + }while(false); | ||
646 | + | ||
647 | + return $result; | ||
648 | + } | ||
649 | + | ||
650 | + /** | ||
580 | * 获取为你优选的商品 | 651 | * 获取为你优选的商品 |
581 | * | 652 | * |
582 | * @param int $productSkn 商品SKN | 653 | * @param int $productSkn 商品SKN |
@@ -150,12 +150,15 @@ class DetailController extends AbstractAction | @@ -150,12 +150,15 @@ class DetailController extends AbstractAction | ||
150 | } | 150 | } |
151 | $this->setTitle('购买咨询'); | 151 | $this->setTitle('购买咨询'); |
152 | 152 | ||
153 | + $uid = $this->getUid(); | ||
154 | + $consults = \Product\DetailModel::getConsults($uid, $productId); | ||
153 | $data = array( | 155 | $data = array( |
154 | 'goodsConsultsPage' => true, | 156 | 'goodsConsultsPage' => true, |
155 | 'pageFooter' => true, | 157 | 'pageFooter' => true, |
156 | 'consults' => array( | 158 | 'consults' => array( |
157 | - 'list' => \Product\DetailModel::getConsults($productId), | 159 | + 'list' => $consults |
158 | ), | 160 | ), |
161 | + 'showReadMore' => count($consults) > 2, | ||
159 | 'link' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)), | 162 | 'link' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)), |
160 | ); | 163 | ); |
161 | 164 | ||
@@ -163,6 +166,40 @@ class DetailController extends AbstractAction | @@ -163,6 +166,40 @@ class DetailController extends AbstractAction | ||
163 | $this->_view->display('consults', $data); | 166 | $this->_view->display('consults', $data); |
164 | } | 167 | } |
165 | 168 | ||
169 | + /* | ||
170 | + * 咨询点赞 | ||
171 | + */ | ||
172 | + public function consultupvoteAction() | ||
173 | + { | ||
174 | + $result = array(); | ||
175 | + | ||
176 | + if ($this->isAjax()) { | ||
177 | + $productId = $this->get('product_id', 0); | ||
178 | + $uid = $this->getUid(); | ||
179 | + $id = $this->post('id'); | ||
180 | + $result = \Product\DetailModel::upvoteConsult($uid, $id, $productId); | ||
181 | + } | ||
182 | + | ||
183 | + $this->echoJson($result); | ||
184 | + } | ||
185 | + | ||
186 | + /* | ||
187 | + * 咨询有用 | ||
188 | + */ | ||
189 | + public function consultusefulAction() | ||
190 | + { | ||
191 | + $result = array(); | ||
192 | + | ||
193 | + if ($this->isAjax()) { | ||
194 | + $productId = $this->get('product_id', 0); | ||
195 | + $uid = $this->getUid(); | ||
196 | + $id = $this->post('id'); | ||
197 | + $result = \Product\DetailModel::usefulConsult($uid, $id, $productId); | ||
198 | + } | ||
199 | + | ||
200 | + $this->echoJson($result); | ||
201 | + } | ||
202 | + | ||
166 | /** | 203 | /** |
167 | * 我要咨询表单 | 204 | * 我要咨询表单 |
168 | */ | 205 | */ |
-
Please register or login to post a comment