const md5 = require('md5');

function renderURL(method, data) {
  const version = '1.0'
  const secret = '017c0743819088468e590246464cc75f';
  const uid = 0;
  const token = '';
  const role = '';
  const mtime = parseInt(Date.now() / 1000);
  const body = JSON.stringify(data);
  const sign = md5('rental_' + version + token + body + method + mtime + secret);
  return {
    url: `/rental/${method}?t=${mtime}&u=${uid}&v=${version}&s=${sign}`,
    method: 'post',
    data: body
  }
}

module.exports = renderURL;
