{"size": 1136, "ext": "js", "max_stars_repo_path": "src/controllers/events.js", "max_stars_repo_name": "nagucc/jkef-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/controllers/events.js", "max_issues_repo_name": "nagucc/jkef-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/controllers/events.js", "max_forks_repo_name": "nagucc/jkef-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.4339622642, "max_line_length": 55, "alphanum_fraction": 0.536971831}
/*
 eslint-disable no-param-reassign
*/

import { Router } from 'express';
import expressJwt from 'express-jwt';
import { SUCCESS } from 'nagu-validates';
import { secret } from '../config';
import { getToken, isMockVersion } from '../utils';


const router = new Router();


router.get('/wxapp',
  // // 返回mock数据
  // (req, res, next) => {
  //   if (isMockVersion(req)) {
  //     const data = [{
  //       id: 'jkef-jxj',
  //       title: '升学考试录取信息填写',
  //       desc: '2017年度基金会奖学金发放工作即将开始，请您抓紧时间登记录取信息。',
  //       faClass: 'fa fa-gift fa-3x',
  //       url: '/pages/cee/registration/registration',
  //     }];
  //     res.json({
  //       ret: SUCCESS,
  //       data,
  //     });
  //   } else next();
  // },
  // 确保用户已登录
  expressJwt({
    secret,
    credentialsRequired: true,
    getToken,
  }),
  async (req, res) => {
    res.json({
      ret: SUCCESS,
      data: [{
        id: 'jkef-jxj',
        title: '升学考试录取信息填写',
        desc: '2017年度基金会奖学金发放工作即将开始，请您抓紧时间登记录取信息。',
        faClass: 'fa fa-gift fa-3x',
        url: '/pages/cee/registration/registration',
      }],
    });
  }
);

export default router;
