var Mock = require("mockjs") module.exports={ //模拟基础数据 ok:function (message){ return { code:200, message:message, result:'OK' } }, error:function (message){ return { code:200, message:message, result:'FAIL' } }, //模拟分页数据 page:function (req,message,obj){ return Mock.mock({...this.ok(message),...{ body:{ 'totalCount|10-100':0, pageSize:req.query.pageSize, totalPage:function (){ return Math.ceil(this.totalCount/this.pageSize) }, currentPage:function (){ return Mock.Random.natural(1,this.totalPage) }, data:function (){ let arr=[] for(let i=0;i