index.js 948 Bytes

import {
  GlAxios
} from '../../node_modules/glsx-vue-common/dist/glsx-vue-common'
import { sign } from './sign'
import {
  methods as nmMethods
} from './noticeManage'
import {
  methods as ctMethods
} from './noticeCenter'
const request = {
  req: (params, type) => {
    params.source = 'glsx-oss-notice'
    params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
    params.timestamp = new Date().getTime()
    params.v = '1.0.0'
    params.format = 'json'
    // const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
    // return GlAxios.get(url, { 'params': sign(params) })
    const __type = type || 'get'
    const __params = (type && type.toLowerCase() === 'post') ? sign(params) : { 'params': sign(params) }
    const __router = (type && type.toLowerCase() === 'post') ? 'router?method=' + params.method : 'router'
    return GlAxios[__type](__router, __params)
  }
}
export {
  request,
  nmMethods,
  ctMethods
}