|
|
'use strict';
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
class cartCountModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
const cartCount = (uid, shoppingKey) => {
|
|
|
let params = {
|
|
|
method: 'app.Shopping.count'
|
|
|
};
|
|
|
cartCount(uid, shoppingKey) {
|
|
|
let params = {
|
|
|
method: 'app.Shopping.count'
|
|
|
};
|
|
|
|
|
|
if (!uid && !shoppingKey) {
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
if (!uid && !shoppingKey) {
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
|
|
|
if (uid) {
|
|
|
Object.assign(params, {
|
|
|
uid: uid
|
|
|
});
|
|
|
}
|
|
|
if (uid) {
|
|
|
Object.assign(params, {
|
|
|
uid: uid
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (shoppingKey) {
|
|
|
Object.assign(params, {
|
|
|
shopping_key: shoppingKey
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (shoppingKey) {
|
|
|
Object.assign(params, {
|
|
|
shopping_key: shoppingKey
|
|
|
return this.get({
|
|
|
data: params
|
|
|
}).then((result) => {
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return api.get('', params).then((result) => {
|
|
|
return result;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
cartCount
|
|
|
}; |
|
|
module.exports = cartCountModel; |
...
|
...
|
|