/**
 * Created by pc on 2015/9/18.
 * @author wxl
 * @date 2015-09-21
 * @des:发送手机验证码
 */
var co       = require('co');
var fs       = require('fs');
var hbs      = require('handlebars');
var iconv    = require('iconv-lite');
var r        = require('../../../lib/r.js');
var QS       = require('querystring');
var template = hbs.compile(fs.readFileSync('./scripts/finance/info/sendCode.html').toString());
exports.handle=function(req, rh, maxAge, transEnc, queryString, callback) {
    co (function *(){
        var param=QS.parse(queryString);
        var jsonResult={"param":param};
        var path  = require('../../../conf/config.js').config().path;
        jsonResult.host=req.headers.host+path;
        jsonResult.cookieHost=req.headers.host;
        var html = template(jsonResult);
        // 设置响应头信息
        rh.setHeader('Content-Type', 'text/html; charset=UTF-8');
        if(maxAge)rh.setHeader('Cache-Control', 'max-age=' + (maxAge));

        // 设置响应内容
        rh.setBody(html);
        // 回调通知
        callback(null, rh);
    })();

}
