import baseAxios from '../index'

export default class DashboardService {
  static instance: DashboardService
  static getInstance() {
    if (!DashboardService.instance) {
      DashboardService.instance = new DashboardService()
    }
    return DashboardService.instance
  }

  queryChart(data: { days: number; name: string }) {
    return baseAxios<Array<{
      time: number
      value: number
    }>>({
      url: '/dashboard/chart',
      method: 'get',
      params:data,
    })
  }

  queryRealTime() {
    return baseAxios<{
      login_dau: number
      total_dau: number
      total_register_user:number
    }>({
      url: '/dashboard/realTime',
      method: 'get',
    })
  }
}
