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
biao
9 years ago
Commit
6e2a33f64515a3a625f31ce408c292777c67279e
2 parents
997c483a
7da39ce2
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
170 additions
and
139 deletions
library/Api/Yohobuy.php
library/LibModels/Wap/Passport/LoginData.php
library/LibModels/Wap/Passport/RegData.php
library/Plugin/Helpers.php
library/Plugin/Partner/Factory.php
library/Plugin/Partner/sinaweibo/Call.php
library/Plugin/Partner/sinaweibo/Config.inc.php
static/js/me/entry.js
static/js/product/detail/detail.js
static/js/product/entry.js
static/sass/me/_home.scss
static/sass/me/_vip-grade.scss
template/m.yohobuy.com/actions/index/home/index.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Home/Order.php
yohobuy/m.yohobuy.com/application/models/Index/User.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Reg.php
yohobuy/m.yohobuy.com/configs/routes.index.ini
library/Api/Yohobuy.php
View file @
6e2a33f
...
...
@@ -212,7 +212,16 @@ class Yohobuy
unset
(
$data
[
'private_key'
]);
}
if
(
!
empty
(
$data
))
{
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$data
);
// 新加支持application/x-www-form-urlencoded调用方式
$str
=
''
;
foreach
(
$data
as
$key
=>
$val
)
{
$str
.=
$key
.
'='
.
$val
.
'&'
;
}
$str
=
rtrim
(
$str
,
'&'
);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$str
);
}
$result
=
curl_exec
(
$ch
);
if
(
!
$returnJson
&&
!
empty
(
$result
))
{
...
...
library/LibModels/Wap/Passport/LoginData.php
View file @
6e2a33f
...
...
@@ -65,42 +65,28 @@ class LoginData
// 构建必传参数
$param
=
Yohobuy
::
param
();
$param
[
'v'
]
=
'4'
;
// 只有早期的V4版本才有直接生成UID
$param
[
'method'
]
=
'app.passport.signinByOpenID'
;
$param
[
'openId'
]
=
$openId
;
$param
[
'source_type'
]
=
$sourceType
;
$param
[
'nickname'
]
=
$nickname
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
*
写入
SESSION会话
*
登出
SESSION会话
*
* @param int $uid 用户ID
* @return array
*/
public
static
function
sign
inSession
(
$uid
)
public
static
function
sign
outSession
(
$token
)
{
$param
=
array
();
$param
[
'uid'
]
=
$uid
;
$param
[
'token'
]
=
md5
(
$uid
.
'#@!@#'
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL_LOGINSESSION
.
'Passport/session/index'
,
$param
);
}
/**
* 写入SESSION会话
*
* @param int $uid 用户ID
* @return array
*/
public
static
function
checkSession
(
$uid
)
{
$param
=
array
();
$param
[
'uid'
]
=
$uid
;
$param
[
'token'
]
=
md5
(
$uid
.
'#@!@#'
);
$param
[
'token'
]
=
$token
;
return
Yohobuy
::
get
(
Yohobuy
::
API_URL_LOGINSESSION
.
'Passport/session/
val
'
,
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL_LOGINSESSION
.
'Passport/session/
logout
'
,
$param
);
}
}
...
...
library/LibModels/Wap/Passport/RegData.php
View file @
6e2a33f
...
...
@@ -165,7 +165,7 @@ class RegData
$param
[
'password'
]
=
$password
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
,
true
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
library/Plugin/Helpers.php
View file @
6e2a33f
...
...
@@ -542,5 +542,21 @@ class Helpers
return
$vipLevel
;
}
/**
* 同步用户的会话
*
* 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION
*
* @param int $uid 用户ID
* @param string $refer 访问来源
* @param string $callback 回调方法名
* @return string
*/
public
static
function
syncUserSession
(
$uid
,
$refer
=
''
,
$callback
=
'call'
)
{
return
'http://m1.yohobuy.com/Passport/session/index?callback='
.
$callback
.
'&sign='
.
md5
(
$uid
.
'Js8Yn0!EwPM45-ws'
)
.
'&uid='
.
$uid
.
'&go='
.
$refer
;
}
}
...
...
library/Plugin/Partner/Factory.php
View file @
6e2a33f
...
...
@@ -49,8 +49,8 @@ abstract class Factory
{
// require dirname(__FILE__) . DS . $apiName . DS . 'Call.class.php';
$apiNameCase
=
ucfirst
(
$apiName
);
$apiClass
=
"Plugin\Partner
\\
{
$apiNameCase
}
\\
Call"
;
//$apiNameCase = ucfirst($apiName);
$apiClass
=
"Plugin\Partner
\\
{
$apiName
}
\Call"
;
self
::
$apiObjs
[
$apiName
]
=
new
$apiClass
();
self
::
$apiObjs
[
$apiName
]
->
apiName
=
$apiName
;
...
...
library/Plugin/Partner/sinaweibo/Call.php
View file @
6e2a33f
...
...
@@ -77,7 +77,7 @@ class Call extends Factory
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'uid'
]))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$userInfo
=
$this
->
client
->
show_user_by_id
(
$token
[
'uid'
]);
...
...
@@ -108,7 +108,7 @@ class Call extends Factory
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'access_token'
]))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$result
=
$this
->
client
->
friends_by_id
(
$params
[
'uid'
],
$params
[
'cursor'
],
$params
[
'count'
]);
...
...
@@ -133,7 +133,7 @@ class Call extends Factory
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'access_token'
]))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$result
=
$this
->
client
->
bilateral
(
$params
[
'uid'
],
$params
[
'page'
],
$params
[
'count'
]);
...
...
@@ -163,7 +163,7 @@ class Call extends Factory
{
$content
.=
$link
;
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$response
=
$this
->
client
->
upload
(
$content
,
$image
);
...
...
@@ -190,7 +190,7 @@ class Call extends Factory
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'access_token'
]))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
if
(
$uid
!==
null
)
{
...
...
@@ -218,7 +218,7 @@ class Call extends Factory
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'access_token'
])
&&
is_string
(
$content
))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
->
update
(
$content
);
}
...
...
@@ -238,7 +238,7 @@ class Call extends Factory
{
if
(
is_array
(
$token
)
&&
isset
(
$token
[
'access_token'
])
&&
isset
(
$uid
))
{
$this
->
client
=
new
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
=
new
\
SaeTClientV2
(
$this
->
apiConfig
[
'appId'
],
$this
->
apiConfig
[
'appKey'
],
$token
[
'access_token'
]);
$this
->
client
->
send_dm_by_id
(
$uid
,
$content
,
$id
);
}
}
...
...
library/Plugin/Partner/sinaweibo/Config.inc.php
View file @
6e2a33f
...
...
@@ -2,7 +2,7 @@
defined
(
'SITE_MAIN'
)
||
define
(
'SITE_MAIN'
,
$_SERVER
[
'HTTP_HOST'
]);
return
array
(
'appId'
=>
'2707954749'
,
'appKey'
=>
'431730e25a8a0983964a740731c3cb7d'
,
'appId'
=>
'3739328910'
,
'appKey'
=>
'9d44cded26d048e23089e5e975c93df1'
,
'appCallbackUrl'
=>
SITE_MAIN
.
'/passport/login/sinacallback'
,
);
\ No newline at end of file
...
...
static/js/me/entry.js
View file @
6e2a33f
...
...
@@ -17,3 +17,4 @@ require('./browse-record');
require
(
'./address-act'
);
require
(
'./logistic'
);
require
(
'./pay'
);
require
(
'./personal-details'
);
...
...
static/js/product/detail/detail.js
View file @
6e2a33f
...
...
@@ -43,7 +43,8 @@ goodsSwiper = new Swiper('.banner-swiper', {
paginationClickable
:
true
,
pagination
:
'.banner-top .pagination-inner'
,
nextButton
:
'.my-swiper-button-next'
,
prevButton
:
'.my-swiper-button-prev'
prevButton
:
'.my-swiper-button-prev'
,
spaceBetween
:
3
});
...
...
@@ -69,4 +70,3 @@ if (goodsDiscountHammer) {
require
(
'./like'
);
...
...
static/js/product/entry.js
View file @
6e2a33f
...
...
@@ -9,4 +9,5 @@ require('./newsale/discount');
require
(
'./list'
);
require
(
'./detail/detail'
);
require
(
'./detail/loadmore'
);
require
(
'./detail/consultform'
);
\ No newline at end of file
require
(
'./detail/consultform'
);
require
(
'./newsale/hot-rank'
);
\ No newline at end of file
...
...
static/sass/me/_home.scss
View file @
6e2a33f
...
...
@@ -24,7 +24,7 @@
width
:
pxToRem
(
126px
);
height
:
pxToRem
(
126px
);
border-radius
:
50%
;
border
:
pxToRem
(
6px
)
solid
#a7a8a9
;
border
:
pxToRem
(
6px
)
solid
#a7a8a9
;
background-image
:
image-url
(
"me/index/user-avatar.png"
);
background-size
:
100%
;
}
...
...
@@ -46,7 +46,7 @@
}
.vip-3
{
@include
rem-sprite
(
$vip
,
vip-3
);
@include
rem-sprite
(
$vip
,
vip-3
);
}
.vip-2
{
...
...
@@ -91,7 +91,7 @@
font-size
:
pxToRem
(
22px
);
line-height
:
pxToRem
(
38px
);
width
:
pxToRem
(
213px
);
&
:after
{
content
:
''
;
position
:
absolute
;
...
...
@@ -153,16 +153,17 @@
.num
{
position
:
absolute
;
padding
:
0
pxToRem
(
8px
);
top
:
0
;
right
:
pxToRem
(
40px
);
min-width
:
pxToRem
(
16px
);
font-size
:
pxToRem
(
24px
);
line-height
:
pxToRem
(
32px
);
top
:
pxToRem
(
-24px
);
right
:
pxToRem
(
36px
);
width
:
pxToRem
(
72px
);
height
:
pxToRem
(
72px
);
font-size
:
pxToRem
(
40px
);
line-height
:
pxToRem
(
72px
);
color
:
#fff
;
background
:
#
F03D
35
;
background
:
#
f03d
35
;
text-align
:
center
;
border-radius
:
pxToRem
(
20px
);
border-radius
:
50%
;
@include
transform
(
scale
(
0
.5
));
}
}
...
...
@@ -184,7 +185,7 @@
padding
:
0
pxToRem
(
30px
);
font-size
:
pxToRem
(
32px
);
line-height
:
pxToRem
(
88px
);
&
.highlight
{
background
:
#eee
;
}
...
...
@@ -214,4 +215,4 @@
float
:
right
;
}
}
}
\ No newline at end of file
}
...
...
static/sass/me/_vip-grade.scss
View file @
6e2a33f
...
...
@@ -13,10 +13,14 @@
.basic-info
{
padding-top
:
30rem
/
$pxConvertRem
;
padding-bottom
:
25rem
/
$pxConvertRem
;
.user-name
{
max-width
:
240rem
/
$pxConvertRem
;
text-overflow
:ellipsis
;
white-space
:nowrap
;
font-size
:
25rem
/
$pxConvertRem
;
margin-right
:
0
.5rem
;
display
:
inline-block
;
overflow
:
hidden
;
}
.vip-icon
{
...
...
template/m.yohobuy.com/actions/index/home/index.phtml
View file @
6e2a33f
...
...
@@ -44,22 +44,22 @@
<a
class=
"type-item"
href=
"/home/order?type=2"
>
<span
class=
"iconfont"
>
634
;</span>
<br>待付款
{
{#if
pendingPaymentCount
}
}
<span
class=
"num"
>
{
{pendingPaymentCount
}
}</span>
{
{#if
wait_pay_num
}
}
<span
class=
"num"
>
{
{wait_pay_num
}
}</span>
{
{/if
}
}
</a>
<a
class=
"type-item"
href=
"/home/order?type=3"
>
<span
class=
"iconfont"
>
63
b;</span>
<br>待发货
{
{#if
dueOutGoodsCount
}
}
<span
class=
"num"
>
{
{dueOutGoodsCount
}
}</span>
{
{#if
wait_cargo_num
}
}
<span
class=
"num"
>
{
{wait_cargo_num
}
}</span>
{
{/if
}
}
</a>
<a
class=
"type-item"
href=
"/home/order?type=4"
>
<span
class=
"iconfont"
>
633
;</span>
<br>待收货
{
{#if
dueInGoodsCount
}
}
<span
class=
"num"
>
{
{dueInGoodsCount
}
}</span>
{
{#if
send_cargo_num
}
}
<span
class=
"num"
>
{
{send_cargo_num
}
}</span>
{
{/if
}
}
</a>
</div>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
6e2a33f
...
...
@@ -471,6 +471,7 @@ class HomeController extends AbstractAction
$service
=
array
(
'header'
=>
array
(
'title'
=>
'在线客服'
),
'pageFooter'
=>
true
,
'service'
=>
$service
);
...
...
yohobuy/m.yohobuy.com/application/models/Home/Order.php
View file @
6e2a33f
...
...
@@ -23,7 +23,7 @@ class OrderModel
{
$result
=
array
();
//调用接口获得数据
$data
=
OrderData
::
getOrderData
(
$type
,
$page
,
$limit
,
$gender
,
$yh_channel
,
3444485
);
$data
=
OrderData
::
getOrderData
(
$type
,
$page
,
$limit
,
$gender
,
$yh_channel
,
$uid
);
// 判断是否还有数据, 没有数据则返回空
if
(
isset
(
$data
[
'data'
][
'page_total'
])
&&
$page
>
$data
[
'data'
][
'page_total'
])
{
return
$result
;
...
...
yohobuy/m.yohobuy.com/application/models/Index/User.php
View file @
6e2a33f
...
...
@@ -62,10 +62,9 @@ class UserModel
'brand_favorite_total'
,
'product_favorite_total'
,
'product_browse'
,
'dueInGoodsCount'
,
'dueOutGoodsCount'
,
'pendingPaymentCount'
,
'refundGoodsCount'
'send_cargo_num'
,
'wait_cargo_num'
,
'wait_pay_num'
,
);
foreach
(
$infoNumData
[
'data'
]
as
$key
=>
&
$val
)
{
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
6e2a33f
...
...
@@ -211,9 +211,12 @@ class DetailModel
// 悬浮的购物车信息
$result
[
'cartInfo'
]
=
array
(
'cartUrl'
=>
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
),
'cartUrl'
=>
Helpers
::
url
(
'/cart/index/index'
,
null
),
// 购物车链接
'addToCartUrl'
=>
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
),
// 加入购物车链接
'numInCart'
=>
0
,
'goodsInstore'
=>
$baseInfo
[
'storage'
],
'goodsInstore'
=>
$baseInfo
[
'storage'
],
// 库存量
'soldOut'
=>
$baseInfo
[
'storage'
]
==
0
,
// 已售磬
'notForSale'
=>
$baseInfo
[
'attribute'
]
==
2
,
// 非卖品
);
// 是否收藏
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
6e2a33f
...
...
@@ -16,11 +16,13 @@ class LoginController extends AbstractAction
* 登录页
*/
public
function
indexAction
()
{
{
$this
->
setTitle
(
'登录'
);
$refer
=
$this
->
get
(
'refer'
,
SITE_MAIN
.
'/?go=1'
);
$this
->
setCookie
(
'refer'
,
$refer
);
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
}
$data
=
array
(
'loginIndex'
=>
true
,
// 模板中使用JS的标识
...
...
@@ -47,8 +49,10 @@ class LoginController extends AbstractAction
{
$this
->
setTitle
(
'国际账号登录'
);
$refer
=
$this
->
get
(
'refer'
,
SITE_MAIN
.
'/?go=1'
);
$this
->
setCookie
(
'refer'
,
$refer
);
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
}
$data
=
array
();
$data
[
'loginInternational'
]
=
true
;
// 模板中使用JS的标识
...
...
@@ -63,14 +67,17 @@ class LoginController extends AbstractAction
/**
* 退出
*
* @todo
*/
public
function
outAction
()
{
$this
->
setCookie
(
'_UID'
,
''
);
headers_sent
()
||
header
(
'Location: /'
);
$refer
=
$this
->
server
(
'HTTP_REFERER'
,
SITE_MAIN
);
$token
=
$this
->
get
(
'token'
);
LoginData
::
signoutSession
(
$token
);
$this
->
go
(
$refer
);
}
/**
...
...
@@ -115,12 +122,12 @@ class LoginController extends AbstractAction
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
$data
[
'data'
]
=
array
(
// 为了异步调用老系统的SESSION会话
'session'
=>
'http://m1.yohobuy.com/Passport/session/index?callback=call&uid='
.
$data
[
'data'
][
'uid'
]
.
'&sign='
.
md5
(
$data
[
'data'
][
'uid'
]
.
'Js8Yn0!EwPM45-ws'
),
'href'
=>
rawurldecode
(
$refer
),
);
$data
[
'data'
][
'session'
]
=
Helpers
::
syncUserSession
(
$data
[
'data'
][
'uid'
]);
$data
[
'data'
][
'href'
]
=
$refer
;
}
while
(
false
);
$this
->
echoJson
(
$data
);
...
...
@@ -131,10 +138,6 @@ class LoginController extends AbstractAction
*/
public
function
alipayAction
()
{
$redirect
=
$this
->
_request
->
getServer
(
'HTTP_REFERER'
,
''
);
if
(
$redirect
!=
''
)
{
$this
->
setCookie
(
'alipay_redirect'
,
$redirect
);
}
Factory
::
create
(
'alipay'
)
->
getAuthorizeUrl
();
exit
();
...
...
@@ -145,10 +148,6 @@ class LoginController extends AbstractAction
*/
public
function
qqAction
()
{
$redirect
=
$this
->
_request
->
getServer
(
'HTTP_REFERER'
,
''
);
if
(
$redirect
!=
''
)
{
$this
->
setCookie
(
'qq_redirect'
,
$redirect
);
}
Factory
::
create
(
'qqconnect'
)
->
getAuthorizeUrl
();
exit
();
...
...
@@ -159,13 +158,7 @@ class LoginController extends AbstractAction
*/
public
function
sinaAction
()
{
$redirect
=
$this
->
_request
->
getServer
(
'HTTP_REFERER'
,
''
);
if
(
$redirect
!=
''
)
{
$this
->
setCookie
(
'sina_redirect'
,
$redirect
);
}
header
(
'Location:'
.
Factory
::
create
(
'sinaweibo'
)
->
getAuthorizeUrl
());
exit
();
$this
->
go
(
Factory
::
create
(
'sinaweibo'
)
->
getAuthorizeUrl
());
}
/**
...
...
@@ -173,30 +166,27 @@ class LoginController extends AbstractAction
*/
public
function
alipaycallbackAction
()
{
$nickname
=
''
;
$alipay
=
Factory
::
create
(
'alipay'
);
$access
=
$alipay
->
getAccessToken
();
if
(
!
isset
(
$_GET
[
'real_name'
]))
{
/* 获取支付宝用户的详细信息 */
$userInfo
=
$alipay
->
getUserInfo
(
$access
);
if
(
$userInfo
&&
$userInfo
[
'is_success'
]
===
'T'
&&
isset
(
$userInfo
[
'response'
][
'user_info'
][
'user_name'
]))
{
$nickname
=
$userInfo
[
'response'
][
'user_info'
][
'user_name'
];
// $alipayEmail = $userInfo['response']['user_info']['email'];
}
$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
{
$nickname
=
$_GET
[
'real_name'
];
// $alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
$refer
=
rawurldecode
(
$refer
);
}
$result
=
LoginData
::
signinByOpenID
(
$nickname
,
$access
[
'user_id'
],
'qq'
);
if
(
$result
[
'code'
]
==
200
)
{
$redirect
=
$this
->
_request
->
getCookie
(
'alipay_redirect'
);
$redirect
&&
$this
->
redirect
(
$redirect
);
if
(
$result
[
'code'
]
==
200
&&
!
empty
(
$result
[
'data'
][
'uid'
]))
{
$this
->
go
(
Helpers
::
syncUserSession
(
$result
[
'data'
][
'uid'
],
$refer
));
}
else
{
$this
->
go
(
$refer
);
}
$this
->
redirect
(
'/'
);
}
/**
...
...
@@ -209,16 +199,23 @@ class LoginController extends AbstractAction
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo
=
$qqconnect
->
getUserInfo
(
$access
);
$result
=
array
();
if
(
$partnerInfo
&&
is_array
(
$partnerInfo
))
{
$result
=
LoginData
::
signinByOpenID
(
$partnerInfo
[
'nickname'
],
$access
[
'openid'
],
'qq'
);
if
(
$result
[
'code'
]
==
200
)
{
$redirect
=
$this
->
_request
->
getCookie
(
'qq_redirect'
);
$redirect
&&
$this
->
redirect
(
$redirect
);
}
$result
=
LoginData
::
signinByOpenID
(
$partnerInfo
[
'nickname'
],
$access
[
'openid'
],
'qq'
);
}
$this
->
redirect
(
'/'
);
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
if
(
$result
[
'code'
]
==
200
&&
!
empty
(
$result
[
'data'
][
'uid'
]))
{
$this
->
go
(
Helpers
::
syncUserSession
(
$result
[
'data'
][
'uid'
],
$refer
));
}
else
{
$this
->
go
(
$refer
);
}
}
/**
...
...
@@ -226,21 +223,29 @@ class LoginController extends AbstractAction
*/
public
function
sinacallbackAction
()
{
$sina
=
Factory
::
create
(
'sina'
);
$sina
=
Factory
::
create
(
'sina
weibo
'
);
$access
=
$sina
->
getAccessToken
();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo
=
$sina
->
getUserInfo
(
$access
);
$result
=
array
();
if
(
$partnerInfo
&&
is_array
(
$partnerInfo
))
{
$result
=
LoginData
::
signinByOpenID
(
$partnerInfo
[
'screen_name'
],
$access
[
'uid'
],
'sina'
);
if
(
$result
[
'code'
]
==
200
)
{
$redirect
=
$this
->
_request
->
getCookie
(
'sina_redirect'
);
$redirect
&&
$this
->
redirect
(
$redirect
);
}
}
$this
->
redirect
(
'/'
);
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
if
(
$result
[
'code'
]
==
200
&&
!
empty
(
$result
[
'data'
][
'uid'
]))
{
$this
->
go
(
Helpers
::
syncUserSession
(
$result
[
'data'
][
'uid'
],
$refer
));
}
else
{
$this
->
go
(
$refer
);
}
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Reg.php
View file @
6e2a33f
...
...
@@ -133,7 +133,7 @@ class RegController extends AbstractAction
/* 返回跳转到验证页面的链接 */
if
(
$data
[
'code'
]
==
200
)
{
$token
=
Helpers
::
makeToken
(
$mobile
);
$data
[
'data'
]
=
'/passport/reg/code?token='
.
$token
.
'&phoneNum='
.
$mobile
.
'&areaCode='
.
$area
;
$data
[
'data'
]
=
Helpers
::
url
(
'/passport/reg/code'
,
array
(
'token'
=>
$token
,
'phoneNum'
=>
$mobile
,
'areaCode'
=>
$area
))
;
}
}
while
(
false
);
...
...
@@ -176,7 +176,7 @@ class RegController extends AbstractAction
/* 返回跳转到设置密码的链接 */
if
(
$data
[
'code'
]
==
200
)
{
$token
=
Helpers
::
makeToken
(
$mobile
);
$data
[
'data'
]
=
'/passport/reg/password?token='
.
$token
.
'&phoneNum='
.
$mobile
.
'&areaCode='
.
$area
;
$data
[
'data'
]
=
Helpers
::
url
(
'/passport/reg/password'
,
array
(
'token'
=>
$token
,
'phoneNum'
=>
$mobile
,
'areaCode'
=>
$area
))
;
}
else
if
(
$data
[
'code'
]
==
404
)
{
$data
[
'message'
]
=
'验证码错误'
;
//统一验证提示
}
...
...
@@ -259,22 +259,20 @@ class RegController extends AbstractAction
/* 验证注册的标识码是否有效 */
$data
=
RegData
::
regMobile
(
$area
,
$mobile
,
$password
);
if
(
!
isset
(
$data
[
'code'
]))
{
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!=
200
)
{
break
;
}
/* 返回跳转到来源页面 */
if
(
$data
[
'code'
]
==
200
)
{
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
$data
[
'data'
]
=
array
(
// 为了异步调用老系统的SESSION会话
'session'
=>
'http://m1.yohobuy.com/Passport/session/index?uid='
.
$data
[
'data'
][
'uid'
]
.
'&sign='
.
md5
(
$data
[
'data'
][
'uid'
]
.
'Js8Yn0!EwPM45-ws'
),
'href'
=>
rawurldecode
(
$refer
),
);
$refer
=
$this
->
getCookie
(
'refer'
);
if
(
empty
(
$refer
))
{
$refer
=
SITE_MAIN
.
'/?go=1'
;
}
else
{
$refer
=
rawurldecode
(
$refer
);
}
$data
[
'data'
][
'session'
]
=
Helpers
::
syncUserSession
(
$data
[
'data'
][
'uid'
]);
$data
[
'data'
][
'href'
]
=
$refer
;
}
while
(
false
);
$this
->
echoJson
(
$data
);
...
...
yohobuy/m.yohobuy.com/configs/routes.index.ini
View file @
6e2a33f
...
...
@@ -40,6 +40,13 @@ routes.interational.route.module = Passport
routes.interational.route.controller
=
Login
routes.interational.route.action
=
International
; 登录页
routes.logout.type
=
"rewrite"
routes.logout.match
=
"/passport/signout/index"
routes.logout.route.module
=
Passport
routes.logout.route.controller
=
Login
routes.logout.route.action
=
out
; 找回密码(手机号)
routes.phoneback.type
=
"rewrite"
routes.phoneback.match
=
"/phoneback.html"
...
...
Please
register
or
login
to post a comment