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
Lynnic
9 years ago
Commit
251e35ef6eabf202c5355ddac500af6de9245aac
2 parents
a23c7add
6f677cad
Merge branch 'feature/cart' of git.dev.yoho.cn:web/yohobuy into feature/cart
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
259 additions
and
102 deletions
framework
library/LibModels/Wap/Home/CartData.php
static/js/shopping-cart/cart.js
static/js/shopping-cart/good.js
static/js/shopping-cart/order-ensure.js
static/js/shopping-cart/order-info.js
static/sass/shopping-cart/_index.scss
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
template/m.yohobuy.com/partials/layout/use.phtml
template/m.yohobuy.com/partials/shopping-cart/cart-content.phtml
template/m.yohobuy.com/partials/shopping-cart/gift-advance-good.phtml
template/m.yohobuy.com/partials/shopping-cart/good.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
framework
@
75bbc3b0
Subproject commit
e9d066dd88a8e7e37103021c427a205a5cfcdcec
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
...
...
library/LibModels/Wap/Home/CartData.php
View file @
251e35e
...
...
@@ -303,14 +303,15 @@ class CartData
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.submit'
;
$param
[
'address
I
d'
]
=
$addressId
;
$param
[
'address
_i
d'
]
=
$addressId
;
$param
[
'cart_type'
]
=
$cartType
;
$param
[
'delivery_time'
]
=
$deliveryTime
;
$param
[
'delivery_way'
]
=
$deliveryWay
;
...
...
@@ -324,6 +325,9 @@ class CartData
$param
[
'payment_id'
]
=
$paymentId
;
$param
[
'payment_type'
]
=
$paymentType
;
$param
[
'remark'
]
=
$remark
;
if
(
!
empty
(
$couponCode
))
{
$param
[
'coupon_code'
]
=
$couponCode
;
}
if
(
!
empty
(
$yohoCoin
))
{
$param
[
'use_yoho_coin'
]
=
$yohoCoin
;
}
...
...
static/js/shopping-cart/cart.js
View file @
251e35e
...
...
@@ -5,6 +5,7 @@
*/
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
);
var
$cartContent
=
$
(
'.cart-content'
);
...
...
@@ -13,6 +14,8 @@ var navHammer;
require
(
'./good'
);
lazyLoad
(
$
(
'img.lazy'
));
navHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'cart-nav'
)[
0
]);
navHammer
.
on
(
'tap'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
).
closest
(
'li'
);
...
...
static/js/shopping-cart/good.js
View file @
251e35e
...
...
@@ -8,78 +8,152 @@ var $ = require('jquery'),
ellipsis
=
require
(
'mlellipsis'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
chosePanel
=
require
(
'./chose-panel'
);
var
dialog
=
require
(
'../me/dialog'
),
tip
=
require
(
'../plugin/tip'
);
var
$
curDelPanel
;
var
$
names
;
//删除面板显示后任何点击行为都将触发隐藏面板
function
docTouchEvt
()
{
$curDelPanel
&&
$curDelPanel
.
addClass
(
'hide'
);
//chosePanel = require('./chose-panel');
//
$
(
document
).
off
(
'touchstart'
,
docTouchEvt
);
}
var
cartType
=
'ordinary'
;
//var $curDelPanel;
////删除面板显示后任何点击行为都将触发隐藏面板
//function docTouchEvt() {
// $curDelPanel && $curDelPanel.addClass('hide');
//
// //
// $(document).off('touchstart', docTouchEvt);
//}
ellipsis
.
init
();
lazyLoad
(
$
(
'.lazy'
));
lazyLoad
({
try_again_css
:
'order-failure'
});
$
(
'.name'
)[
0
].
mlellipsis
(
2
);
$names
=
$
(
'.name'
);
if
(
$names
.
length
>
0
)
{
$names
[
0
].
mlellipsis
(
2
);
}
//TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
$
(
'.cart-goods'
).
on
(
'touchstart'
,
'.checkbox'
,
function
()
{
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'icon-cb-checked'
))
{
$this
.
removeClass
(
'icon-cb-checked'
).
addClass
(
'icon-checkbox'
);
}
else
{
$this
.
removeClass
(
'icon-checkbox'
).
addClass
(
'icon-cb-checked'
);
}
}).
on
(
'touchstart'
,
'.icon-edit'
,
function
()
{
var
id
=
$
(
this
).
closest
(
'.shopping-cart-good'
).
data
(
'id'
);
var
$this
=
$
(
this
),
id
=
$
(
this
).
closest
(
'.shopping-cart-good'
).
data
(
'id'
);
$
.
ajax
({
type
:
'GET'
,
url
:
'/shoppingCart/
goodinfo
'
,
url
:
'/shoppingCart/
select
'
,
data
:
{
id
:
id
},
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
chosePanel
.
show
(
data
.
data
);
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
if
(
$this
.
hasClass
(
'icon-cb-checked'
))
{
$this
.
removeClass
(
'icon-cb-checked'
).
addClass
(
'icon-checkbox'
);
}
else
{
$this
.
removeClass
(
'icon-checkbox'
).
addClass
(
'icon-cb-checked'
);
}
}
$
.
ajax
({
type
:
'GET'
,
url
:
'/shoppingCart/getCartData'
,
data
:
{
id
:
id
},
success
:
function
(
data
)
{
if
(
data
)
{
$
(
'#good-totalprice'
).
html
(
'¥'
+
data
.
commonCart
.
price
);
$
(
'#good-activityPrice'
).
html
(
'¥'
+
data
.
commonCart
.
activityPrice
);
$
(
'#good-total'
).
html
(
data
.
commonCart
.
count
+
'件总计:¥'
+
data
.
commonCart
.
sumPrice
);
}
},
error
:
function
()
{
tip
.
show
(
'网络错误'
);
}
});
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
}).
on
(
'touchstart'
,
'.icon-edit'
,
function
()
{
}).
on
(
'touchstart'
,
'.icon-del'
,
function
(
e
)
{
var
$this
=
$
(
this
);
e
.
stopPropagation
();
//手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板
docTouchEvt
();
$curDelPanel
=
$
(
this
).
closest
(
'.shopping-cart-good'
).
children
(
'.opt-panel'
).
removeClass
(
'hide'
);
$
(
document
).
on
(
'touchstart'
,
docTouchEvt
);
}).
on
(
'touchstart'
,
'.opt-panel'
,
function
()
{
var
$this
=
$
(
this
),
id
=
$this
.
closest
(
'.shopping-cart-good'
).
data
(
'id'
),
url
;
if
(
$this
.
closest
(
'.put-in-favorite'
).
length
>
0
)
{
//移入收藏夹
url
=
'/shoppingCart/col'
;
}
else
{
//删除
url
=
'/shoppingCart/del'
;
}
//docTouchEvt();
//
//$curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');
//
//$(document).on('touchstart', docTouchEvt);
$
.
ajax
({
type
:
'POST'
,
url
:
url
,
data
:
{
id
:
id
dialog
.
showDialog
({
dialogText
:
'您确定要从购物车中删除吗?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
var
id
=
$this
.
closest
(
'.shopping-cart-good'
).
data
(
'id'
);
$
.
ajax
({
method
:
'post'
,
url
:
'/shoppingCart/del'
,
data
:
{
id
:
id
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
dialog
.
showDialog
({
dialogText
:
'删除成功'
,
autoHide
:
true
,
fast
:
true
});
history
.
go
(
0
);
}
}).
fail
(
function
()
{
dialog
.
showDialog
({
autoHide
:
true
,
dialogText
:
'网络错误~'
});
});
});
});
// .on('touchstart', '.opt-panel', function() {
// var $this = $(this),
// id = $this.closest('.shopping-cart-good').data('id'),
// url;
//
// if ($this.closest('.put-in-favorite').length > 0) {
//
// //移入收藏夹
// url = '/shoppingCart/col';
// } else {
//
// //删除
// url = '/shoppingCart/del';
// }
//
// $.ajax({
// type: 'POST',
// url: url,
// data: {
// id: id
// }
// });
//})
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/shoppingCart/orderEnsure?cartType='
+
cartType
;
});
...
...
static/js/shopping-cart/order-ensure.js
View file @
251e35e
...
...
@@ -98,8 +98,8 @@ function submitOrder() {
data
:
{
addressId
:
orderInfo
(
'addressId'
),
cartType
:
orderInfo
(
'cartType'
),
deliveryId
:
orderInfo
(
'deliveryId'
),
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
),
deliveryId
:
orderInfo
(
'deliveryId'
)
||
1
,
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
)
||
1
,
invoiceText
:
orderInfo
(
'invoiceText'
),
invoiceType
:
orderInfo
(
'invoiceType'
),
msg
:
orderInfo
(
'msg'
),
...
...
@@ -109,13 +109,24 @@ function submitOrder() {
yohoCoin
:
orderInfo
(
'yohoCoin'
)
}
}).
then
(
function
(
res
)
{
console
.
log
(
res
);
if
(
!
res
)
{
tip
.
show
(
'网络出错'
);
}
if
(
res
.
code
!==
200
)
{
tip
.
show
(
res
.
message
||
'网络出错'
);
}
else
{
console
.
log
(
1
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络出错'
);
});
}
// 界面点击,状态存 cookie
if
(
!
orderInfo
(
'addressId'
))
{
orderInfo
(
'addressId'
,
$
(
'.address-wrap'
).
data
(
'address-id'
));
}
$
(
'.dispatch-mode'
).
on
(
'touchend'
,
'li'
,
function
()
{
orderInfo
(
'deliveryId'
,
$
(
this
).
data
(
'id'
));
orderCompute
();
...
...
static/js/shopping-cart/order-info.js
View file @
251e35e
...
...
@@ -22,6 +22,7 @@ try {
invoiceType
:
null
,
msg
:
null
};
window
.
setCookie
(
'order-info'
,
JSON
.
stringify
(
info
));
}
exports
.
orderInfo
=
function
(
key
,
value
)
{
...
...
static/sass/shopping-cart/_index.scss
View file @
251e35e
...
...
@@ -178,3 +178,36 @@
}
}
}
.shopping-cart-zero
{
.cart-zero
{
width
:
100%
;
height
:
auto
;
padding-top
:
2rem
;
padding-bottom
:
20%
;
i
{
font-size
:
6em
;
display
:
block
;
margin
:
0
auto
;
text-align
:
center
;
color
:
#505050
;
}
p
{
display
:
block
;
text-align
:
center
;
font-size
:
1
.2em
;
color
:
#505050
;
padding
:
.6rem
0
;
}
a
{
width
:
27%
;
height
:
1
.2rem
;
overflow
:
hidden
;
line-height
:
1
.2rem
;
border
:
1px
solid
#505050
;
border-radius
:
.2rem
;
display
:
block
;
margin
:
0
auto
;
text-align
:
center
;
}
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/shoppingCart/index.phtml
View file @
251e35e
{
{>
layout/header
}
}
<div
class=
"shopping-cart-page yoho-page"
>
<div
class=
"shopping-cart-page yoho-page"
style=
"display: none;"
>
{
{#
shoppingCart
}
}
{
{#if
cartNav
}
}
<ul
class=
"cart-nav clearfix"
>
...
...
@@ -44,4 +44,12 @@
{
{/
shoppingCart
}
}
</div>
<div
class=
"shopping-cart-zero yoho-page"
>
<div
class=
"cart-zero"
>
<i
class=
"iconfont"
>
62
c</i>
<p>您的购物车暂无商品</p>
<a
href=
""
>随便逛逛</a>
</div>
{
{>
product/recommend-for-you
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
251e35e
{
{>
layout/header
}
}
<div
class=
"order-ensure-page yoho-page"
>
{
{#
orderEnsure
}
}
<a
class=
"address-wrap block"
href=
"/shoppingCart/selectAddress"
>
<a
class=
"address-wrap block"
href=
"/shoppingCart/selectAddress"
data-address-id=
"{{addressId}}"
>
<p
class=
"infos"
>
收货地址
<span
class=
"per-info"
>
{
{name
}
}
{
{phoneNum
}
}</span>
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
251e35e
...
...
@@ -206,6 +206,7 @@
{{#if shoppingCartPage}}
<script>
seajs.use('js/shopping-cart/cart');
seajs.use('js/product/recommend-for-you');
</script>
{{/if}}
{{#if giftAdvancePage}}
...
...
template/m.yohobuy.com/partials/shopping-cart/cart-content.phtml
View file @
251e35e
...
...
@@ -32,26 +32,26 @@
<div class="price-compute">
<p class="sum-price">
<span class="title">总价</span>
¥{{price}}
<span id="good-totalprice">¥{{price}}</span>
</p>
<p class="activity-price">
<span class="title">
活动价
<i class="minus">-</i>
</span>
¥{{activityPrice}}
<span id="good-activityPrice">¥{{activityPrice}}</span>
</p>
</div>
<div class="balance">
<span class="iconfont icon-cb-checked"></span>
<p>
<span>
<span
id="good-total"
>
{{count}}件总计:¥{{sumPrice}}
</span>
<span class="tip">(不含运费)</span>
</p>
<
button
class="btn-balance">
<
a
class="btn-balance">
结算
</
button
>
</
a
>
</div>
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/shopping-cart/gift-advance-good.phtml
View file @
251e35e
...
...
@@ -22,6 +22,9 @@
<span class="price">
¥{{price}}
</span>
<span class="price">
¥{{salePrice}}
</span>
<span class="count">
×{{count}}
</span>
...
...
template/m.yohobuy.com/partials/shopping-cart/good.phtml
View file @
251e35e
...
...
@@ -51,7 +51,7 @@
</p>
</div>
</div>
<div class="opt-panel hide">
<
!--<
div class="opt-panel hide">
<div class="put-in-favorite">
<span class="iconfont"></span>
<span>移入</span>
...
...
@@ -61,5 +61,5 @@
<span class="iconfont"></span>
删除
</div>
</div>
</div>
-->
</div>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
251e35e
...
...
@@ -883,6 +883,7 @@ class HomeController extends AbstractAction
{
$this
->
setTitle
(
'YOHO币'
);
$this
->
setNavHeader
(
'YOHO币'
,
true
,
false
);
$data
[
'money'
]
=
'0'
;
$page
=
$this
->
post
(
'page'
,
1
);
$size
=
$this
->
post
(
'size'
,
20
);
...
...
@@ -907,7 +908,7 @@ class HomeController extends AbstractAction
$page
=
$this
->
post
(
'page'
,
1
);
$size
=
$this
->
post
(
'size'
,
20
);
$data
=
UserModel
::
getYohoCoinLists
(
$this
->
_uid
,
$page
,
$size
);
//
$data = UserModel::getYohoCoinLists(3965746,$page,$size);
//$data = UserModel::getYohoCoinLists(3965746,$page,$size);
$this
->
_view
->
display
(
'ajax-currency-detail'
,
array
(
'currency'
=>
$data
[
'list'
],
'pageFooter'
=>
true
,
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
251e35e
...
...
@@ -195,7 +195,7 @@ class ShoppingCartController extends AbstractAction
'orderEnsurePage'
=>
true
,
'orderEnsure'
=>
CartModel
::
cartPay
(
$uid
,
$cartType
,
$cookieData
)
);
// var_dump($data);
$this
->
_view
->
display
(
'order-ensure'
,
$data
);
}
...
...
@@ -314,8 +314,9 @@ class ShoppingCartController extends AbstractAction
$paymentId
=
$this
->
post
(
'paymentTypeId'
,
15
);
$paymentType
=
$this
->
post
(
'paymentType'
,
1
);
// 默认在线支付
$remark
=
$this
->
post
(
'msg'
,
null
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
1
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
);
}
if
(
empty
(
$result
))
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
251e35e
...
...
@@ -330,7 +330,7 @@ class CartModel
// cookie保存的数据
if
(
!
empty
(
$cookieData
))
{
$orderInfo
=
json_decode
(
$cookieData
,
true
);
//
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
$orderCompute
=
self
::
orderCompute
(
$uid
,
$cartType
,
$orderInfo
[
'deliveryId'
],
$orderInfo
[
'paymentTypeId'
],
$orderInfo
[
'couponCode'
],
$orderInfo
[
'yohoCoin'
]);
}
// 根据地址id查询地址信息
...
...
@@ -449,18 +449,21 @@ class CartModel
$one
=
array
();
$one
[
'id'
]
=
$inv
[
'invoices_type_id'
];
$one
[
'name'
]
=
$inv
[
'invoices_type_name'
];
$one
[
'id'
]
==
$orderInfo
[
'invoiceType'
]
&&
$one
[
'isSelected'
]
=
true
;
isset
(
$orderInfo
[
'invoiceType'
])
&&
$one
[
'id'
]
==
$orderInfo
[
'invoiceType'
]
&&
$one
[
'isSelected'
]
=
true
;
$result
[
'invoice'
][]
=
$one
;
}
// 发票信息需要记录
$result
[
'needInvoice'
]
=
$orderInfo
[
'invoice'
];
$result
[
'invoiceText'
]
=
$orderInfo
[
'invoiceText'
];
if
(
isset
(
$orderInfo
[
'invoice'
]))
{
$result
[
'needInvoice'
]
=
$orderInfo
[
'invoice'
];
$result
[
'invoiceText'
]
=
$orderInfo
[
'invoiceText'
];
}
}
// 留言
$result
[
'msg'
]
=
$orderInfo
[
'msg'
];
isset
(
$orderInfo
[
'msg'
])
&&
$result
[
'msg'
]
=
$orderInfo
[
'msg'
];
// 优惠券数据
$coupons
=
array
();
...
...
@@ -564,16 +567,28 @@ class CartModel
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
)
{
$result
=
array
();
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
);
if
(
$orderSubRes
&&
isset
(
$orderSubRes
[
'code'
])
&&
$orderSubRes
[
'code'
]
===
200
)
{
$result
=
$orderSubRes
;
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦'
);
if
(
empty
(
$addressId
))
{
$result
[
'code'
]
=
401
;
$result
[
'message'
]
=
'配送地址不能为空'
;
}
elseif
(
empty
(
$deliveryTime
))
{
$result
[
'code'
]
=
402
;
$result
[
'message'
]
=
'请选择配送时间'
;
}
elseif
(
empty
(
$deliveryWay
))
{
$result
[
'code'
]
=
403
;
$result
[
'message'
]
=
'请选择配送方式'
;
}
else
{
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
);
if
(
$orderSubRes
&&
isset
(
$orderSubRes
[
'code'
]))
{
$result
=
$orderSubRes
;
}
}
return
$result
;
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
251e35e
...
...
@@ -383,15 +383,17 @@ class UserModel
// 调用接口获取YOHO币
$yohoCoin
=
UserData
::
yohoCoinData
(
$uid
,
$page
,
$limit
,
'post'
);
// 处理YOHO币数据
$coinList
=
$yohoCoin
[
'data'
][
'coinlist'
];
$data
[
'money'
]
=
$yohoCoin
[
'data'
][
'total'
];
foreach
(
$coinList
as
$key
=>
$val
){
$result
[
$key
][
'title'
]
=
$val
[
'message'
];
$result
[
$key
][
'time'
]
=
$val
[
'date'
];
if
(
$val
[
'num'
]
>
0
){
$val
[
'num'
]
=
'+'
.
$val
[
'num'
];
if
(
isset
(
$yohoCoin
[
'data'
])
&&
!
empty
(
$yohoCoin
[
'data'
])){
$coinList
=
$yohoCoin
[
'data'
][
'coinlist'
];
$data
[
'money'
]
=
$yohoCoin
[
'data'
][
'total'
];
foreach
(
$coinList
as
$key
=>
$val
){
$result
[
$key
][
'title'
]
=
$val
[
'message'
];
$result
[
$key
][
'time'
]
=
$val
[
'date'
];
if
(
$val
[
'num'
]
>
0
){
$val
[
'num'
]
=
'+'
.
$val
[
'num'
];
}
$result
[
$key
][
'count'
]
=
$val
[
'num'
];
}
$result
[
$key
][
'count'
]
=
$val
[
'num'
];
}
$data
[
'list'
]
=
$result
;
return
$data
;
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
251e35e
...
...
@@ -56,8 +56,8 @@ class BindController extends AbstractAction
$nickname
=
$this
->
get
(
'nickname'
);
$areaCode
=
$this
->
get
(
'areaCode'
,
'86'
);
$isReg
=
$this
->
get
(
'isReg'
);
$mobile
=
$this
->
get
(
'mobile'
);
$phoneNum
=
$this
->
get
(
'phoneNum'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
...
...
@@ -68,7 +68,7 @@ class BindController extends AbstractAction
'nickname'
=>
$nickname
,
//昵称
'isReg'
=>
$isReg
,
//是否是已注册过的手机号
'areaCode'
=>
$areaCode
,
//国别码
'phoneNum'
=>
$
mobile
,
//手机号码
'phoneNum'
=>
$
phoneNum
,
//手机号码
);
// 渲染模板
...
...
@@ -114,31 +114,31 @@ class BindController extends AbstractAction
break
;
}
$
mobile
=
$this
->
post
(
'mobile
'
);
$
phoneNum
=
$this
->
post
(
'phoneNum
'
);
$openId
=
$this
->
post
(
'openId'
);
$areaCode
=
$this
->
post
(
'areaCode'
,
'86'
);
$sourceType
=
$this
->
post
(
'sourceType'
);
$nickname
=
$this
->
post
(
'nickname'
);
if
(
!
is_numeric
(
$
mobile
)
||
!
$openId
||
!
$areaCode
||
!
$sourceType
)
if
(
!
is_numeric
(
$
phoneNum
)
||
!
$openId
||
!
$areaCode
||
!
$sourceType
)
{
break
;
}
$res
=
BindData
::
bindCheck
(
$
mobile
,
$openId
,
$sourceType
);
$res
=
BindData
::
bindCheck
(
$
phoneNum
,
$openId
,
$sourceType
);
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
}
if
(
$res
[
'code'
]
==
200
)
{
$next
=
Helpers
::
url
(
'/passport/bind/code'
,
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'openId'
=>
$openId
,
'sourceType'
=>
$sourceType
,
'nickname'
=>
$nickname
,
'areaCode'
=>
$areaCode
,
'
mobile'
=>
$mobile
));
$next
=
Helpers
::
url
(
'/passport/bind/code'
,
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'openId'
=>
$openId
,
'sourceType'
=>
$sourceType
,
'nickname'
=>
$nickname
,
'areaCode'
=>
$areaCode
,
'
phoneNum'
=>
$phoneNum
));
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'next'
=>
$next
));
}
else
{
$data
=
array
(
'code'
=>
500
,
'message'
=>
$res
[
'message'
],
'data'
=>
$res
[
'data'
]);
$data
=
array
(
'code'
=>
$res
[
'code'
]
,
'message'
=>
$res
[
'message'
],
'data'
=>
$res
[
'data'
]);
}
}
while
(
false
);
...
...
@@ -159,15 +159,15 @@ class BindController extends AbstractAction
break
;
}
$
mobile
=
$this
->
post
(
'mobile
'
);
$
phoneNum
=
$this
->
post
(
'phoneNum
'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$
mobile
))
if
(
!
is_numeric
(
$
phoneNum
))
{
break
;
}
$data
=
BindData
::
sendBindMsg
(
$areaCode
,
$
mobile
);
$data
=
BindData
::
sendBindMsg
(
$areaCode
,
$
phoneNum
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
...
...
@@ -191,16 +191,16 @@ class BindController extends AbstractAction
break
;
}
$
mobile
=
$this
->
post
(
'mobile
'
);
$
phoneNum
=
$this
->
post
(
'phoneNum
'
);
$msgCode
=
$this
->
post
(
'msgCode'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$
mobile
)
||
!
$msgCode
)
if
(
!
is_numeric
(
$
phoneNum
)
||
!
$msgCode
)
{
break
;
}
$data
=
BindData
::
checkBindCode
(
$areaCode
,
$
mobile
,
$msgCode
);
$data
=
BindData
::
checkBindCode
(
$areaCode
,
$
phoneNum
,
$msgCode
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
...
...
@@ -224,19 +224,19 @@ class BindController extends AbstractAction
break
;
}
$
mobile
=
$this
->
post
(
'mobile
'
);
$
phoneNum
=
$this
->
post
(
'phoneNum
'
);
$openId
=
$this
->
post
(
'openId'
);
$areaCode
=
$this
->
post
(
'areaCode'
,
'86'
);
$sourceType
=
$this
->
post
(
'sourceType'
);
$nickname
=
$this
->
post
(
'nickname'
);
$password
=
$this
->
post
(
'password'
);
if
(
!
is_numeric
(
$
mobile
)
||
!
$openId
||
!
$sourceType
||
!
$areaCode
)
if
(
!
is_numeric
(
$
phoneNum
)
||
!
$openId
||
!
$sourceType
||
!
$areaCode
)
{
break
;
}
$res
=
BindData
::
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$
mobile
,
$areaCode
,
$password
);
$res
=
BindData
::
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$
phoneNum
,
$areaCode
,
$password
);
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
...
...
Please
register
or
login
to post a comment