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,6 +126,14 @@ class EnterpriseService { ...@@ -125,6 +126,14 @@ class EnterpriseService {
return System.getResult2(null, "企业名称不能为空"); return System.getResult2(null, "企业名称不能为空");
} }
author = await this.getConvertSemiangleStr(author); author = await this.getConvertSemiangleStr(author);
var childName = await this.redisClient.get("qichacha_QccBranches:" + author);
if (childName){
console.log(childName);
return System.getResult2(JSON.parse(childName), "获取数据成功");
}
else{
var Timespan = parseInt(Date.now()/1000);//秒级时间戳 var Timespan = parseInt(Date.now()/1000);//秒级时间戳
var Token = md5("74805b02bf2f46feaa3bdb24feecfbc1" + Timespan.toString() + "5D92FB79060AFCBFD3D4BC7AE7A3D225"); var Token = md5("74805b02bf2f46feaa3bdb24feecfbc1" + Timespan.toString() + "5D92FB79060AFCBFD3D4BC7AE7A3D225");
Token = Token.toUpperCase(); Token = Token.toUpperCase();
...@@ -139,7 +148,9 @@ class EnterpriseService { ...@@ -139,7 +148,9 @@ class EnterpriseService {
rtn=await rc.execGetZZ(params,this.qccUrl,Token,Timespan); rtn=await rc.execGetZZ(params,this.qccUrl,Token,Timespan);
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.Status == "200"){ if (result.Status == "200"){
return System.getResult2(result.Result.Branches, "获取数据出错"); //await this.redisClient.set("qichacha_QccBranches:" + author, result.Result.Branches.join("-"));
await this.redisClient.setWithEx("qichacha_QccBranches:" + author, JSON.stringify(result.Result.Branches), 31536000);
return System.getResult2(result.Result.Branches, "获取数据成功");
} }
else if (result.Status == "201"){ else if (result.Status == "201"){
return System.getResult2(null, "查询无结果"); return System.getResult2(null, "查询无结果");
...@@ -151,6 +162,8 @@ class EnterpriseService { ...@@ -151,6 +162,8 @@ class EnterpriseService {
}catch(e){ }catch(e){
return System.getResult2(null, "获取数据出错"); 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