const helper = require('./src/helper');
const config = require('./etc/config.json');
const HttpClient = require('./src/HttpClient');
const CMD = {}
CMD.test = async function(){
    var secretKey = config.fanqie_config.secretKey;
    var url = "https://www.changdunovel.com/novelsale/openapi/user/recharge/v1"
    var base_params = `/?distributor_id=${config.fanqie_config.distributorId}&ts=${helper.getCurrentUnixTimestamp()}&sign=${helper.getSign(config.fanqie_config.distributorId,secretKey)}`
    let clinet = new HttpClient()
    try{
        console.log("url::",`${url}${base_params}`)
        let response = await clinet.request(`${url}${base_params}`)
        // 检查响应是否存在
        if (!response) {
            throw new Error('No response received');
        }
        console.log("response::",response)
    }catch(e){
        console.log("test error:",e)
    }

}
CMD.test()

module.exports = CMD;