import request from './request.js'
import md5 from 'js-md5'
const secret = '117c0743819088468e590246464cc75e';
const baseUrl ="https://ndzx.hqedust.com"

export function fetch(action, data) {
  let token = ''
  let timestamp = Date.now()
  action = action.toLowerCase()
  let signstr = `weixin_${token}_${action}_${timestamp}_${secret}`
  let signsure = md5( signstr )
  let url = `${baseUrl}/weixin/${action}`
  return request({
    url: url,
    method: 'post',
    header:{
        'Content-Type': 'application/json',
        'x-signsure': signsure,
        'x-timestamp': timestamp
    },
    data: data
  })
}
