On this page
指定分类下的视频分页
控制器:app/controller/video.js
js
async list() {
let { ctx, app } = this;
ctx.validate({
category_id: {
type: "int",
required: true,
desc: "分类ID"
},
page: {
type: "int",
required: true,
desc: "分页"
}
});
let { category_id } = ctx.params;
let rows = await ctx.page(app.model.Video, {
category_id
});
ctx.apiSuccess(rows);
}
路由:app/router.js
js
router.get("/category/:category_id/video/:page", controller.video.list);