Authored by zhangxiaoru

品牌收藏

... ... @@ -106,7 +106,8 @@ const favoriteBrand = (req, res, next) => {
/* 判断参数是否有效 */
let id = req.body.id,
opt = req.body.opt || 'ok',
uid = req.user.uid || (req.body.uid && parseInt(crypto.decrypt(null, req.body.uid))) || req.cookies.appUid;
uid = req.user.uid || (req.body.uid && parseInt(crypto.decrypt(null, req.body.uid))) || req.cookies.appUid,
isBrand = req.body.isBrand;
if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) {
res.json(result);
... ... @@ -114,7 +115,7 @@ const favoriteBrand = (req, res, next) => {
}
// 执行收藏或取消操作
return brandModel.favoriteBrand(uid, id, opt).then(data => {
return brandModel.favoriteBrand(uid, id, opt, isBrand).then(data => {
if (!data) {
res.json({
code: 400,
... ...
... ... @@ -14,7 +14,7 @@ const api = global.yoho.API;
* @param {string} opt [操作(ok:表示确定,cancel:表示取消)]
* @return {[array]}
*/
const favoriteBrand = (uid, id, isBrand, opt) => {
const favoriteBrand = (uid, id, opt, isBrand) => {
let param = {
uid: uid,
type: isBrand ? 'brand' : 'product'
... ...
... ... @@ -109,7 +109,8 @@ likeHammer.on('tap', function(e) {
data: {
id: brandId,
opt: opt,
uid: uid
uid: uid,
isBrand: 'brand'
},
success: function(data) {
if (data.code === 200) {
... ...