Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
uedxwg
9 years ago
Commit
9fba9ed63bd84b0974ce60dad8405b4f6eb70ef2
2 parents
abb19bfb
497b0559
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
368 additions
and
251 deletions
docs/data-structure.md
library/LibModels/Wap/Home/CartData.php
static/js/me/index.js
static/js/product/detail/like.js
static/js/product/recommend-for-you.js
static/sass/index.scss
static/sass/me/_home.scss
static/sass/product/_comments-consults.scss
static/sass/product/_detail.scss
static/sass/product/_product-description.scss
static/sass/product/_recommend-for-you.scss
template/m.yohobuy.com/actions/index/home/index.phtml
template/m.yohobuy.com/actions/product/detail/consults.phtml
template/m.yohobuy.com/actions/product/detail/index.phtml
template/m.yohobuy.com/partials/layout/use.phtml
template/m.yohobuy.com/partials/product/feedback-tab.phtml
template/m.yohobuy.com/partials/product/product-description.phtml
template/m.yohobuy.com/partials/product/recommend-content.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/home/Online.php → yohobuy/m.yohobuy.com/application/models/Home/Online.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
docs/data-structure.md
View file @
9fba9ed
...
...
@@ -1243,6 +1243,6 @@
'cartInfo' : {
'numInCart' : 3,
'goodsInstore' : 0,
'isCollect':true
'isCollect':true
//
}
}
...
...
library/LibModels/Wap/Home/CartData.php
View file @
9fba9ed
...
...
@@ -51,17 +51,17 @@ class CartData
}
/**
*
修改购物车商品数据
*
移入收藏夹
*
* @param int $uid 用户ID
* @param string $s
wapData 商品数据
* @param string $s
ku 商品sku列表
* @return array 接口返回的数据
*/
public
static
function
modifyCartProduct
(
$uid
,
$swapData
)
public
static
function
addToFav
(
$uid
,
$sku
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.swap'
;
$param
[
'swap_data'
]
=
$swapData
;
$param
[
'method'
]
=
'app.Shopping.addfavorite'
;
$param
[
'product_sku_list'
]
=
$sku
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
...
...
@@ -69,17 +69,35 @@ class CartData
}
/**
*
移入收藏夹
*
获取购物车商品数据
*
* @param int $uid 用户ID
* @param
string $sku 商品sku列表
* @param
int $skn 商品skn
* @return array 接口返回的数据
*/
public
static
function
addToFav
(
$uid
,
$sku
)
public
static
function
cartProductData
(
$uid
,
$skn
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.addfavorite'
;
$param
[
'product_sku_list'
]
=
$sku
;
$param
[
'method'
]
=
'app.product.data'
;
$param
[
'product_skn'
]
=
$skn
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
* @param string $swapData 商品数据
* @return array 接口返回的数据
*/
public
static
function
modifyCartProduct
(
$uid
,
$swapData
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.swap'
;
$param
[
'swap_data'
]
=
$swapData
;
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
...
...
static/js/me/index.js
View file @
9fba9ed
...
...
@@ -9,6 +9,8 @@ var $userAvatar = $('.user-avatar'),
var
myImage
=
new
Image
();
require
(
'../product/recommend-for-you.js'
);
require
(
'../product/suspend-cart.js'
);
myImage
.
src
=
$userAvatar
.
attr
(
'src'
);
myImage
.
onerror
=
function
()
{
$userAvatar
.
attr
(
'src'
,
'http://static.dev.yohobuy.com/img/me/index/user-avatar.png'
);
...
...
static/js/product/detail/like.js
View file @
9fba9ed
...
...
@@ -12,6 +12,7 @@ var likeHammer = new Hammer(document.getElementById('likeBtn'));
likeHammer
.
on
(
'tap'
,
function
(
e
)
{
var
productId
=
$
(
'#productId'
).
val
(),
opt
;
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'liked'
))
{
...
...
static/js/product/recommend-for-you.js
View file @
9fba9ed
...
...
@@ -17,7 +17,7 @@ $.get('/home/preference').then(function(html) {
recommendSwiper
=
new
Swiper
(
'#swiper-recommend'
,
{
slidesPerView
:
'auto'
,
grabCursor
:
true
,
slideElement
:
'
li
'
,
slideElement
:
'
a
'
,
lazyLoading
:
true
,
watchSlidesVisibility
:
true
});
...
...
static/sass/index.scss
View file @
9fba9ed
...
...
@@ -102,6 +102,7 @@ a {
color
:
#fff
;
font-size
:
18px
;
border
:
none
;
z-index
:
2
;
@include
border-radius
(
10px
);
}
...
...
static/sass/me/_home.scss
View file @
9fba9ed
...
...
@@ -28,7 +28,12 @@
}
.username
{
float
:
left
;
padding
:
0
pxToRem
(
16px
);
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
max-width
:
pxToRem
(
290px
);
}
.vip-icon
{
...
...
static/sass/product/_comments-consults.scss
View file @
9fba9ed
.goods-comments-page
{
.goods-comments
{
.comment-item
{
border
:
1px
solid
$borderC
;
border
-bottom
:
1px
solid
$borderC
;
padding
:
0
pxToRem
(
28px
);
.user-name
{
font-size
:
pxToRem
(
24px
);
...
...
@@ -44,7 +44,8 @@
height
:
pxToRem
(
120px
);
background-color
:
#ffffff
;
i
,
span
{
span
,
a
{
line-height
:
pxToRem
(
120px
);
font-size
:
pxToRem
(
28px
);
color
:
$mainFontC
;
...
...
static/sass/product/_detail.scss
View file @
9fba9ed
...
...
@@ -30,50 +30,52 @@ $basicBtnC:#eb0313;
left
:
pxToRem
(
30px
);
right
:
auto
;
}
.tag-container
{
.tag-container
{
position
:
absolute
;
left
:
pxToRem
(
108px
);
top
:
pxToRem
(
40px
);
height
:
pxToRem
(
35px
);
// width: pxToRem(70px);
color
:
#fff
;
font-size
:
pxToRem
(
20px
);
line-height
:
pxToRem
(
35px
);
z-index
:
2
;
.good-tag
{
display
:
inline-block
;
box-sizing
:
border-box
;
margin-left
:
.5px
;
font-size
:
pxToRem
(
23px
);
text-align
:
center
;
line-height
:
pxToRem
(
35px
);
padding
:
0
8px
;
}
.new-tag
{
background-color
:
#78dc7e
;
color
:
#fff
;
}
.renew-tag
{
background-color
:
#78dc7e
;
color
:
#fff
;
}
.sale-tag
{
background-color
:
#ff575c
;
color
:
#fff
;
}
.new-festival-tag
{
background-color
:
#000
;
color
:
#fff
;
}
.limit-tag
{
border
:
1px
solid
#000
;
color
:
#000
;
}
.soonSoldOut-tag
{
background-color
:
#ffac5b
;
color
:
#fff
;
}
// width: pxToRem(70px);
color
:
#fff
;
font-size
:
pxToRem
(
20px
);
line-height
:
pxToRem
(
35px
);
z-index
:
2
;
.good-tag
{
display
:
inline-block
;
box-sizing
:
border-box
;
margin-left
:
.5px
;
font-size
:
pxToRem
(
23px
);
text-align
:
center
;
line-height
:
pxToRem
(
35px
);
padding
:
0
8px
;
}
.new-tag
{
background-color
:
#78dc7e
;
color
:
#fff
;
}
.renew-tag
{
background-color
:
#78dc7e
;
color
:
#fff
;
}
.sale-tag
{
background-color
:
#ff575c
;
color
:
#fff
;
}
.new-festival-tag
{
background-color
:
#000
;
color
:
#fff
;
}
.limit-tag
{
border
:
1px
solid
#000
;
color
:
#000
;
}
.soonSoldOut-tag
{
background-color
:
#ffac5b
;
color
:
#fff
;
}
}
.good-detail-page
{
overflow
:
hidden
;
background-color
:
#f0f0f0
;
...
...
@@ -104,16 +106,16 @@ $basicBtnC:#eb0313;
width
:
100%
;
// .row {
// display: table-row;
.column
{
box-sizing
:border-box
;
display
:
table-cell
;
padding
:
pxToRem
(
16px
)
pxToRem
(
12px
);
width
:
50%
;
border
:
1px
solid
#fff
;
font-size
:
pxToRem
(
24px
);
background-color
:
$tableCellC
;
float
:left
;
}
.column
{
box-sizing
:
border-box
;
display
:
table-cell
;
padding
:
pxToRem
(
16px
)
pxToRem
(
12px
);
width
:
50%
;
border
:
1px
solid
#fff
;
font-size
:
pxToRem
(
24px
);
background-color
:
$tableCellC
;
float
:
left
;
}
// }
}
}
...
...
@@ -136,15 +138,15 @@ $basicBtnC:#eb0313;
position
:
absolute
;
z-index
:
2
;
bottom
:
pxToRem
(
40px
);
.pagination-inner
{
span
{
.pagination-inner
{
span
{
background-color
:
#b0b0b0
;
}
.swiper-pagination-bullet
{
margin-right
:
2px
;
}
.swiper-pagination-bullet-active
{
background-color
:
#000
;
background-color
:
#000
;
}
}
}
...
...
@@ -227,8 +229,45 @@ $basicBtnC:#eb0313;
vertical-align
:
middle
;
}
}
.vip-level
{
box-sizing
:
box-border
;
padding-left
:
pxToRem
(
28px
);
padding-right
:
pxToRem
(
28px
);
min-height
:
pxToRem
(
88px
);
background-color
:
#fff
;
.icons-item
{
float
:
left
;
width
:
33
.3%
;
height
:
pxToRem
(
88px
);
span
{
display
:
inline-block
;
line-height
:
pxToRem
(
88px
);
}
.vip-img
{
padding-right
:
pxToRem
(
22px
);
.img
{
width
:
pxToRem
(
53px
);
height
:
pxToRem
(
32px
);
}
&
:nth-child
(
3n-3
)
.img
{
background
:
image-url
(
'product/silver.png'
)
no-repeat
;
}
&
:nth-child
(
3n-2
)
.img
{
background
:
image-url
(
'product/golden.png'
)
no-repeat
;
}
&
:nth-child
(
3n-1
)
.img
{
background
:
image-url
(
'product/platinum.png'
)
no-repeat
;
}
}
&
:first-child
{
float
:
left
;
}
&
:last-child
{
float
:
right
;
}
}
}
.vipLevel
{
width
:
100%
;
box-sizing
:
border-box
;
background-color
:
#fff
;
display
:
table
;
...
...
@@ -242,25 +281,24 @@ $basicBtnC:#eb0313;
display
:
table-cell
;
vertical-align
:
middle
;
}
.vip-img
{
.vip-img
{
padding-right
:
pxToRem
(
22px
);
.img
{
width
:
pxToRem
(
52px
);
height
:
pxToRem
(
32px
);
.img
{
width
:
pxToRem
(
53px
);
height
:
pxToRem
(
33px
);
}
&
:nth-child
(
3n-3
)
.img
{
&
:nth-child
(
3n-3
)
.img
{
background
:
image-url
(
'product/silver.png'
)
no-repeat
;
}
&
:nth-child
(
3n-2
)
.img
{
&
:nth-child
(
3n-2
)
.img
{
background
:
image-url
(
'product/golden.png'
)
no-repeat
;
}
&
:nth-child
(
3n-1
)
.img
{
&
:nth-child
(
3n-1
)
.img
{
background
:
image-url
(
'product/platinum.png'
)
no-repeat
;
}
}
.vip-price
{
padding-right
:
pxToRem
(
5
5
px
);
padding-right
:
pxToRem
(
5
2
px
);
}
.vip-price
:last-child
{
padding-right
:
0
;
...
...
@@ -295,7 +333,6 @@ $basicBtnC:#eb0313;
.goodsDiscount
{
text-indent
:
pxToRem
(
-14px
);
}
.enter-store
{
min-height
:
pxToRem
(
100px
);
display
:
table
;
...
...
@@ -327,7 +364,6 @@ $basicBtnC:#eb0313;
}
}
}
//底部固定栏
.cart-bar
{
position
:
relative
;
...
...
@@ -350,10 +386,10 @@ $basicBtnC:#eb0313;
font-size
:
pxToRem
(
34px
);
color
:
#ccc
}
&
.favorite.liked
{
color
:
$basicBtnC
;;
&
.favorite.liked
{
color
:
$basicBtnC
;
;
}
&
.addto-cart
,
&
.sold-out
{
height
:
pxToRem
(
80px
);
...
...
@@ -382,10 +418,10 @@ $basicBtnC:#eb0313;
font-size
:
pxToRem
(
24px
);
}
}
.recommend-for-you
{
.recommend-for-you
{
margin-bottom
:
pxToRem
(
120px
);
}
}
@import
"comments-consults"
;
@import
"product-description"
;
\ No newline at end of file
@import
"product-description"
;
...
...
static/sass/product/_product-description.scss
View file @
9fba9ed
.good-detail-page
{
.goods-desc
{
.service
{
width
:
pxToRem
(
4
89
px
);
width
:
pxToRem
(
4
94
px
);
height
:
pxToRem
(
28px
);
margin-top
:
pxToRem
(
22px
);
margin-left
:
pxToRem
(
40px
);
background
:
image-url
(
'product/service.png'
)
no-repeat
;
background-size
:
cover
;
}
.detail
{
background-color
:
$tableCellC
;
...
...
static/sass/product/_recommend-for-you.scss
View file @
9fba9ed
...
...
@@ -58,7 +58,7 @@
.old-price
{
position
:
absolute
;
top
:
0
;
right
:
pxToRem
(
-
6
px
);
right
:
pxToRem
(
-
4
px
);
color
:
#b0b0b0
;
text-decoration
:
line-through
;
}
...
...
template/m.yohobuy.com/actions/index/home/index.phtml
View file @
9fba9ed
...
...
@@ -101,8 +101,9 @@
</a>
</div>
{
{#isLogin
}
}
{
{>
product/recommend-for-you
}
}
{
{
/isLogin
}
}
{
{
>
product/suspend-cart
}
}
</div>
{
{>
layout/download_app
}
}
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/product/detail/consults.phtml
View file @
9fba9ed
...
...
@@ -3,7 +3,7 @@
<div
class=
"goto-consult"
>
<i
class=
"iconfont consult-logo"
>
639
;</i>
<span>我要咨询</span>
<
i
class=
"iconfont enter-consult-page"
>
604
;</i
>
<
a
href=
"/product/detail/consultform"
class=
"iconfont enter-consult-page"
>
604
;</a
>
</div>
{
{#
consults
}
}
<div
class=
"goods-consults"
>
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
9fba9ed
...
...
@@ -52,6 +52,19 @@
{
{/
periodOfMarket
}
}
</div>
<!--
{
{#
vipLevel
}
}
<ul
class=
"vip-level clearfix"
>
{
{#
list
}
}
<li
class=
"icons-item"
>
<span
class=
"vip-img"
>
<div
class=
"img"
alt=
""
style=
"background-size:cover;"
></div>
</span>
<span
class=
"vip-price"
>
{
{text
}
}</span>
</li>
{
{/
list
}
}
</ul>
{
{/vipLevel
}
}
-->
{
{#
vipLevel
}
}
<div
class=
"vipLevel"
>
{
{#
list
}
}
...
...
@@ -112,17 +125,14 @@
{
{#if
numInCart
}
}
<span
class=
"num-tag"
>
{
{numInCart
}
}</span>
{
{/if
}
}
<a
href=
""
class=
"num-incart iconfont"
>
62
c;</a>
<a
href=
"
/shoppingCart
"
class=
"num-incart iconfont"
>
62
c;</a>
{
{#if
goodsInstore
}
}
<a
href=
""
class=
"addto-cart "
>加入购物车</a>
<a
href=
"
/shoppingCart
"
class=
"addto-cart "
>加入购物车</a>
{
{else
}
}
<a
href=
""
class=
"sold-out"
>已售罄</a>
{
{/if
}
}
{
{#if
isCollect
}
}
<a
href=
"#"
id=
"likeBtn"
class=
"favorite iconfont liked"
>
605
;</a>
{
{else
}
}
<a
href=
""
id=
"likeBtn"
class=
"favorite iconfont"
>
605
;</a>
<a
href=
"javascript:;"
class=
"sold-out"
>已售罄</a>
{
{/if
}
}
<a
href=
"#"
id=
"likeBtn"
class=
"favorite iconfont {{#isCollect}}liked{{/isCollect}}"
>
605
;</a>
</div>
{
{/cartInfo
}
}
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
9fba9ed
...
...
@@ -166,7 +166,13 @@
{{!-- 商品详情评论 --}}
{{#if goodsCommentsPage}}
<script>
seajs.use('js/product/detail/comments-consults');
seajs.use('js/product/detail/loadmore');
</script>
{{/if}}
{{!-- 商品详情咨询 --}}
{{#if goodsConsultsPage}}
<script>
seajs.use('js/product/detail/loadmore');
</script>
{{/if}}
{{!-- 品类 --}}
...
...
@@ -210,6 +216,7 @@
{{#if myIndexPage}}
<script>
seajs.use('js/me/index');
seajs.use('js/index/footer');
</script>
{{/if}}
{{#if orderPage}}
...
...
template/m.yohobuy.com/partials/product/feedback-tab.phtml
View file @
9fba9ed
...
...
@@ -59,7 +59,7 @@
<span class="iconfont"></span>暂无咨询
</div>
<div class="consult-content-footer">
<a href="
{{link}}
">
<a href="
/consultform
">
我要咨询
<span class="iconfont"></span></a>
</div>
...
...
template/m.yohobuy.com/partials/product/product-description.phtml
View file @
9fba9ed
{
{#goodsDescription
}
}
<div
class=
"goods-desc page-block"
>
<
img
class=
"service lazy"
data-original=
"http://static.dev.yohobuy.com/img/product/service.png"
alt=
""
>
<
div
class=
"service"
></div
>
<h
1
class=
"title"
>
{
{title
}
}
<span
class=
"en-title"
>
{
{enTitle
}
}</span>
...
...
template/m.yohobuy.com/partials/product/recommend-content.phtml
View file @
9fba9ed
<div class="title">为您优选新品</div>
<div id="swiper-recommend" class="swiper-container">
<
ul
class="swiper-wrapper swiper-wrapper-recommend">
<
div
class="swiper-wrapper swiper-wrapper-recommend">
{{#recommendList}}
<
li class="swiper-slide
">
<
a class="swiper-slide" href="{{url}}
">
<img class="swiper-lazy img-box" data-src="{{thumb}}">
<div class="price">
<span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
{{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
</div>
<div class="swiper-lazy-preloader"></div>
</
li
>
</
a
>
{{/recommendList}}
</
ul
>
</
div
>
</div>
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
9fba9ed
...
...
@@ -51,6 +51,7 @@ class HomeController extends AbstractAction
$data
=
array
(
'myIndexPage'
=>
true
,
'showDownloadApp'
=>
true
,
'pageFooter'
=>
true
);
$uid
=
$this
->
getUid
();
...
...
@@ -323,7 +324,7 @@ class HomeController extends AbstractAction
$this
->
_view
->
display
(
'online-service'
,
array
(
'onlineServicePage'
=>
true
,
//
'pageFooter' => true,
'pageFooter'
=>
true
,
'service'
=>
$service
));
}
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
9fba9ed
...
...
@@ -231,54 +231,19 @@ class ShoppingCartController extends AbstractAction
public
function
goodinfoAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$data
=
array
(
'thumb'
=>
'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'黄伟文Wyman X y yohood 联名商品YYYOHOOD圆领卫衣'
,
'price'
=>
289
,
'salePrice'
=>
241
,
'colors'
=>
array
(
array
(
'id'
=>
1
,
'name'
=>
'黄色'
),
array
(
'id'
=>
2
,
'chosed'
=>
true
,
'name'
=>
'白色'
)
),
'sizes'
=>
array
(
array
(
'id'
=>
1
,
'name'
=>
'XS'
),
array
(
'id'
=>
2
,
'name'
=>
'S'
),
array
(
'id'
=>
3
,
'chosed'
=>
true
,
'name'
=>
'M'
),
array
(
'id'
=>
4
,
'name'
=>
'L'
),
array
(
'id'
=>
5
,
'name'
=>
'XL'
),
array
(
'id'
=>
6
,
'name'
=>
'XXL'
)
),
'num'
=>
1
);
$this
->
echoJson
(
array
(
'code'
=>
200
,
'data'
=>
$data
));
$num
=
$this
->
get
(
'buy_num'
,
1
);
$skn
=
$this
->
get
(
'id'
,
1
);
$result
=
CartModel
::
cartProductData
(
$this
->
_uid
,
$skn
,
$num
);
// 测试skn的ID为51172055
$result
[
'num'
]
=
$num
;
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
}
...
...
yohobuy/m.yohobuy.com/application/models/
h
ome/Online.php → yohobuy/m.yohobuy.com/application/models/
H
ome/Online.php
View file @
9fba9ed
<?php
namespace
Home
;
use
LibModels\Wap\Home\OnlineData
;
use
Plugin\Helpers
;
/**
* 在线客服相关数据处理
*/
class
OnlineModel
{
/*
* 获取在线帮助分类
* $clientType客户端类型
*/
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
//调用接口获取数据
$res
=
OnlineData
::
getOnlineServiceInfo
(
$clientType
);
$cateInfo
=
$res
[
'data'
];
$question
=
array
();
$tab
=
array
();
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
//强制截成3个tab
if
(
$key
>
2
)
{
break
;
}
$tab
[
$key
][
'tabid'
]
=
'tab'
.
$value
[
'id'
];
$tab
[
$key
][
'tabname'
]
=
$value
[
'category_name'
];
$tab
[
$key
][
'iscut'
]
=
true
;
$tab
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$question
[
$key
][
'name'
]
=
'tab'
.
$value
[
'id'
];
$question
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$sub
=
$value
[
'sub'
];
$qTmp
=
array
();
if
(
$sub
)
{
foreach
(
$sub
as
$sk
=>
$sv
)
{
$qTmp
[
$sk
][
'title'
]
=
$sv
[
'category_name'
];
$qTmp
[
$sk
][
'link'
]
=
Helpers
::
url
(
'/home/onlineservicedetail'
,
array
(
'cateId'
=>
$sv
[
'id'
],
'cateName'
=>
$sv
[
'category_name'
]));
}
}
$question
[
$key
][
'list'
]
=
$qTmp
;
}
$question
[
0
][
'current'
]
=
true
;
$tab
[
count
(
$tab
)
-
1
][
'iscut'
]
=
false
;
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'tab'
=>
$tab
,
'question'
=>
$question
);
return
$result
;
}
/*
* 加载分类下的问题和解决方法
* cateId问题分类ID
* clientType客户端
*/
public
static
function
getOnlineServiceDetail
(
$cateId
,
$clinetType
=
'iphone'
)
{
$result
=
array
();
if
(
!
$cateId
)
{
return
$result
;
}
$res
=
OnlineData
::
getOnlineServiceDetail
(
$cateId
,
$clinetType
);
$questionInfo
=
$res
[
'data'
];
if
(
$questionInfo
)
{
$list
=
array
();
if
(
$questionInfo
)
{
foreach
(
$questionInfo
as
$qk
=>
$qv
)
{
$list
[
$qk
][
'q'
]
=
$qv
[
'title'
];
$list
[
$qk
][
'a'
]
=
$qv
[
'content'
];
}
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'list'
=>
$list
);
}
return
$result
;
}
}
<?php
namespace
Home
;
use
LibModels\Wap\Home\OnlineData
;
use
Plugin\Helpers
;
/**
* 在线客服相关数据处理
*/
class
OnlineModel
{
/*
* 获取在线帮助分类
* $clientType客户端类型
*/
public
static
function
getOnlineServiceInfo
(
$clientType
=
'iphone'
)
{
//调用接口获取数据
$res
=
OnlineData
::
getOnlineServiceInfo
(
$clientType
);
$cateInfo
=
$res
[
'data'
];
$question
=
array
();
$tab
=
array
();
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
//强制截成3个tab
if
(
$key
>
2
)
{
break
;
}
$tab
[
$key
][
'tabid'
]
=
'tab'
.
$value
[
'id'
];
$tab
[
$key
][
'tabname'
]
=
$value
[
'category_name'
];
$tab
[
$key
][
'iscut'
]
=
true
;
$tab
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$question
[
$key
][
'name'
]
=
'tab'
.
$value
[
'id'
];
$question
[
$key
][
'current'
]
=
(
!
$key
)
?
TRUE
:
FALSE
;
$sub
=
$value
[
'sub'
];
$qTmp
=
array
();
if
(
$sub
)
{
foreach
(
$sub
as
$sk
=>
$sv
)
{
$qTmp
[
$sk
][
'title'
]
=
$sv
[
'category_name'
];
$qTmp
[
$sk
][
'link'
]
=
Helpers
::
url
(
'/home/onlineservicedetail'
,
array
(
'cateId'
=>
$sv
[
'id'
],
'cateName'
=>
$sv
[
'category_name'
]));
}
}
$question
[
$key
][
'list'
]
=
$qTmp
;
}
$question
[
0
][
'current'
]
=
true
;
$tab
[
count
(
$tab
)
-
1
][
'iscut'
]
=
false
;
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'tab'
=>
$tab
,
'question'
=>
$question
);
return
$result
;
}
/*
* 加载分类下的问题和解决方法
* cateId问题分类ID
* clientType客户端
*/
public
static
function
getOnlineServiceDetail
(
$cateId
,
$clinetType
=
'iphone'
)
{
$result
=
array
();
if
(
!
$cateId
)
{
return
$result
;
}
$res
=
OnlineData
::
getOnlineServiceDetail
(
$cateId
,
$clinetType
);
$questionInfo
=
$res
[
'data'
];
if
(
$questionInfo
)
{
$list
=
array
();
if
(
$questionInfo
)
{
foreach
(
$questionInfo
as
$qk
=>
$qv
)
{
$list
[
$qk
][
'q'
]
=
$qv
[
'title'
];
$list
[
$qk
][
'a'
]
=
$qv
[
'content'
];
}
}
//处理返回信息
$result
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'list'
=>
$list
);
}
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
9fba9ed
...
...
@@ -3,6 +3,7 @@
namespace
Index
;
use
LibModels\Wap\Home\CartData
;
use
Plugin\Helpers
;
use
Plugin\Images
;
/**
...
...
@@ -98,6 +99,70 @@ class CartModel
}
/**
* 处理购物车商品数据
*
* @param int $uid 用户ID
* @param int $skn 商品skn
* @param int $num 购买数目
* @return array 接口返回的数据
*/
public
static
function
cartProductData
(
$uid
,
$skn
,
$num
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
$product
=
CartData
::
cartProductData
(
$uid
,
$skn
);
if
(
isset
(
$product
[
'code'
])
&&
$product
[
'code'
]
===
200
)
{
$result
[
'code'
]
=
200
;
$data
=
array
();
$productData
=
$product
[
'data'
];
// 品牌信息
if
(
isset
(
$productData
[
'brand_info'
])
&&
!
empty
(
$productData
[
'brand_info'
]))
{
$data
[
'thumb'
]
=
Helpers
::
getImageUrl
(
$productData
[
'brand_info'
][
'brand_ico'
],
120
,
120
);
}
$data
[
'name'
]
=
$productData
[
'product_name'
];
$data
[
'price'
]
=
$productData
[
'market_price'
];
$data
[
'salePrice'
]
=
$productData
[
'sales_price'
];
$data
[
'storage'
]
=
$productData
[
'storage_sum'
];
$data
[
'num'
]
=
$num
;
// 商品选择
if
(
isset
(
$productData
[
'goods_list'
]))
{
$goodsList
=
$productData
[
'goods_list'
];
$colors
=
array
();
$oneColor
=
array
();
$sizes
=
array
();
$oneSize
=
array
();
foreach
(
$goodsList
as
$val
)
{
// 颜色
$oneColor
=
array
();
$oneColor
[
'id'
]
=
$val
[
'color_id'
];
$oneColor
[
'name'
]
=
$val
[
'color_name'
];
// 尺码
foreach
(
$val
[
'size_list'
]
as
$one
)
{
$oneSize
=
array
();
$oneSize
[
'id'
]
=
$one
[
'size_id'
];
$oneSize
[
'name'
]
=
$one
[
'size_name'
];
}
$sizes
[]
=
$oneSize
;
$oneColor
[
'sizes'
]
=
$sizes
;
$colors
[]
=
$oneColor
;
}
$data
[
'colors'
]
=
$colors
;
}
$result
[
'data'
]
=
$data
;
}
return
$result
;
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
...
...
@@ -135,6 +200,7 @@ class CartModel
// 购买的商品列表
foreach
(
$data
[
'goods_list'
]
as
$value
)
{
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
Images
::
getImageUrl
(
$value
[
'goods_images'
],
120
,
120
);
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
...
...
Please
register
or
login
to post a comment