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
毕凯
9 years ago
Commit
c8a34a6b3b4e4bff689266bca70b8c12f4e928f4
2 parents
111bab9a
67156926
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
c8a34a6
...
...
@@ -425,4 +425,40 @@ class IndexController extends AbstractAction
$this
->
echoJson
(
$result
);
}
}
/**
* 加入购物车
*
* @param string productSku 商品的SKU
* @param int buyNumber 购买数量
* @param int promotionId 促销ID, 加价购有关
* @param int goodsType 商品类型,0表示普通商品,1表示加价购商品
* @param int isEdit 是否是编辑商品SKU,0表示不是编辑
* @return json
*/
public
function
addAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$productSku
=
$this
->
post
(
'productSku'
);
$buyNumber
=
$this
->
post
(
'buyNumber'
,
1
);
$goodsType
=
$this
->
post
(
'goodsType'
,
0
);
$promotionId
=
$this
->
post
(
'promotionId'
,
0
);
$isEdit
=
$this
->
post
(
'isEdit'
,
0
);
$uid
=
$this
->
getUid
(
true
);
// 执行加入购物车操作
$result
=
CartModel
::
addToCart
(
$productSku
,
$buyNumber
,
$goodsType
,
$isEdit
,
$promotionId
,
$uid
,
$shoppingKey
);
// 设置加入购物车凭证到客户端浏览器
if
(
isset
(
$result
[
'data'
][
'shopping_key'
]))
{
$this
->
setCookie
(
'_spk'
,
$shoppingKey
);
}
}
$this
->
echoJson
(
$result
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
c8a34a6
...
...
@@ -254,13 +254,13 @@ class BindController extends AbstractAction
{
$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
);
$refer
=
Helpers
::
syncUserSession
(
$
res
[
'data'
][
'uid'
],
$refer
);
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'refer'
=>
$refer
));
}
else
...
...
Please
register
or
login
to post a comment