var system = require("../../../system");
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
class tmqueryCtl extends CtlBase {
  constructor() {
    super();
    this.channelApiUrl = settings.channelApiUrl();
  }
  async doPost(pobj,obj){
    var rc = system.getObject("util.execClient");
    try {
      var reqobj = {
        "actionProcess": "jd",
        "actionType": "",
        "sign":"2FviZ9PGws8Pt1fBhq0t90mjUvI",
        "actionBody": null
      };
      var requrl = obj.requrl;
      reqobj.actionType = obj.actionType || "";
      reqobj.actionBody = obj.actionBody || null;
      if(!requrl){
        return {
          status: -2,
          msg: "请求地址不能为空"
        };
      }
      if(!obj.actionType){
        return {
          status: -3,
          msg: "actionType不能为空"
        };
      }
      if(!obj.actionBody){
        return {
          status: -4,
          msg: "actionBody不能为空"
        };
      }
      var rtn = await rc.execPost(reqobj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  //访问接口测试实例
  async test(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/findTrademarkNameAccurate";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 精确查询接口
  async findTrademarkNameAccurate(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/findTrademarkNameAccurate";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 模糊查询接口
  async findTrademarkName(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/findTrademarkName";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // s申请号查询接口
  async findTrademarkzchAccurate(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/findTrademarkzchAccurate";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 申请人查询接口
  async findTrademarkzcr(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/findTrademarkzcr";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  // 商标查询接口
  async tradeMarkDetail(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/tradeMarkDetail";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  // 公告首页接口
  async noticequeryTMZCSQ(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/noticequeryTMZCSQ";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 公告检索接口
  async noticequery(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/noticequery";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 尼斯详情接口
  async getNclDetail(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/getNclDetail";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 9.尼斯分类检索
  async nclFuwuSearch(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/nclFuwuSearch";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 12.尼斯查询（二）
  async getNclByLikeNameAndNcl(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/getNclByLikeNameAndNcl";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 11.尼斯查询（一）
  async getNcl(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/getNcl";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 13.公司核名
  async icheming(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/icheming";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 14.文字转图片
  async word2pic(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/word2pic";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 15.彩色图片转黑白
  async uploadStandardTm(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/uploadStandardTm";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  // 16.获取oss上传参数
  async getOssConfig(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/tool/toolApi/getOssConfig";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 17.图片转pdf
  async pic2pdf(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/pic2pdf";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  // 18.企业模糊查询
  async getCompanyInfoByLikeName(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/getCompanyInfoByLikeName";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 
  async adjustWTSSize(obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/adjustWTSSize";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execGet(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 
  async noticesearch(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/noticesearch";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 
  async getCompanyInfoNoUser(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/getCompanyInfoNoUser";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }
  // 注册公告期号
  async noticezcggsearch(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/noticezcggsearch";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  async sbzuixinsearch(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/sbzuixinsearch";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }

  async gettwoNcl(pobj, obj) {
    var rc = system.getObject("util.execClient");
    var rtn = null;
    var requrl = this.channelApiUrl + "/api/trademark/tmqueryApi/gettwoNcl";
    console.log("requrl:" + requrl);
    try {
      rtn = await rc.execPost(obj, requrl);//此为post调用，get: rc.execGet
      var j = JSON.parse(rtn.stdout);
      return j;
    } catch (e) {
      console.log(e);
      return {
        status: -1,
        msg: "操作失败",
        err: e.stack
      };
    }
  }





}
module.exports = tmqueryCtl;
// var task = new tmqueryCtl();
// var obj={
//     "currentpage": 1,
//     "keyword": "萌",
//     "max": "",
//     "min": "",
//     "order": "",
//     "pagesize": 36,
//     "sort": "",
//     "tm_nclcode": [],
//     "tm_structure": "",
//     "tm_word": ""
//     };   
// task.test(obj).then(d=>{
//     console.log("dddddddddddddddddddddddddddddd");
//     console.log(d);
// })
