Commit 81ae37dd by 王悦

fix

parent bebbf222
...@@ -25,6 +25,7 @@ class searchCtl extends CtlBase { ...@@ -25,6 +25,7 @@ class searchCtl extends CtlBase {
* {"error": ""} * {"error": ""}
*/ */
async findAndCountAll(p, q, req) { async findAndCountAll(p, q, req) {
try {
let query = { let query = {
"actionType": "", "actionType": "",
"actionBody": { "actionBody": {
...@@ -53,9 +54,11 @@ class searchCtl extends CtlBase { ...@@ -53,9 +54,11 @@ class searchCtl extends CtlBase {
query.actionBody.tmName = p.search.sbmc query.actionBody.tmName = p.search.sbmc
} }
} else return; } else return;
let tokenInfo = await this.service.getToken(); }catch (e) {
if (tokenInfo && tokenInfo.data && tokenInfo.data.token) { return system.getResultFail(-8,e)
}
try { try {
let tokenInfo = await this.service.getToken();
let rtn = await this.execClient.execPostTK(query, tmurl, tokenInfo.data.token); let rtn = await this.execClient.execPostTK(query, tmurl, tokenInfo.data.token);
let data = rtn.data; let data = rtn.data;
let published = await this.service.findAll({company_id: p.company_id}); let published = await this.service.findAll({company_id: p.company_id});
...@@ -65,11 +68,10 @@ class searchCtl extends CtlBase { ...@@ -65,11 +68,10 @@ class searchCtl extends CtlBase {
item._disabled = true; item._disabled = true;
} }
}); });
return system.getResultList(data.count, data.rows)
}catch (e) { }catch (e) {
return system.getResultFail(-1,e) return system.getResultFail(-9,e)
} }
return system.getResultList(data.count, data.rows)
} else return system.getResultFail(-1, "token获取失败")
} }
} }
......
...@@ -13,14 +13,13 @@ class ServiceBase { ...@@ -13,14 +13,13 @@ class ServiceBase {
this.restS = system.getObject("util.restClient"); this.restS = system.getObject("util.restClient");
this.md5 = require("MD5"); this.md5 = require("MD5");
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.channelApiUrl = settings.channelApiUrl();
this.appInfo = { this.appInfo = {
aliyuntmtransfer: { appkey: "202003231118", secret: "7cbb846246874167b5c7e01cd0016c99" } aliyuntmtransfer: { appkey: "202003231118", secret: "7cbb846246874167b5c7e01cd0016c99" }
}; };
} }
async getToken() { async getToken() {
var self = this; var self = this;
var reqTokenUrl = settings.channelApiUrl() + "/api/opreceive/accessAuth/getAppTokenByAppKey"; var reqTokenUrl = settings.centerChannelUrl() + "/api/opreceive/accessAuth/getAppTokenByAppKey";
var reqParam = self.appInfo["aliyuntmtransfer"]; var reqParam = self.appInfo["aliyuntmtransfer"];
if (!reqParam.appkey || !reqParam.secret) { if (!reqParam.appkey || !reqParam.secret) {
return system.getResult(null, "reqType类型有误,请求失败"); return system.getResult(null, "reqType类型有误,请求失败");
......
...@@ -48,6 +48,14 @@ var settings = { ...@@ -48,6 +48,14 @@ var settings = {
return "http://zcapi-service.chaolai"; return "http://zcapi-service.chaolai";
} }
}, },
centerChannelUrl: function () {//---------center-channel
if (this.env == "dev") {
// return "http://gsbweb.qifu-dev.gongsibao.com";//localsettings.reqEsDevUrl;
return "http://gsbweb.qifu-dev.gongsibao.com:4012";
} else {
return "http://center-channel-service";
}
},
uploadfileossurl: function () { uploadfileossurl: function () {
if (this.env == "dev") { if (this.env == "dev") {
return "http://192.168.49.170:8080"; return "http://192.168.49.170:8080";
......
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