var APIBase = require("../../api.base");
var system = require("../../../system");
class TestAPI extends APIBase {
    constructor() {
        super();
        this.orderSve = system.getObject("service.order.orderSve");
        this.platformUtils = system.getObject("util.businessManager.opPlatformUtils");

        this.restClient = system.getObject("util.restClient");
    }
    async test(pobj, query, req) {
        // var tmp = await this.orderSve.createLicense(pobj.action_body);
        //获取验证码
        // await this.platformUtils.fetchVCode(pobj.action_body.mobile);
        //创建用户
        // var result = await this.platformUtils.createUserInfo("13075556691", "13075556693", "9366");
        //创建用户
        var result = await this.platformUtils.login("13075556691", "9366");
        return result;
    }

    async testOrder(pobj, query, req) {
        console.log(pobj.orders);
        if (pobj.orders) {
            for (let order of pobj.orders) {
                this.orderSve.addSourceOrder({
                    "product_id": 10010000,
                    "source_id": 1000,
                    "source_no": order.no,
                    "notes": "个体户工商户注册、刻章、银行开户、税务报道",
                    "contact_mobile": order.mobile
                });
            }
        }

        return "success";
    }

    async testInvoice() {
        let params = {
            uploadPeriod: "201910",
            companyId: "102",
            customerId: "498757",
            userId: 43,
            file: [
                "https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_37001579517783654202020185623654wzr.jpg",
            ]
        };
        let apiurl = "https://nga-api.gongsibao.com/nga-sass//billInfo/uploadFileForAliyun";
        console.log(apiurl, params);
        let rs = await this.restClient.execPost(params, apiurl);
        console.log(rs);
    }
    exam() {
        return "";
    }
    classDesc() {
        return {
            groupName: "",
            groupDesc: "",
            name: "",
            desc: "",
            exam: "",
        };
    }
    methodDescs() {
        return [
            {
                methodDesc: "",
                methodName: "",
                paramdescs: [
                    {
                        paramDesc: "",
                        paramName: "",
                        paramType: "",
                        defaultValue: "",
                    }
                ],
                rtnTypeDesc: "",
                rtnType: ""
            }
        ];
    }
}
module.exports = TestAPI;