Commit 16f1c875 by 高宇强

gyq

parent 4f0c6712
...@@ -11,6 +11,7 @@ class EnterpriseService { ...@@ -11,6 +11,7 @@ class EnterpriseService {
this.qccUrl = "http://api.qichacha.com/ECIV4/GetDetailsByName"; this.qccUrl = "http://api.qichacha.com/ECIV4/GetDetailsByName";
this.patentApi = System.getObject("api.patent.chinapatentsearch"); this.patentApi = System.getObject("api.patent.chinapatentsearch");
this.copyApi = System.getObject("api.patent.copyrightsearch"); this.copyApi = System.getObject("api.patent.copyrightsearch");
this.redisClient = System.getObject("util.redisClient");
}; };
async getcountAll(obj){//获取企业所有证照数量 async getcountAll(obj){//获取企业所有证照数量
...@@ -125,32 +126,44 @@ class EnterpriseService { ...@@ -125,32 +126,44 @@ class EnterpriseService {
return System.getResult2(null, "企业名称不能为空"); return System.getResult2(null, "企业名称不能为空");
} }
author = await this.getConvertSemiangleStr(author); author = await this.getConvertSemiangleStr(author);
var Timespan = parseInt(Date.now()/1000);//秒级时间戳 var childName = await this.redisClient.get("qichacha_QccBranches:" + author);
var Token = md5("74805b02bf2f46feaa3bdb24feecfbc1" + Timespan.toString() + "5D92FB79060AFCBFD3D4BC7AE7A3D225"); if (childName){
Token = Token.toUpperCase(); console.log(childName);
var params = { return System.getResult2(JSON.parse(childName), "获取数据成功");
key:"74805b02bf2f46feaa3bdb24feecfbc1",
keyword:author
} }
var rc = System.getObject("util.restClient"); else{
var data= querystring.stringify(params);
var rtn=null; var Timespan = parseInt(Date.now()/1000);//秒级时间戳
try{ var Token = md5("74805b02bf2f46feaa3bdb24feecfbc1" + Timespan.toString() + "5D92FB79060AFCBFD3D4BC7AE7A3D225");
rtn=await rc.execGetZZ(params,this.qccUrl,Token,Timespan); Token = Token.toUpperCase();
var result = JSON.parse(rtn.stdout); var params = {
if (result.Status == "200"){ key:"74805b02bf2f46feaa3bdb24feecfbc1",
return System.getResult2(result.Result.Branches, "获取数据出错"); keyword:author
} }
else if (result.Status == "201"){ var rc = System.getObject("util.restClient");
return System.getResult2(null, "查询无结果"); var data= querystring.stringify(params);
} var rtn=null;
else{ try{
return System.getResult2(null, "获取数据出错"); rtn=await rc.execGetZZ(params,this.qccUrl,Token,Timespan);
} var result = JSON.parse(rtn.stdout);
if (result.Status == "200"){
}catch(e){ //await this.redisClient.set("qichacha_QccBranches:" + author, result.Result.Branches.join("-"));
return System.getResult2(null, "获取数据出错"); await this.redisClient.setWithEx("qichacha_QccBranches:" + author, JSON.stringify(result.Result.Branches), 31536000);
return System.getResult2(result.Result.Branches, "获取数据成功");
}
else if (result.Status == "201"){
return System.getResult2(null, "查询无结果");
}
else{
return System.getResult2(null, "获取数据出错");
}
}catch(e){
return System.getResult2(null, "获取数据出错");
}
} }
}; };
...@@ -769,14 +782,15 @@ class EnterpriseService { ...@@ -769,14 +782,15 @@ class EnterpriseService {
} }
module.exports = EnterpriseService; module.exports = EnterpriseService;
// var tesk = new EnterpriseService(); var tesk = new EnterpriseService();
// var parm = { var parm = {
// author: "淘宝(中国)软件有限公司" //author: "淘宝(中国)软件有限公司"
// }; author:"华为技术有限公司"
// tesk.GetcountAll(parm).then(function (result) { };
// console.log(result); tesk.getQccBranches(parm).then(function (result) {
// // console.log(result.data.data[0]); console.log(result);
// }).catch(function (e) { // console.log(result.data.data[0]);
// console.log(e); }).catch(function (e) {
// }); console.log(e);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment