import roomType from './data/roomType'
import serviceType from './data/serviceType'
import area from './data/area'
import roomList from './data/roomList'
import wxUser from './data/wxUser'

export default {
  getData: config => {
    const {pageNum, perPage} = JSON.parse(config.body).content

    switch (JSON.parse(config.body).action) {
      case 'getRoomTypeList':
        return roomType

      case 'getServiceType':
        return serviceType

      case 'getAreaList':
        return area

      case 'getRoomList':
        let roomPageList = roomList.filter((item, index) => index < perPage * pageNum && index >= perPage * (pageNum - 1))
        return {
          errInfo: 'None',
          rescode: '200',
          total: roomList.length,
          data: roomPageList
        }

      case 'getAuthUsers':
      case 'getRequestUser':
        let wxPageList = wxUser.filter((item, index) => index < perPage * pageNum && index >= perPage * (pageNum - 1))
        return {
          errInfo: 'None',
          rescode: '200',
          total: wxUser.length,
          data: wxPageList
        }

      case 'updateUserAuth':
        return {
          errInfo: 'None',
          rescode: '200'
        }
    }
  }
}
