router.js
router.get('/addCartSuccess', initMiddleware, controller.default.cart.addCartSuccess);
controller.js
app/controller/default/cart.js
async addCartSuccess() { var goods_id = this.ctx.request.query.goods_id; var color_id = this.ctx.request.query.color_id; var goodsResult = await this.ctx.model.Goods.find({ "_id": goods_id }); var colorResult = await this.ctx.model.GoodsColor.find({ "_id": color_id }); if (goodsResult.length == 0 || colorResult.length == 0) { this.ctx.status = 404; this.ctx.body = '错误404'; //404 } else { var title = goodsResult[0].title + '--' + goodsResult[0].goods_version + "--" + colorResult[0].color_name; await this.ctx.render('default/add_cart_success.html', { title: title, goods_id: goods_id }); } }
view
app/view/default/add_cart_success.html
<% include ./public/header.html%> <% include ./public/banner.html%> 买购物车中商品的人还买了
5月9日-20日 小米Note 2 享花呗12期分期免息
效果