'use strict';
const xml2js = require('xml2js');

const Controller = require('egg').Controller;
class TestController extends Controller {
  async test() {
    this.ctx.set('content-type', 'text/xml');
    const data = {
      MsgType: 'transfer_customer_service',
      ToUserName: 'to',
      FromUserName: 'from',
      CreateTime: parseInt(new Date() / 1000),
    };
    const builder = new xml2js.Builder();
    const xml = builder.buildObject(data);
    this.ctx.body = xml;
    console.log(this.ctx);
  }
}
module.exports = TestController;
