import { Request, Response } from 'express';

export default {
  'GET /api/data/sumdate': (req: Request, res: Response) => {
    res.send(
      {
        data: [
          { name: '昨日新增', num: 2, rate: '50%' },
          { name: '昨日取关', num: 1, rate: '20%' },
          { name: '昨日净增', num: 5, rate: '60%' },
          { name: '昨日活跃', num: 3, rate: '100%' },
          { name: '总粉丝', num: 21, rate: '30%' }
        ],
        success: true
      }
    );
  },
  'GET /api/data/menu': (req: Request, res: Response) => {
    res.send(
      {
        data: [
          {
            path: '/operate',
            name: '运营中心',
            icon: 'desktop',
            component: './operate',
            roles: ['admin', 'user'],
          },
          {
            path: '/interact',
            name: '智能互动',
            icon: 'message',
            roles: ['admin', 'user'],
            routes: [
              {
                name: '智能推送',
                path: '/interact/push',
                component: './interact/push',
                roles: ['admin', 'user'],
                btns: {
                  add: ['admin', 'user'],
                  fs: ['admin', 'user'],
                  fz: ['admin', 'user'],
                  del: ['admin', 'user']
                }
              },
              {
                name: '关注回复',
                path: '/interact/reply',
                component: './interact/reply',
                roles: ['admin', 'user'],
              },
            ]
          },
          {
            path: '/news',
            name: '群发推送',
            icon: 'send',
            roles: ['admin', 'user'],
            routes: [
              {
                name: '客服消息',
                path: '/news/aservice',
                component: './news/aservice',
                roles: ['admin', 'user'],
              },
              {
                name: '模板消息',
                path: '/news/atemplate',
                component: './news/atemplate',
                roles: ['admin', 'user'],
              },
              {
                name: '高级群发',
                path: '/news/advanced',
                component: './news/advanced',
                roles: ['admin', 'user'],
              }
            ]
          },
          {
            path: '/fans',
            name: '粉丝管理',
            icon: 'team',
            roles: ['admin', 'user'],
            routes: [
              {
                name: '粉丝消息',
                path: '/fans/message',
                component: './fans/message',
                roles: ['admin', 'user'],
              },
              {
                name: '粉丝列表',
                path: '/fans/list',
                component: './fans/list',
                roles: ['admin', 'user'],
              },
              {
                name: '粉丝标签',
                path: '/fans/tag',
                component: './fans/tag',
                roles: ['admin', 'user'],
              }
            ]
          },
          {
            path: '/material',
            name: '素材管理',
            icon: 'database',
            roles: ['admin', 'user'],
            routes: [
              {
                name: '本地素材',
                path: '/material/cloud',
                component: './material/cloud',
                roles: ['admin', 'user'],
              },
              {
                name: '微信素材',
                path: '/material/weChat',
                component: './material/weChat',
                roles: ['admin', 'user'],
              }
            ],
          },
          {
            path: '/account',
            name: '公众号管理',
            icon: 'qrcode',
            component: './account',
            roles: ['admin', 'user'],
            btns: {
              add: ['admin', 'user'],
              fs: ['admin', 'user'],
              fz: ['admin', 'user'],
              del: ['admin', 'user']
            }
          },
          {
            path: '/books',
            name: '小说平台管理',
            icon: 'read',
            component: './books',
            roles: ['admin', 'user'],
          },

        ],
        success: true
      }
    );
  },
  'GET /api/data/gzh': (req: Request, res: Response) => {
    res.send(
      {
        data: [
          { group_name: '昨日新增', list: [{ name: '公众号1' }, { name: '公众号2' }], sum: 2 },
          { group_name: '昨日取关', list: [{ name: '公众号3' }, { name: '公众号4' }], sum: 2 },
          { group_name: '昨日净增', list: [{ name: '公众号5' }, { name: '公众号6' }], sum: 2 },
          { group_name: '未定义', list: [{ name: '公众号7' }, { name: '公众号8' }], sum: 2 }
        ],
        success: true
      }
    );
  },
  'GET /api/data/gzhsc': (req: Request, res: Response) => {
    let textimgArr = [{ value: '1', name: '图文标签1' }, { value: '2', name: '图文标签2' }]
    let audioArr = [{ value: '1', name: '音频标签1' }, { value: '2', name: '音频标签2' }]
    let videoArr = [{ value: '1', name: '视频标签1' }, { value: '2', name: '视频标签2' }]
    let imgsArr = [{ value: '1', name: '图片标签1' }, { value: '2', name: '图片标签2' }]
    let titlearr = ['是是是', 'wwww', '2331', '可交换机卡', '客家话加快速度', '可交换机卡']
    let imgArr = ['https://mmbiz-qpic-cn.weituibao.com/mmbiz_jpg/aOSRF0Qd4OHWicJyVYQQhEcrcQbDP011qnxvWVXIHwCtwfHOHYKnrJwKTYDs777vYYrtpkEK8pv2ibqpaU9Apq1w/0?wx_fmt=jpeg', 'https://mmbiz-qpic-cn.weituibao.com/mmbiz_jpg/aOSRF0Qd4OFn6Yj3QevQX4H2dg4ptuj18d1MsqN996jtXuK2ATPfjmMxiakm29EguzdGiafnfEwXD07eOtstxr2w/0?wx_fmt=jpeg']
    res.send(
      {
        data: {
          imgtext: {
            data: Array(30).fill('').map((item: any, index: number) => {
              return {
                date: `2020-09-${Math.floor(Math.random() * 10 + 1)}`,
                url: imgArr[index % 2],
                name: titlearr[Math.floor(Math.random() * 10)] || '测试',
                tag: textimgArr[index % 2]
              }
            }),
            tags: textimgArr
          },
          audio: {
            data: Array(30).fill('').map((item: any, index: number) => {
              return {
                url: 'https://www.runoob.com/try/demo_source/horse.mp3',
                name: titlearr[Math.floor(Math.random() * 10)] || '测试',
                tag: audioArr[index % 2]
              }
            }),
            tags: audioArr
          },
          video: {
            data: Array(30).fill('').map((item: any, index: number) => {
              return {
                url: 'https://www.runoob.com/try/demo_source/movie.mp4',
                name: titlearr[Math.floor(Math.random() * 10)] || '测试',
                tag: videoArr[index % 2]
              }
            }),
            tags: videoArr
          },
          img: {
            data: Array(30).fill('').map((item: any, index: number) => {
              return {
                url: imgArr[index % 2],
                name: titlearr[Math.floor(Math.random() * 10)] || '测试',
                tag: imgsArr[index % 2]
              }
            }),
            tags: imgsArr
          }
        },
        success: true
      }
    );
  }
}

