import Mock from 'mockjs'

const data = Mock.mock({
  'items|34': [{
    id: '@id',
    title: '@sentence(10, 20)',
    'status|1': ['published', 'draft', 'deleted'],
    author: 'name',
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }]
})

export default [
  {
    url: '/app-demo/list',
    type: 'post',
    response: (req, res, next) => {
      // req.body 可获取post参数
      // req.query 可获取get参数
      const items = data.items
      return {
        body: {
          total: items.length,
          items: items
        },
        head: {
          errorCode: '0',
          data: null
        }
      }
    }
  }
]
