model.js 598 Bytes
'use strict';
const sign = require('./sign');
const rp = require('request-promise');
const qs = require('querystring');

class model {

    constructor(ctx) {
        this.ctx = ctx;
    }

    get(url,qs, params) {
        let options = {
            uri: url,
            method: 'GET',
            qs: qs || {},
            headers: {
                'User-Agent': 'Request-Promise'
            },
            json: true
        };

        return rp(options).then(result => {
            return result;
        }).catch(()=>{
            return {};
        });
    }

}

module.exports = model;