Commit aa5d4267 by Sxy

优化 单例

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