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
Rock Zhang
9 years ago
Commit
c4dce4b031365e4f8c2829e813e9868e566de94e
2 parents
c4eaa998
5bb46c38
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/cart
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
610 additions
and
233 deletions
docs/data-structure.md
library/LibModels/Wap/Passport/BindData.php
library/LibModels/Wap/Passport/LoginData.php
library/LibModels/Wap/Product/DetailData.php
static/js/product/detail/like.js
static/js/shopping-cart/chose-panel.js
static/js/shopping-cart/order-ensure.js
static/js/shopping-cart/order-info.js
static/js/shopping-cart/select-coupon.js
static/sass/me/_yoho-coin.scss
static/sass/shopping-cart/_chose-panel.scss
static/sass/shopping-cart/_select-coupon.scss
template/m.yohobuy.com/actions/index/home/helpDetail.phtml
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
template/m.yohobuy.com/actions/index/shoppingCart/select-address.phtml
template/m.yohobuy.com/actions/index/shoppingCart/select-coupon.phtml
template/m.yohobuy.com/actions/product/detail/index.phtml
template/m.yohobuy.com/partials/layout/page_header.phtml
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Home/Order.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
docs/data-structure.md
View file @
c4dce4b
...
...
@@ -1242,11 +1242,45 @@
'cartUrl':'购物车url',
'addToCartUrl':'添加购物车url',
'soldOut':'已售罄',
'notForSale':'非卖品'
'notForSale':'非卖品',
thumb: [
{
id:1,
url : ''
},
...
],
name: '',
price: '',
salePrice: '',
colors: [
{
id: 1,
chosed: true,
name: '黄色',
colorNum:10,
shortUrl:'',
},
...
],
sizes: [
{
id: 2,
chosed: true,
name: 'X',
sizeNum: 2
},
...
],
totalNum: 20
},
'introUrl' : '',
'id' : '',
'preferenceUrl' :''
'preferenceUrl' :''
,
}
### 评价列表页面
{
...
...
library/LibModels/Wap/Passport/BindData.php
View file @
c4dce4b
...
...
@@ -20,16 +20,16 @@ class BindData
/**
* 绑定前检查
* @param string $openId 第三方唯一识别码
* @param string $sourceType 登录方式
* @param string $clientType 所属客户端类型
* @param string $sourceType 登录方式 qq,sina,alipay,wechat
* @param string $mobile 绑定输入手机号
* @return array 登录返回结果
*/
public
static
function
bindCheck
(
$openId
,
$sourceType
)
public
static
function
bindCheck
(
$
mobile
,
$
openId
,
$sourceType
)
{
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'7'
;
$param
[
'method'
]
=
'app.passport.check'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'open_id'
]
=
$openId
;
$param
[
'source_type'
]
=
$sourceType
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
...
...
@@ -42,13 +42,13 @@ class BindData
* @param string $mobile 手机号
*
*/
public
static
function
sendBindMsg
(
$mobile
)
public
static
function
sendBindMsg
(
$
area
,
$
mobile
)
{
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'7'
;
$param
[
'method'
]
=
'app.passport.smsbind'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
...
...
@@ -58,14 +58,14 @@ class BindData
* 验证验证码是否正确
*
*/
public
static
function
checkBindCode
(
$mobile
,
$code
)
public
static
function
checkBindCode
(
$
area
,
$
mobile
,
$code
)
{
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'7'
;
$param
[
'method'
]
=
'app.register.validRegCode'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'code'
]
=
$code
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
...
...
@@ -77,19 +77,23 @@ class BindData
* @param string $openId 第三方唯一识别码
* @param string $sourceType 登录方式
* @param string $mobile 手机号
* @param string $area 国别码
* @param string $password 密码
*/
public
static
function
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$mobile
,
$
password
)
public
static
function
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$mobile
,
$
area
,
$password
=
''
)
{
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'7'
;
$param
[
'method'
]
=
'app.passport.bind'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'passport'
]
=
$password
;
$param
[
'open_id'
]
=
$openId
;
$param
[
'nickname'
]
=
$nickname
;
$param
[
'source_type'
]
=
$sourceType
;
$param
[
'area'
]
=
$area
;
if
(
!
empty
(
$password
))
{
$param
[
'passport'
]
=
$password
;
}
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
...
...
library/LibModels/Wap/Passport/LoginData.php
View file @
c4dce4b
...
...
@@ -66,7 +66,6 @@ class LoginData
// 构建必传参数
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'7'
;
// 只有早期的V4版本才有直接生成UID
$param
[
'method'
]
=
'app.passport.signinByOpenID'
;
$param
[
'openId'
]
=
$openId
;
$param
[
'source_type'
]
=
$sourceType
;
...
...
library/LibModels/Wap/Product/DetailData.php
View file @
c4dce4b
...
...
@@ -73,7 +73,6 @@ class DetailData
$param
[
'limit'
]
=
$pageSize
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
...
...
@@ -94,7 +93,6 @@ class DetailData
$param
[
'limit'
]
=
$pageSize
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
...
...
static/js/product/detail/like.js
View file @
c4dce4b
...
...
@@ -7,7 +7,8 @@
var
$
=
require
(
'jquery'
),
Hammer
=
require
(
'yoho.hammer'
),
tip
=
require
(
'../../plugin/tip'
);
tip
=
require
(
'../../plugin/tip'
),
chosePanel
=
require
(
'../../shopping-cart/chose-panel'
);
var
likeEle
=
document
.
getElementById
(
'likeBtn'
),
likeHammer
=
likeEle
&&
new
Hammer
(
likeEle
);
...
...
@@ -70,14 +71,17 @@ if (likeHammer) {
if
(
addToCartHammer
)
{
addToCartHammer
.
on
(
'tap'
,
function
(
e
)
{
chosePanel
.
show
();
// 统计代码:用于统计用户加入购物车的动作
if
(
window
.
_yas
)
{
window
.
_yas
.
sendCustomInfo
({
pd
:
productId
,
by
:
1
},
false
);
}
// if (window._yas) {
// window._yas.sendCustomInfo({
// pd: productId,
// by: 1
// }, false);
// }
});
}
...
...
static/js/shopping-cart/chose-panel.js
View file @
c4dce4b
...
...
@@ -5,36 +5,45 @@
* @date: 2015/10/21
*/
var
$
=
require
(
'jquery'
),
Handlebars
=
require
(
'yoho.handlebars'
);
var
$
=
require
(
'jquery'
);
var
$page
=
$
(
'.yoho-page'
);
// Handlebars = require('yoho.handlebars');
// var $page = $('.yoho-page');
var
$num
;
var
tpl
;
//
var tpl;
//读取partials
$
.
ajax
({
type
:
'GET'
,
url
:
'/shoppingCart/tpl'
,
success
:
function
(
data
)
{
tpl
=
Handlebars
.
compile
(
data
);
}
});
// $.ajax({
// type: 'GET',
// url: '/shoppingCart/tpl',
// success: function(data) {
// tpl = Handlebars.compile(data);
// }
// });
//显示
function
show
(
data
)
{
var
html
=
tpl
(
data
);
$page
.
append
(
html
);
//显示
// function show(data) {
// // var html = tpl(data);
// $('.chose-panel').show();
// // $page.append(html);
// $('.chose-panel')
// $num = $('#good-num');
// }
function
show
()
{
$
(
'.chose-panel'
).
show
();
$
(
'body'
).
css
(
'overflow'
,
'hidden'
);
$num
=
$
(
'#good-num'
);
}
//移除当前Panel
function
remove
()
{
$
(
'.chose-panel'
).
remove
();
$
(
'.chose-panel'
).
hide
();
$
(
'body'
).
css
(
'overflow'
,
'auto'
);
}
$
(
'.yoho-page'
).
on
(
'touchstart'
,
'.chose-panel'
,
function
(
e
)
{
...
...
@@ -75,4 +84,5 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
$num
.
val
(
num
+
1
);
});
exports
.
show
=
show
;
\ No newline at end of file
...
...
static/js/shopping-cart/order-ensure.js
View file @
c4dce4b
...
...
@@ -6,9 +6,12 @@
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
);
Hammer
=
require
(
'yoho.hammer'
),
orderInfo
=
require
(
'./order-info'
).
orderInfo
;
var
dispatchModeHammer
,
dispatchTimeHammer
;
var
dispatchModeHammer
,
dispatchTimeHammer
,
$invoice
=
$
(
'.invoice'
);
lazyLoad
();
...
...
@@ -51,3 +54,42 @@ $('.invoice').on('touchend', '.checkbox', function() {
$
(
'.invoice'
).
removeClass
(
'focus'
);
}
});
// 界面点击,状态存 cookie
$
(
'.dispatch-mode'
).
on
(
'touchend'
,
'li'
,
function
()
{
orderInfo
(
'deliveryId'
,
$
(
this
).
data
(
'id'
));
});
$
(
'.dispatch-time'
).
on
(
'touchend'
,
'li'
,
function
()
{
orderInfo
(
'deliveryTimeId'
,
$
(
this
).
data
(
'id'
));
});
$
(
'.coin'
).
on
(
'touchend'
,
function
()
{
var
$this
=
$
(
this
);
if
(
$this
.
find
(
'.checkbox'
).
hasClass
(
'icon-cb-checked'
))
{
orderInfo
(
'yohoCoin'
,
$this
.
data
(
'yoho-coin'
));
}
else
{
orderInfo
(
'yohoCoin'
,
0
);
}
});
$invoice
.
on
(
'touchend'
,
function
()
{
var
$this
=
$
(
this
);
orderInfo
(
'invoice'
,
$this
.
find
(
'.checkbox'
).
hasClass
(
'icon-cb-checked'
));
});
$invoice
.
find
(
'[name="invoice-title"]'
).
on
(
'blur'
,
function
()
{
orderInfo
(
'invoiceText'
,
$
(
this
).
val
());
}).
end
().
find
(
'.invoice-type'
).
on
(
'change'
,
function
()
{
orderInfo
(
'invoiceType'
,
$
(
this
).
val
());
});
$
(
'#msg'
).
find
(
'input'
).
on
(
'blur'
,
function
()
{
orderInfo
(
'msg'
,
$
(
this
).
val
());
});
$
(
'.pay-mode'
).
on
(
'click'
,
'li'
,
function
()
{
orderInfo
(
'paymentTypeId'
,
$
(
this
).
data
(
'pay-id'
));
});
...
...
static/js/shopping-cart/order-info.js
View file @
c4dce4b
...
...
@@ -3,12 +3,11 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/12/14
*/
var
info
=
window
.
cookie
(
'order-info'
),
orderInfo
;
var
info
=
window
.
cookie
(
'order-info'
);
// info 必须是 JSON 字符串
try
{
info
=
JSON
.
parse
(
orderI
nfo
);
info
=
JSON
.
parse
(
i
nfo
);
}
catch
(
e
)
{
info
=
{};
}
...
...
static/js/shopping-cart/select-coupon.js
View file @
c4dce4b
...
...
@@ -16,14 +16,15 @@ var page = 1,
isGetData
;
var
conponTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-coupon'
).
html
()),
conponNotAvaliableTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-coupon-not-avaliable'
).
html
());
conponNotAvaliableTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-coupon-not-avaliable'
).
html
()),
$newCoupon
=
$
(
'#new-coupon'
);
ellipsis
.
init
();
$
(
'#search-coupon'
)
.
on
(
'submit'
,
function
()
{
$
newCoupon
.
on
(
'submit'
,
function
()
{
$
.
ajax
({
method
:
'POST'
,
url
:
'/shoppingCart/coupon'
,
url
:
'/shoppingCart/coupon
Search
'
,
data
:
$
(
this
).
serialize
()
}).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
...
...
@@ -39,8 +40,19 @@ $('#search-coupon').on('submit', function() {
return
false
;
});
$
(
'#coupon-list'
).
on
(
'touchend'
,
'employ-main'
,
function
()
{
orderInfo
(
'couponCode'
,
$
(
this
).
data
(
'coupon-code'
));
$
(
'#coupon-list'
).
on
(
'touchend'
,
'.employ-main'
,
function
()
{
var
$this
=
$
(
this
);
orderInfo
(
'couponCode'
,
$this
.
data
(
'coupon-code'
));
orderInfo
(
'couponValue'
,
$this
.
data
(
'coupon-value'
));
});
$newCoupon
.
find
(
'input'
).
on
(
'input'
,
function
()
{
if
(
$
(
this
).
val
()
!==
''
)
{
$newCoupon
.
find
(
'.submit'
).
css
(
'background'
,
'#444'
);
}
else
{
$newCoupon
.
find
(
'.submit'
).
css
(
'background'
,
'#b0b0b0'
);
}
});
function
getCouponHandle
(
coupons
)
{
...
...
@@ -117,7 +129,7 @@ function getCouponDate() {
$
.
ajax
({
type
:
'POST'
,
url
:
'/
home/couponData
'
,
url
:
'/
shoppingCart/couponList
'
,
dataType
:
'json'
,
data
:
{
page
:
page
...
...
static/sass/me/_yoho-coin.scss
View file @
c4dce4b
.yoho-coin-page
{
padding
:
1em
;
.coin-num
{
font-size
:
1
.4em
;
...
...
@@ -9,7 +8,34 @@
font-size
:
4em
;
color
:
#f00
;
}
span
{
width
:
100%
;
height
:
auto
;
overflow
:
hidden
;
display
:
block
;
color
:
#b0b0b0
;
margin-top
:
-.6rem
;
}
}
.check
{
width
:
100%
;
height
:
auto
;
overflow
:
hidden
;
text-align
:
center
;
margin-top
:
.6rem
;
padding-bottom
:
1rem
;
border-bottom
:
1px
solid
#b0b0b0
;
a
{
line-height
:
1
.2rem
;
border
:
1px
solid
#444444
;
width
:
30%
;
height
:
100%
;
font-size
:
1
.2em
;
display
:
inline-block
;
border-radius
:
.6rem
;
}
}
section
p
{
line-height
:
1
.5em
;
...
...
static/sass/shopping-cart/_chose-panel.scss
View file @
c4dce4b
.chose-panel
{
position
:
absolute
;
position
:
fixed
;
display
:
none
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
;
background
:
rgba
(
0
,
0
,
0
,.
3
);
z-index
:
3
;
.main
{
position
:
absolute
;
height
:
610rem
/
$pxConvertRem
;
height
:
pxToRem
(
610px
)
;
bottom
:
0
;
left
:
0
;
right
:
0
;
...
...
@@ -18,7 +21,7 @@
.infos
{
height
:
460rem
/
$pxConvertRem
;
padding
:
0
22rem
/
$pxConvertRem
;
padding-top
:
30rem
/
$pxConvertRem
;
//
padding-top: 30rem / $pxConvertRem;
}
.chose-items
{
...
...
@@ -27,7 +30,10 @@
}
.basic-info
{
margin-bottom
:
30rem
/
$pxConvertRem
;
overflow
:
hidden
;
position
:
relative
;
margin-bottom
:
pxToRem
(
30px
);
margin-top
:
pxToRem
(
30px
);
}
.thumb
{
...
...
@@ -37,12 +43,18 @@
}
.text-info
{
margin-left
:
102rem
/
$pxConvertRem
;
position
:
absolute
;
height
:
auto
;
left
:
pxToRem
(
95px
);
top
:
50%
;
transform
:
translateY
(
-50%
);
.name
{
font-size
:
28rem
/
$pxConvertRem
;
}
.price
{
font-size
:
pxToRem
(
24px
);
}
.sale-price
{
color
:
#e10
;
...
...
static/sass/shopping-cart/_select-coupon.scss
View file @
c4dce4b
...
...
@@ -2,7 +2,7 @@
margin-top
:
pxToRem
(
30px
);
margin-bottom
:
pxToRem
(
30px
);
#
search
-coupon
{
#
new
-coupon
{
margin-bottom
:
pxToRem
(
30px
);
padding-left
:
pxToRem
(
30px
);
padding-right
:
pxToRem
(
30px
);
...
...
template/m.yohobuy.com/actions/index/home/helpDetail.phtml
View file @
c4dce4b
{
{>
layout/header
}
}
{
{
iHelp
}
}
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
c4dce4b
...
...
@@ -5,7 +5,7 @@
<p
class=
"infos"
>
收货地址
<span
class=
"per-info"
>
{
{name
}
}
{
{phoneNum
}
}</span>
<span
class=
"address"
>
{
{address
}
}</span>
<span
class=
"address"
>
{
{a
rea
}
}
{
{a
ddress
}
}</span>
</p>
<span
class=
"iconfont"
>
614
;</span>
</a>
...
...
@@ -15,7 +15,7 @@
<h
3
class=
"title"
>配送方式</h
3
>
<ul
class=
"dispatch-mode clearfix"
>
{
{#each
dispatchMode
}
}
<li
{
{#if
@first
}
}class=
"chosed"
{
{/if
}
}
data-id=
"{{id}}"
>
{
{name
}
}</li>
<li
{
{#if
isSelected
}
}class=
"chosed"
{
{/if
}
}
data-id=
"{{id}}"
>
{
{name
}
}</li>
{
{/each
}
}
</ul>
</div>
...
...
@@ -24,7 +24,7 @@
<h
3
class=
"title"
>送货时间</h
3
>
<ul
class=
"dispatch-time clearfix"
>
{
{#each
dispatchTime
}
}
<li
{
{#if
@first
}
}class=
"chosed"
{
{/if
}
}
data-id=
"{{id}}"
>
{
{name
}
}</li>
<li
{
{#if
isSelected
}
}class=
"chosed"
{
{/if
}
}
data-id=
"{{id}}"
>
{
{name
}
}</li>
{
{/each
}
}
</ul>
</div>
...
...
@@ -52,14 +52,14 @@
</span>
{
{/if
}
}
{
{#if
notUsed
}
}
<span
class=
"not-used coupon-use"
>
未使用
{
{#if
value
}
}
<span
class=
"used coupon-use"
>
-¥
{
{value
}
}
<i
class=
"iconfont"
>
614
;</i>
</span>
{
{^
}
}
<span
class=
"used coupon-use"
>
-¥
{
{value
}
}
<span
class=
"not-used coupon-use"
>
未使用
<i
class=
"iconfont"
>
614
;</i>
</span>
{
{/if
}
}
...
...
@@ -68,7 +68,7 @@
{
{/
coupon
}
}
{
{#
yohoCoin
}
}
<li
class=
"coin"
>
<li
class=
"coin"
data-yoho-coin=
"{{.}}"
>
<span
class=
"title"
>YOHO币</span>
<span
class=
"desc"
>可抵用¥
{
{.
}
}</span>
<span
class=
"coin-check"
>
...
...
template/m.yohobuy.com/actions/index/shoppingCart/select-address.phtml
View file @
c4dce4b
...
...
@@ -2,7 +2,7 @@
<div
class=
"my-address-page select-address-page yoho-page"
>
<div
class=
"page-wrap"
>
{
{#
address
}
}
<a
class=
"address-item"
data-address-id=
"{{address_id}}"
href=
"/shoppingCart/orderEnsure
?address_id={{address_id}}
"
>
<a
class=
"address-item"
data-address-id=
"{{address_id}}"
href=
"/shoppingCart/orderEnsure"
>
<span
class=
"name"
>
{
{consignee
}
}</span>
<span
class=
"tel"
>
{
{mobile
}
}</span>
<p
class=
"address-info"
>
{
{area
}
}
{
{address
}
}</p>
...
...
template/m.yohobuy.com/actions/index/shoppingCart/select-coupon.phtml
View file @
c4dce4b
{
{>
layout/header
}
}
<div
class=
"yoho-page select-coupon-page my-coupon-page"
>
<form
id=
"
search
-coupon"
method=
"POST"
action=
""
>
<form
id=
"
new
-coupon"
method=
"POST"
action=
""
>
<input
type=
"text"
name=
"couponCode"
value=
""
placeholder=
"输入优惠券码"
>
<button
type=
"submit"
class=
"submit"
>确定</button>
</form>
...
...
@@ -11,9 +11,9 @@
<script
id=
"tmpl-coupon"
type=
"text/tmpl"
>
\
{
{#coupons
}
}
\
{
{^
notAvailable
}
}
<a
class=
"employ-main"
data-coupon-code=
"{{ coupon_code}}"
href=
"/shoppingCart/orderEnsure?coupon_code={{ coupon_code}}"
>
<span>\
{
{
money
}
}</span>
<p
class=
"coupon-name"
>\
{
{
coupon_name
}
}</p>
<a
class=
"employ-main"
data-coupon-code=
"\{{ couponCode}}"
data-coupon-value=
"\{{ couponValue}}"
href=
"/shoppingCart/orderEnsure"
>
<span>\
{
{
couponValue
}
}</span>
<p
class=
"coupon-name"
>\
{
{
couponDetailInfomation
}
}</p>
<p>有效期:\
{
{
couponValidity
}
}</p>
</a>
\
{
{/
notAvailable
}
}
...
...
@@ -22,8 +22,8 @@
<script
id=
"tmpl-coupon-not-avaliable"
type=
"text/tmpl"
>
\
{
{#
notAvailableCoupons
}
}
<div
class=
"employ-main not-avaliable"
>
<span>\
{
{
money
}
}</span>
<p
class=
"coupon-name"
>\
{
{
coupon_name
}
}</p>
<span>\
{
{
couponValue
}
}</span>
<p
class=
"coupon-name"
>\
{
{
couponDetailInfomation
}
}</p>
<p>有效期:\
{
{
couponValidity
}
}</p>
</div>
\
{
{/
notAvailableCoupons
}
}
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
c4dce4b
...
...
@@ -114,6 +114,7 @@
<div
id=
"productDesc"
>
</div>
{
{>
product/recommend-for-you
}
}
{
{>
shopping-cart/chose-panel
}
}
{
{#cartInfo
}
}
<div
class=
"cart-bar"
>
...
...
@@ -121,7 +122,8 @@
<a
href=
"{{cartUrl}}"
class=
"num-incart iconfont"
>
62
c;</a>
{
{#if
addToCartUrl
}
}
<a
id=
"addtoCart"
href=
"{{addToCartUrl}}"
class=
"addto-cart"
>加入购物车</a>
<!--
<a
id=
"addtoCart"
href=
"{{addToCartUrl}}"
class=
"addto-cart"
>加入购物车</a>
-->
<a
id=
"addtoCart"
href=
"javascript:;"
class=
"addto-cart"
>加入购物车</a>
{
{/if
}
}
{
{#if
soldOut
}
}
...
...
template/m.yohobuy.com/partials/layout/page_header.phtml
View file @
c4dce4b
...
...
@@ -17,19 +17,19 @@
<div
class=
"homebuttom none"
>
<ul>
<li>
<i
class=
"iconfont"
>
62
e
;</i>
<i
class=
"iconfont"
>
62
a
;</i>
<span>首页</span>
</li>
<li>
<i
class=
"iconfont"
>
62
e
;</i>
<i
class=
"iconfont"
>
62
d
;</i>
<span>分类</span>
</li>
<li>
<i
class=
"iconfont"
>
62
e
;</i>
<i
class=
"iconfont"
>
62
c
;</i>
<span>购物车</span>
</li>
<li>
<i
class=
"iconfont"
>
62
e
;</i>
<i
class=
"iconfont"
>
62
b
;</i>
<span>我的</span>
</li>
</ul>
...
...
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
View file @
c4dce4b
{
{#cartInfo
}
}
<div
class=
"chose-panel"
>
<div
class=
"main"
>
<div
class=
"infos"
>
...
...
@@ -25,8 +26,8 @@
</ul>
</div>
<div
class=
"size-list"
>
<span>尺码</span>
<ul class="clearfix" data-type="size">
<span>尺码</span>
<ul
class=
"clearfix {{#if @first}}{{^}}hide{{/if}}"
data-type=
"size"
>
{
{#
sizes
}
}
<li
class=
"block {{#if chosed}}chosed{{/if}}"
data-id=
{
{id
}
}>
{
{name
}
}
...
...
@@ -49,7 +50,8 @@
</div>
</div>
<div
class=
"btn-wrap"
>
<button id="chose-btn-sure" class="btn btn-sure">
确定
</button>
<button
id=
"chose-btn-sure"
class=
"btn btn-sure"
>
加入购物车
</button>
</div>
</div>
</div>
\ No newline at end of file
</div>
{
{/cartInfo
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
c4dce4b
...
...
@@ -48,7 +48,7 @@ class HomeController extends AbstractAction
'showDownloadApp'
=>
true
,
'pageFooter'
=>
true
,
'cartUrl'
=>
Helpers
::
url
(
'/cart/index/index'
,
null
),
'signinUrl'
=>
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
'/home'
))
),
'signinUrl'
=>
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
'/home'
))),
);
$uid
=
$this
->
getUid
(
false
);
if
(
$uid
)
{
...
...
@@ -832,71 +832,49 @@ class HomeController extends AbstractAction
*/
public
function
orderDetailAction
()
{
$data
=
array
(
'name'
=>
'毛毛莉Lydia'
,
'phoneNum'
=>
'18600001133'
,
'address'
=>
'南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼'
,
'orderStatus'
=>
'订单取消'
,
'orderNum'
=>
'418358063'
,
'orderTime'
=>
'2014-03-10 17:25:10'
,
'orderCancel'
=>
true
,
'goods'
=>
array
(
array
(
'id'
=>
1
,
'thumb'
=>
'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'Adidas Originals ZX FLUXM22508'
,
'color'
=>
'黄'
,
'size'
=>
'43'
,
'price'
=>
'699.00'
,
'count'
=>
'2'
),
array
(
'id'
=>
1
,
'thumb'
=>
'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'B.Duck浴室玩伴mini浮水鸭'
,
'gift'
=>
true
,
'color'
=>
'黄'
,
'size'
=>
'43'
,
'price'
=>
'0.00'
,
'count'
=>
'1'
)
),
'sumPrice'
=>
799
,
'salePrice'
=>
80
,
'freight'
=>
5
,
'coupon'
=>
0
,
'yohoCoin'
=>
5
,
'price'
=>
719
);
$this
->
_view
->
display
(
'order-detail'
,
array
(
'orderDetail'
=>
$data
,
'orderDetailPage'
=>
true
));
// 审判跳转登录页
$this
->
auditJumpLogin
();
$orderCode
=
$this
->
get
(
'order_code'
);
if
(
empty
(
$orderCode
))
{
$this
->
error
();
}
$this
->
setTitle
(
'订单详情'
);
$this
->
setNavHeader
(
'订单详情'
);
$this
->
_view
->
display
(
'order-detail'
,
array
(
'orderDetailPage'
=>
true
,
'orderDetail'
=>
OrderModel
::
orderDetail
(
$orderCode
,
$this
->
_uid
,
$this
->
_session
),
));
}
/**
* 帮助列表页
*/
/**
* 帮助列表页
*/
public
function
helpAction
()
{
$service
=
Home\HelpModel
::
serviceInfo
();
{
$this
->
setTitle
(
'帮助中心'
);
$this
->
setNavHeader
(
'帮助中心'
);
$data
=
array
(
'iHelp'
=>
$service
,
'iHelp'
=>
Home\HelpModel
::
serviceInfo
()
,
);
$this
->
_view
->
display
(
'i-help'
,
$data
);
}
/**
* 帮助列表页
*/
public
function
helpDetailAction
()
{
$this
->
setTitle
(
'帮助中心'
);
$this
->
setNavHeader
(
'帮助中心'
);
$data
=
array
(
'iHelp'
=>
array
(
array
(
'name'
=>
'新用户注册'
),
)
);
$this
->
_view
->
display
(
'helpDetail'
,
$data
);
}
* 帮助列表页
*/
public
function
helpDetailAction
()
{
$this
->
setTitle
(
'帮助中心'
);
$this
->
setNavHeader
(
'帮助中心'
);
$data
=
array
(
'iHelp'
=>
array
(
array
(
'name'
=>
'新用户注册'
),
)
);
$this
->
_view
->
display
(
'helpDetail'
,
$data
);
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
c4dce4b
...
...
@@ -189,7 +189,7 @@ class ShoppingCartController extends AbstractAction
$this
->
setNavHeader
(
'购物车'
);
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$cookieData
=
$this
->
getCookie
(
'order
I
nfo'
,
null
);
$cookieData
=
$this
->
getCookie
(
'order
-i
nfo'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$data
=
array
(
'orderEnsurePage'
=>
true
,
...
...
yohobuy/m.yohobuy.com/application/models/Home/Order.php
View file @
c4dce4b
...
...
@@ -80,7 +80,7 @@ class OrderModel
$result
[
$key
][
'sumCost'
]
=
$vo
[
'amount'
];
//类内调用格式化订单商品数据方法
$result
[
$key
][
'goods'
]
=
Helpers
::
formatOrderGoods
(
$vo
[
'order_goods'
],
$count
);
$result
[
$key
][
'detailUrl'
]
=
Helpers
::
url
(
'/home/order
s/detail'
,
array
(
'order_code'
=>
$vo
[
'order_code'
],
't'
=>
time
()
));
$result
[
$key
][
'detailUrl'
]
=
Helpers
::
url
(
'/home/order
Detail'
,
array
(
'order_code'
=>
$vo
[
'order_code'
]
));
$result
[
$key
][
'count'
]
=
$count
;
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
c4dce4b
...
...
@@ -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查询地址信息
...
...
@@ -343,36 +343,57 @@ class CartModel
$result
[
'addressId'
]
=
isset
(
$address
[
'address_id'
])
?
$address
[
'address_id'
]
:
$payReturn
[
'delivery_address'
][
'address_id'
];
$result
[
'name'
]
=
isset
(
$address
[
'consignee'
])
?
$address
[
'consignee'
]
:
$payReturn
[
'delivery_address'
][
'consignee'
];
$result
[
'phoneNum'
]
=
isset
(
$address
[
'mobile'
])
?
$address
[
'mobile'
]
:
$payReturn
[
'delivery_address'
][
'mobile'
];
$result
[
'address'
]
=
isset
(
$address
[
'address'
])
?
$address
[
'address'
]
:
$payReturn
[
'delivery_address'
][
'address'
];
$result
[
'area'
]
=
isset
(
$address
[
'area'
])
?
$address
[
'area'
]
:
$payReturn
[
'delivery_address'
][
'area'
];
$result
[
'address'
]
=
isset
(
$address
[
'address'
])
?
$address
[
'address'
]
:
$payReturn
[
'delivery_address'
][
'address'
];
$result
[
'isSupport'
]
=
(
$payReturn
[
'delivery_address'
][
'is_support'
]
===
'Y'
);
}
// 配送方式
if
(
isset
(
$payReturn
[
'delivery_way'
]))
{
$idArr
=
array
();
$defaultKey
=
0
;
$oneDeliv
=
array
();
foreach
(
$payReturn
[
'delivery_way'
]
as
$val
)
{
foreach
(
$payReturn
[
'delivery_way'
]
as
$
key
=>
$
val
)
{
$oneDeliv
=
array
();
$oneDeliv
[
'id'
]
=
$val
[
'delivery_way_id'
];
$oneDeliv
[
'name'
]
=
$val
[
'delivery_way_name'
];
$oneDeliv
[
'default'
]
=
(
$val
[
'default'
]
===
'Y'
);
isset
(
$orderInfo
[
'deliveryId'
])
&&
$orderInfo
[
'deliveryId'
]
===
$oneDeliv
[
'id'
]
&&
$oneDeliv
[
'isSelected'
]
=
true
;
(
$val
[
'default'
]
===
'Y'
)
&&
$defaultKey
=
$key
;
$result
[
'dispatchMode'
][]
=
$oneDeliv
;
$idArr
[
$key
]
=
$oneDeliv
[
'id'
];
$result
[
'dispatchMode'
][
$key
]
=
$oneDeliv
;
}
if
(
isset
(
$orderInfo
[
'deliveryId'
]))
{
$flag
=
array_search
(
$orderInfo
[
'deliveryId'
],
$idArr
);
$flag
!==
false
&&
$result
[
'dispatchMode'
][
$flag
][
'isSelected'
]
=
true
;
}
else
{
$result
[
'dispatchMode'
][
$defaultKey
][
'isSelected'
]
=
true
;
}
}
// 配送时间
if
(
isset
(
$payReturn
[
'delivery_time'
]))
{
$idArr
=
array
();
$defaultKey
=
0
;
$oneDelivTime
=
array
();
foreach
(
$payReturn
[
'delivery_time'
]
as
$one
)
{
foreach
(
$payReturn
[
'delivery_time'
]
as
$
key
=>
$
one
)
{
$oneDelivTime
=
array
();
$oneDelivTime
[
'id'
]
=
$one
[
'delivery_time_id'
];
$oneDelivTime
[
'name'
]
=
$one
[
'delivery_time_string'
];
$oneDelivTime
[
'default'
]
=
(
$one
[
'default'
]
===
'Y'
);
isset
(
$orderInfo
[
'deliveryTimeId'
])
&&
$orderInfo
[
'deliveryTimeId'
]
===
$oneDelivTime
[
'id'
]
&&
$oneDeliv
[
'isSelected'
]
=
true
;
(
$one
[
'default'
]
===
'Y'
)
&&
$defaultKey
=
$key
;
$idArr
[
$key
]
=
$oneDelivTime
[
'id'
];
$result
[
'dispatchTime'
][]
=
$oneDelivTime
;
}
if
(
isset
(
$orderInfo
[
'deliveryTimeId'
]))
{
$flag
=
array_search
(
$orderInfo
[
'deliveryTimeId'
],
$idArr
);
$flag
!==
false
&&
$result
[
'dispatchTime'
][
$flag
][
'isSelected'
]
=
true
;
}
else
{
$result
[
'dispatchTime'
][
$defaultKey
][
'isSelected'
]
=
true
;
}
}
// 订单商品
...
...
@@ -435,7 +456,7 @@ class CartModel
// 优惠券数据
$coupons
=
array
(
'notUsed'
=>
true
);
!
empty
(
$orderCompute
[
'coupon_amount'
])
&&
$coupons
[
'
notUsed'
]
=
$orderInfo
[
'couponNam
e'
];
!
empty
(
$orderCompute
[
'coupon_amount'
])
&&
$coupons
[
'
value'
]
=
$orderInfo
[
'couponValu
e'
];
$coupons
+=
self
::
getCouponList
(
$uid
,
0
,
1
,
true
);
$result
[
'coupon'
]
=
$coupons
;
}
...
...
@@ -515,7 +536,7 @@ class CartModel
$val
[
'notAvailable'
]
=
true
;
}
}
!
empty
(
$couponArr
)
&&
$result
[
'coupons'
]
=
$couponArr
;
!
empty
(
$couponArr
)
&&
$result
=
$couponArr
;
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
c4dce4b
...
...
@@ -142,7 +142,7 @@ class DetailModel
$result
[
'feedbacks'
][
'comments'
][]
=
$build
;
}
$result
[
'feedbacks'
][
'commentsUrl'
]
=
Helpers
::
url
(
'/product/detail/comments'
,
array
(
'product_id'
=>
$productId
,
'total'
=>
$result
[
'feedbacks'
][
'commentsNum'
]));
}
}
// 品牌信息
if
(
!
empty
(
$baseInfo
[
'brand'
]))
{
...
...
@@ -157,41 +157,59 @@ class DetailModel
// 商品信息
if
(
!
empty
(
$baseInfo
[
'goodsList'
]))
{
// $colorGroup = array();
// $sizeGroup = array();
$goodsList
=
array
();
$colorGroup
=
array
();
$sizeList
=
array
();
$goodsGroup
=
array
();
$colorId
=
0
;
foreach
(
$baseInfo
[
'goodsList'
]
as
$value
)
{
$colorId
=
intval
(
$value
[
'colorId'
]);
// 商品按颜色进行分类分组
$coverImage
=
''
;
$colorStorageNum
=
0
;
// 颜色的库存总数
$totalStorageNum
=
0
;
// 总库存数
foreach
(
$baseInfo
[
'goodsList'
]
as
$i
=>
$value
)
{
$sizeList
=
array
();
$colorStorageNum
=
0
;
// 获取默认的封面图
if
(
$i
===
0
)
{
$coverImage
=
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
);
}
// 商品分组
if
(
isset
(
$value
[
'goodsImagesList'
]))
{
foreach
(
$value
[
'goodsImagesList'
]
as
$goods
)
{
$goodsList
[
$goods
[
'goodsId'
]]
=
$colorId
;
$goodsGroup
[]
=
array
(
'goodsId'
=>
$goods
[
'goodsId'
],
'img'
=>
$goods
[
'imageUrl'
],
);
// $colorGroup[$colorId] = array(
// 'colorId' => $colorId,
// 'colorName' => $value['colorName'],
// 'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
// );
}
}
// // 商品的尺码列表
// if (isset($value['goodsSizeBoList'])) {
// foreach ($value['goodsSizeBoList'] as $size) {
// $sizeGroup[$colorId] = array(
// 'sizeName' => $size['sizeName'],
// 'sizeSku' => $size['goodsSizeSkuId'],
// 'sizeStorage' => $size['goodsSizeStorageNum'],
// );
// }
// }
// 商品的尺码列表
if
(
isset
(
$value
[
'goodsSizeBoList'
]))
{
foreach
(
$value
[
'goodsSizeBoList'
]
as
$size
)
{
$sizeList
[]
=
array
(
'id'
=>
$size
[
'id'
],
'skuId'
=>
$size
[
'goodsSizeSkuId'
],
'goodsId'
=>
$size
[
'goodsId'
],
'name'
=>
$size
[
'sizeName'
],
'sizeNum'
=>
$size
[
'goodsSizeStorageNum'
],
);
$colorStorageNum
+=
intval
(
$size
[
'goodsSizeStorageNum'
]);
}
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'shortUrl'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
),
'colorNum'
=>
$colorStorageNum
,
'sizes'
=>
$sizeList
,
);
$totalStorageNum
+=
$colorStorageNum
;
}
// 商品图: 多个
if
(
isset
(
$goodsGroup
[
1
]))
{
foreach
(
$goodsGroup
as
$value
)
{
...
...
@@ -214,11 +232,18 @@ class DetailModel
'numInCart'
=>
0
,
'goodsInstore'
=>
$baseInfo
[
'storage'
],
// 库存量
);
$soldOut
=
$
baseInfo
[
'storage'
]
==
0
;
$soldOut
=
$
totalStorageNum
=
==
0
;
$notForSale
=
$baseInfo
[
'attribute'
]
==
2
;
// 显示加入购物车链接
if
(
!
$soldOut
&&
!
$notForSale
)
{
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
//
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
$result
[
'cartInfo'
][
'productId'
]
=
$productId
;
$result
[
'cartInfo'
][
'thumb'
]
=
$coverImage
;
$result
[
'cartInfo'
][
'name'
]
=
isset
(
$result
[
'goodsName'
])
?
$result
[
'goodsName'
]
:
''
;
$result
[
'cartInfo'
][
'price'
]
=
isset
(
$result
[
'goodsPrice'
][
'currentPrice'
])
?
$result
[
'goodsPrice'
][
'currentPrice'
]
:
''
;
$result
[
'cartInfo'
][
'salePrice'
]
=
isset
(
$result
[
'goodsPrice'
][
'previousPrice'
])
?
$result
[
'goodsPrice'
][
'previousPrice'
]
:
''
;
$result
[
'cartInfo'
][
'totalNum'
]
=
$totalStorageNum
;
$result
[
'cartInfo'
][
'colors'
]
=
$colorGroup
;
}
// 非卖品
elseif
(
$notForSale
)
{
...
...
@@ -251,11 +276,11 @@ class DetailModel
*/
public
static
function
getSizeInfo
(
$productSkn
)
{
$result
=
array
();
$result
=
array
();
if
(
is_numeric
(
$productSkn
))
{
// 调用服务
$sizeInfo
=
DetailData
::
sizeInfo
(
$productSkn
);
$sizeInfo
=
DetailData
::
sizeInfo
(
$productSkn
);
// 商品信息
if
(
isset
(
$sizeInfo
[
'productDescBo'
][
'erpProductId'
]))
{
...
...
@@ -345,7 +370,6 @@ class DetailModel
}
else
{
$result
[
'sizeInfo'
][
'detail'
][
'list'
][
0
][
'params'
]
=
array
(
0
=>
array
(
'param'
=>
''
));
}
}
// 测量方式
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
c4dce4b
<?php
use
Action\AbstractAction
;
use
LibModels\Wap\Passport\
Login
Data
;
use
LibModels\Wap\Passport\
Bind
Data
;
use
LibModels\Wap\Passport\RegData
;
use
Plugin\Helpers
;
use
Plugin\Partner\Factory
;
/**
* 登录的控制器
...
...
@@ -17,61 +16,259 @@ class BindController extends AbstractAction
*/
public
function
indexAction
()
{
$this
->
setTitle
(
'绑定手机号'
);
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
}
$this
->
setTitle
(
'绑定手机号'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nickname
=
$this
->
get
(
'nickname'
);
$data
=
array
(
'
loginIndex'
=>
true
,
// 模板中使用JS的
标识
'
bindIndex'
=>
true
,
//js
标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'registerUrl'
=>
'/reg.html'
,
// 注册的URL链接
'aliLoginUrl'
=>
'/passport/login/alipay'
,
// 支付宝快捷登录的URL链接
'weiboLoginUrl'
=>
'/passport/login/sina'
,
// 微博登录的URL链接
'qqLoginUrl'
=>
'/passport/login/qq'
,
// 腾讯QQ登录的URL链接
'internationalUrl'
=>
'/login.html'
,
// 国际号登录的URL链接
'phoneRetriveUrl'
=>
'/passport/back/mobile'
,
// 通过手机号找回密码的URL链接
'emailRetriveUrl'
=>
'/passport/back/email'
,
// 通过邮箱找回密码的URL链接
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'platform'
=>
$sourceType
,
'openId'
=>
$openId
,
// openId
'areaCode'
=>
'+86'
,
//默认区号
'countrys'
=>
RegData
::
getAreasData
(),
//国别码
'nickname'
=>
$nickname
,
//昵称
);
// 渲染模板
$this
->
_view
->
display
(
'index'
,
$data
);
}
/**
* 手机验证码页面
*/
public
function
codeAction
()
{
$this
->
setTitle
(
'验证手机'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nickname
=
$this
->
get
(
'nickname'
);
$areaCode
=
$this
->
get
(
'areaCode'
,
'86'
);
$isReg
=
$this
->
get
(
'isReg'
);
$mobile
=
$this
->
get
(
'mobile'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'openId'
=>
$openId
,
// openId
'nickname'
=>
$nickname
,
//昵称
'isReg'
=>
$isReg
,
//是否是已注册过的手机号
'areaCode'
=>
$areaCode
,
//国别码
'phoneNum'
=>
$mobile
,
//手机号码
);
// 渲染模板
$this
->
_view
->
display
(
'code'
,
$data
);
}
/**
* 设置登录密码页面
*/
public
function
passwordAction
()
{
$this
->
setTitle
(
'重新设置登录密码'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nickname
=
$this
->
get
(
'nickname'
);
$areaCode
=
$this
->
get
(
'areaCode'
,
'86'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'openId'
=>
$openId
,
// openId
'nickname'
=>
$nickname
,
//昵称
'areaCode'
=>
$areaCode
//国别码
);
// 渲染模板
$this
->
_view
->
display
(
'password'
,
$data
);
}
//绑定前手机号校验
public
function
bindCheckAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$mobile
=
$this
->
post
(
'mobile'
);
$openId
=
$this
->
post
(
'openId'
);
$areaCode
=
$this
->
post
(
'areaCode'
,
'86'
);
$sourceType
=
$this
->
post
(
'sourceType'
);
$nickname
=
$this
->
post
(
'nickname'
);
if
(
!
is_numeric
(
$mobile
)
||
!
$openId
||
!
$areaCode
||
!
$sourceType
)
{
break
;
}
$res
=
BindData
::
bindCheck
(
$mobile
,
$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
));
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'is_register'
=>
$res
[
'data'
][
'is_register'
],
'next'
=>
$next
));
}
else
{
$data
=
array
(
'code'
=>
500
,
'message'
=>
$res
[
'message'
],
'data'
=>
$res
[
'data'
]);
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
//发送验证码
public
function
sendBindMsgAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$mobile
=
$this
->
post
(
'mobile'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$mobile
))
{
break
;
}
$data
=
BindData
::
sendBindMsg
(
$areaCode
,
$mobile
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
//校验短信验证码
public
function
checkBindMsgAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$mobile
=
$this
->
post
(
'mobile'
);
$msgCode
=
$this
->
post
(
'msgCode'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$mobile
)
||
!
$msgCode
)
{
break
;
}
$data
=
BindData
::
checkBindCode
(
$areaCode
,
$mobile
,
$msgCode
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
//绑定手机号
public
function
bindMobileAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
$mobile
=
$this
->
post
(
'mobile'
);
$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
)
{
break
;
}
// /**
// * 支付宝账号登录:回调方法
// */
// public function alipaycallbackAction()
// {
// $realName = $this->_request->get('real_name');
// $email = $this->_request->get('email');
// $userId = $this->_request->get('user_id');
//
// $result = array();
// if (isset($realName, $email, $userId)) {
// $result = LoginData::signinByOpenID($realName, $userId, 'alipay');
// }
//
// $refer = $this->getCookie('refer');
// if (empty($refer)) {
// $refer = SITE_MAIN . '/?go=1';
// } else {
// $refer = rawurldecode($refer);
// }
//
// if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
// $token = Helpers::makeToken($result['data']['uid']);
// $this->setCookie('_TOKEN', $token);
// $this->setSession('_TOKEN', $token);
// $this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
// } else {
// $this->go($refer);
// }
// }
$res
=
BindData
::
bindMobile
(
$openId
,
$nickname
,
$sourceType
,
$mobile
,
$areaCode
,
$password
);
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
}
//绑定成功,跳转页面
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
if
(
isset
(
$res
[
'code'
])
&&
$res
[
'code'
]
==
200
&&
!
empty
(
$res
[
'data'
][
'uid'
]))
{
$token
=
Helpers
::
makeToken
(
$res
[
'data'
][
'uid'
]);
$this
->
setCookie
(
'_TOKEN'
,
$token
);
$this
->
setSession
(
'_TOKEN'
,
$token
);
$refer
=
Helpers
::
syncUserSession
(
$data
[
'data'
][
'uid'
],
$refer
);
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'refer'
=>
$refer
));
}
else
{
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'refer'
=>
$refer
));
}
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
c4dce4b
...
...
@@ -182,6 +182,13 @@ class LoginController extends AbstractAction
if
(
isset
(
$realName
,
$email
,
$userId
))
{
$result
=
LoginData
::
signinByOpenID
(
$realName
,
$userId
,
'alipay'
);
}
//判定是否需要绑定手机号
$isBind
=
$result
[
'data'
][
'is_bind'
];
if
(
$isBind
==
'N'
)
{
$this
->
go
(
Helpers
::
url
(
'/passport/bind/index'
,
array
(
'openId'
=>
$userId
,
'sourceType'
=>
'alipay'
,
'nickName'
=>
$realName
)));
}
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
...
...
@@ -219,7 +226,7 @@ class LoginController extends AbstractAction
$isBind
=
$result
[
'data'
][
'is_bind'
];
if
(
$isBind
==
'N'
)
{
$this
->
go
(
Helpers
::
url
(
'/passport/bind/index'
));
$this
->
go
(
Helpers
::
url
(
'/passport/bind/index'
,
array
(
'openId'
=>
$access
[
'openid'
],
'sourceType'
=>
'qq'
,
'nickName'
=>
$partnerInfo
[
'nickname'
])
));
}
$refer
=
$this
->
getCookie
(
'refer'
);
...
...
@@ -259,7 +266,13 @@ class LoginController extends AbstractAction
if
(
$partnerInfo
&&
is_array
(
$partnerInfo
))
{
$result
=
LoginData
::
signinByOpenID
(
$partnerInfo
[
'screen_name'
],
$access
[
'uid'
],
'sina'
);
}
//判定是否需要绑定手机号
$isBind
=
$result
[
'data'
][
'is_bind'
];
if
(
$isBind
==
'N'
)
{
$this
->
go
(
Helpers
::
url
(
'/passport/bind/index'
,
array
(
'openId'
=>
$access
[
'uid'
],
'sourceType'
=>
'sina'
,
'nickName'
=>
$partnerInfo
[
'screen_name'
])));
}
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
...
...
Please
register
or
login
to post a comment