...
|
...
|
@@ -15,7 +15,12 @@ const _ = require('lodash'); |
|
|
const config = global.yoho.config;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
const favProduct = (uid, page, limit) => {
|
|
|
class favoriteIndexModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
favProduct(uid, page, limit) {
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.favorite.product',
|
...
|
...
|
@@ -115,10 +120,9 @@ const favProduct = (uid, page, limit) => { |
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const favfavBrand = (uid, page, limit) => {
|
|
|
}
|
|
|
|
|
|
favfavBrand(uid, page, limit) {
|
|
|
return api.get('', {
|
|
|
method: 'app.favorite.brand',
|
|
|
uid: uid,
|
...
|
...
|
@@ -199,9 +203,9 @@ const favfavBrand = (uid, page, limit) => { |
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
const favoriteDelete = (uid, type, favId) => {
|
|
|
favoriteDelete(uid, type, favId) {
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.favorite.cancel',
|
...
|
...
|
@@ -209,28 +213,25 @@ const favoriteDelete = (uid, type, favId) => { |
|
|
type: type,
|
|
|
fav_id: favId
|
|
|
});
|
|
|
};
|
|
|
const index = (uid, page, limit, isbrand) => {
|
|
|
}
|
|
|
|
|
|
index(uid, page, limit, isbrand) {
|
|
|
if (isbrand) {
|
|
|
return favfavBrand(uid, page, limit).then(result=> {
|
|
|
return this.favfavBrand(uid, page, limit).then(result=> {
|
|
|
if (result.total === 0) {
|
|
|
result = {nobrandData: 1};
|
|
|
}
|
|
|
return result;
|
|
|
});
|
|
|
} else {
|
|
|
return favProduct(uid, page, limit).then(result=> {
|
|
|
return this.favProduct(uid, page, limit).then(result=> {
|
|
|
if (result.total === 0) {
|
|
|
result = {noproductData: 1};
|
|
|
}
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
favProduct,
|
|
|
favfavBrand,
|
|
|
favoriteDelete,
|
|
|
index
|
|
|
}; |
|
|
module.exports = favoriteIndexModel; |
...
|
...
|
|