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
Email Patches
Plain Diff
Browse Files
Authored by
yyq
8 years ago
Commit
e386087215f5de9830b7b859f2170f2cfcd9dd5e
1 parent
61dca2ef
品牌店铺批量取消收藏
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
web-static/js/home/favorite.js
yohobuy/www.yohobuy.com/application/modules/Home/controllers/Favorite.php
web-static/js/home/favorite.js
View file @
e386087
...
...
@@ -393,7 +393,6 @@ $('#me-checkall').click(function() {
//删除收藏
$
(
'.del-favorite'
).
click
(
function
(
e
)
{
var
id
=
$
(
this
).
closest
(
'.fav-row'
).
data
(
'id'
),
shopid
=
$
(
this
).
closest
(
'.fav-row'
).
data
(
'shopid'
),
brandorshoptype
=
$
(
this
).
closest
(
'.fav-row'
).
data
(
'brandorshoptype'
);
e
.
preventDefault
();
...
...
@@ -403,9 +402,7 @@ $('.del-favorite').click(function(e) {
url
:
'/home/favorite/cancel'
,
data
:
{
id
:
id
,
shopid
:
shopid
,
brandorshoptype
:
brandorshoptype
,
type
:
favType
type
:
brandorshoptype
||
favType
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
...
...
@@ -418,16 +415,27 @@ $('.del-favorite').click(function(e) {
$
(
'#me-del-checked'
).
click
(
function
()
{
var
ids
=
[],
name
=
'商品'
;
var
optType
,
group
=
{};
if
(
favType
===
'brand'
)
{
name
=
'品牌'
;
name
=
'品牌
店铺
'
;
}
else
if
(
favType
===
'article'
)
{
name
=
'文章'
;
}
if
(
confirm
(
'您确定要删除您收藏的'
+
name
+
'吗?'
))
{
$
(
'.checkbox input[type="checkbox"]:checked'
).
each
(
function
()
{
ids
.
push
(
$
(
this
).
closest
(
'.fav-row'
).
data
(
'id'
));
var
$favRow
=
$
(
this
).
closest
(
'.fav-row'
),
rdata
=
$favRow
.
data
();
ids
.
push
(
rdata
.
id
);
if
(
rdata
.
brandorshoptype
)
{
if
(
!
group
[
rdata
.
brandorshoptype
])
{
group
[
rdata
.
brandorshoptype
]
=
[];
}
group
[
rdata
.
brandorshoptype
].
push
(
rdata
.
id
);
}
});
if
(
ids
.
length
===
0
)
{
...
...
@@ -440,6 +448,10 @@ $('#me-del-checked').click(function() {
url
:
'/home/favorite/cancel'
,
data
:
{
id
:
ids
.
join
(
','
),
group
:
{
bid
:
group
.
brand
?
group
.
brand
.
join
(
','
)
:
''
,
sid
:
group
.
shop
?
group
.
shop
.
join
(
','
)
:
''
},
type
:
favType
}
}).
then
(
function
(
data
)
{
...
...
yohobuy/www.yohobuy.com/application/modules/Home/controllers/Favorite.php
View file @
e386087
...
...
@@ -181,19 +181,27 @@ class FavoriteController extends WebAction
$uid
=
$this
->
getUid
(
true
);
$id
=
$this
->
get
(
'id'
,
''
);
$type
=
$this
->
get
(
'type'
,
''
);
$shopid
=
$this
->
get
(
'shopid'
,
''
);
$brandorshoptype
=
$this
->
get
(
'brandorshoptype'
,
''
);
$group
=
$this
->
get
(
'group'
,
''
);
// 组操作
if
(
!
$uid
||
!
$id
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'缺少参数'
,
'data'
=>
''
);
break
;
}
if
(
$brandorshoptype
&&
$shopid
&&
$brandorshoptype
===
'shop'
)
{
$result
=
FavoriteData
::
cancelProductFav
(
$uid
,
$shopid
,
false
,
true
);
//取消店铺收藏
break
;
}
switch
(
strval
(
$type
))
{
case
'shop'
:
$result
=
FavoriteData
::
cancelProductFav
(
$uid
,
$id
,
false
,
true
);
//取消店铺收藏
break
;
case
'brand'
:
if
(
$group
)
{
if
(
$group
[
'bid'
])
{
$result
=
FavoriteData
::
cancelProductFav
(
$uid
,
$group
[
'bid'
],
true
);
//取消品牌收藏
}
if
(
$group
[
'sid'
])
{
$result
=
FavoriteData
::
cancelProductFav
(
$uid
,
$group
[
'sid'
],
false
,
true
);
//取消店铺收藏
}
break
;
}
$result
=
FavoriteData
::
cancelProductFav
(
$uid
,
$id
,
true
);
//取消品牌收藏
break
;
case
'article'
:
...
...
Please
register
or
login
to post a comment