// src/mock/user.js
export default [
  // GET 示例
  {
    url: '/api/user',
    method: 'get',
    response: () => ({
      code: 0,
      data: {
        'list|5-10': [{
          'id|+1': 1,
          name: '@cname',
          avatar: '@image("100x100")'
        }]
      }
    })
  },
  
  // POST 示例
  {
    url: '/api/login',
    method: 'post',
    timeout: 1000,  // 模拟延迟
    response: ({ body }) => {
      if (body.username === 'admin' && body.password === '123456') {
        return {
          code: 0,
          token: 'mock_token_123456'
        }
      }
      return {
        code: 401,
        message: '认证失败'
      }
    }
  }
]