{"size": 893, "ext": "js", "max_stars_repo_path": "packages/vue2-simple-template/template/mocks/routes/article.js", "max_stars_repo_name": "GATING/gating-cli-template", "max_stars_repo_stars_event_min_datetime": "2022-02-14T03:37:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T02:25:13.000Z", "max_issues_repo_path": "packages/vue2-simple-template/template/mocks/routes/article.js", "max_issues_repo_name": "GATING/gating-cli-template", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/vue2-simple-template/template/mocks/routes/article.js", "max_forks_repo_name": "GATING/gating-cli-template", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.8444444444, "max_line_length": 80, "alphanum_fraction": 0.4759238522}
const Mock = require('mockjs')

const list = []
const count = 100

for (let i = 0; i < count; i++) {
  list.push(
    Mock.mock({
      id: '@increment',
      name: '@first',
      'age|1-100': 100,
      'sex|1': ['男', '女'],
      timestamp: +Mock.Random.date('T')
    })
  )
}
module.exports = [
  {
    url: '/article/list',
    type: 'get',
    response: req => {
      const { name, current = 1, size = 20 } = req.query

      let mockList = list.filter(item => {
        if (name && item.name.indexOf(name) < 0) return false
        return true
      })

      const pageList = mockList.filter(
        (item, index) => index < size * current && index >= size * (current - 1)
      )
      return {
        code: 200,
        data: {
          list: pageList,
          current,
          size,
          total: mockList.length
        },
        message: 'success'
      }
    }
  }
]
