Commit aa5d4267 by Sxy

优化 单例

parent 8dec9120
...@@ -334,7 +334,8 @@ System.SERVICECODE = { ...@@ -334,7 +334,8 @@ System.SERVICECODE = {
EDI: 'EDI', EDI: 'EDI',
ICPANNUALREPORT: "ICPANNUALREPORT", ICPANNUALREPORT: "ICPANNUALREPORT",
EDIANNUALREPORT: "EDIANNUALREPORT", EDIANNUALREPORT: "EDIANNUALREPORT",
WANGWEN: "wangwen" WANGWEN: "wangwen",
PANNONG: "pannong"
} }
// 商机状态 // 商机状态
System.BUSSTATUS = { System.BUSSTATUS = {
......
...@@ -11,7 +11,9 @@ class LogClient { ...@@ -11,7 +11,9 @@ class LogClient {
return u; return u;
} }
async log(pobj, req, rtninfo, errinfo) { async log(pobj, req, rtninfo, errinfo) {
rtninfo.requestId = this.getUUID() if (rtninfo) {
rtninfo.requestId = this.getUUID()
}
req.params.param = pobj req.params.param = pobj
//第三个字段应该存公司id //第三个字段应该存公司id
system.execLogs( system.execLogs(
......
...@@ -12,11 +12,11 @@ function getClientByType(type) { ...@@ -12,11 +12,11 @@ function getClientByType(type) {
switch (type) { switch (type) {
case system.SERVICECODE.ICP: case system.SERVICECODE.ICP:
case system.SERVICECODE.EDI: case system.SERVICECODE.EDI:
return new vatClient() return vatClient.getInstance();
case system.SERVICECODE.WANGWEN: case system.SERVICECODE.WANGWEN:
return new wangwenClient() return wangwenClient.getInstance();
case system.SERVICECODE.PANNONG: case system.SERVICECODE.PANNONG:
return new pannongClient() return pannongClient.getInstance();
default: default:
throw new Error("无此产品类型"); throw new Error("无此产品类型");
} }
......
...@@ -7,6 +7,13 @@ const { appKey, secret } = settings; ...@@ -7,6 +7,13 @@ const { appKey, secret } = settings;
class PannongClient extends BaseClient { class PannongClient extends BaseClient {
constructor() { constructor() {
super(appKey, secret, "/api/opreceive/service/notice"); super(appKey, secret, "/api/opreceive/service/notice");
this.instance = null;
}
static getInstance() {
if (!this.instance) {
this.instance = new PannongClient();
}
return this.instance;
} }
} }
......
...@@ -9,6 +9,7 @@ const qualificationDao = system.getObject("db.delivery.qualificationDao"); ...@@ -9,6 +9,7 @@ const qualificationDao = system.getObject("db.delivery.qualificationDao");
class VatClient extends BaseClient { class VatClient extends BaseClient {
constructor() { constructor() {
super(appKey, secret, "/web/action/qcapi/springBoard"); super(appKey, secret, "/web/action/qcapi/springBoard");
this.instance = null;
this.CIRCUITSTATUS = { this.CIRCUITSTATUS = {
ACCOUNTREGISTRATION: 507, // 完成账户注册 ACCOUNTREGISTRATION: 507, // 完成账户注册
SUBMITING: 508, // 提交材料到工信部 SUBMITING: 508, // 提交材料到工信部
...@@ -19,6 +20,13 @@ class VatClient extends BaseClient { ...@@ -19,6 +20,13 @@ class VatClient extends BaseClient {
} }
} }
static getInstance() {
if (!this.instance) {
this.instance = new VatClient();
}
return this.instance;
}
/** /**
* 递交材料 * 递交材料
* @param {*} deliverData * @param {*} deliverData
......
...@@ -8,8 +8,15 @@ const { appKey, secret } = settings; ...@@ -8,8 +8,15 @@ const { appKey, secret } = settings;
class WangwenClient extends BaseClient { class WangwenClient extends BaseClient {
constructor() { constructor() {
super(appKey, secret, "/web/action/qcapi/springBoard"); super(appKey, secret, "/web/action/qcapi/springBoard");
this.instance = null;
} }
static getInstance() {
if (!this.instance) {
this.instance = new WangwenClient();
}
return this.instance;
}
/** /**
* 文网文 递交材料,状态变更 * 文网文 递交材料,状态变更
601: "完成账户注册", 601: "完成账户注册",
......
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