Authored by 郭成尧

cart-goods-count

... ... @@ -4,12 +4,12 @@
const countModel = require('../models/count');
let cartCount = (req, res, next) => {
const cartCount = (req, res, next) => {
let uid = req.user.uid;
let shoppingKey = req.cookies._SPK || '';
countModel.cartCount(uid, shoppingKey).then((result) => {
req.ctx(countModel).cartCount(uid, shoppingKey).then((result) => {
res.json(result);
}).catch(next);
};
... ...
'use strict';
const api = global.yoho.API;
class cartCountModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
const cartCount = (uid, shoppingKey) => {
cartCount(uid, shoppingKey) {
let params = {
method: 'app.Shopping.count'
};
... ... @@ -23,11 +26,12 @@ const cartCount = (uid, shoppingKey) => {
});
}
return api.get('', params).then((result) => {
return this.get({
data: params
}).then((result) => {
return result;
});
};
}
}
module.exports = {
cartCount
};
module.exports = cartCountModel;
... ...