Authored by zhangxiaoru

品牌收藏

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