Commit ce322bab by Sxy

fix: 代码格式

parent e8df5b23
...@@ -20,12 +20,12 @@ class MsgHistoryService extends ServiceBase { ...@@ -20,12 +20,12 @@ class MsgHistoryService extends ServiceBase {
return msg; return msg;
} }
async pushBusinessLicenseMsg(senderId, targetId, businessLicense_id) { async pushBusinessLicenseMsg(senderId, targetId, businessLicenseId) {
if (!businessLicense_id) { if (!businessLicenseId) {
return 0; return 0;
} }
const notice = await this.msgnoticeDao.findOne({ fromId: senderId, toId: targetId }); const notice = await this.msgnoticeDao.findOne({ fromId: senderId, toId: targetId });
if (notice && notice.businessLicense_id == businessLicense_id) { if (notice && notice.businessLicense_id == businessLicenseId) {
return 0; return 0;
} }
...@@ -43,14 +43,14 @@ class MsgHistoryService extends ServiceBase { ...@@ -43,14 +43,14 @@ class MsgHistoryService extends ServiceBase {
senderId, senderId,
target, target,
targetId, targetId,
content: businessLicense_id, content: businessLicenseId,
isRead: false, isRead: false,
businessLicense_id, businessLicense_id: businessLicenseId,
}; };
const obj = await this.saveMsg(msg); const obj = await this.saveMsg(msg);
const bl = await this.businesslicenseDao.findById(businessLicense_id); const bl = await this.businesslicenseDao.findById(businessLicenseId);
msg.businessLicense = bl; msg.businessLicense = bl;
msg.id = obj.id; msg.id = obj.id;
msg.created_at = obj.created_at; msg.created_at = obj.created_at;
......
...@@ -10,55 +10,50 @@ class RestClient { ...@@ -10,55 +10,50 @@ class RestClient {
this.cmdDownLoadFilePattern = 'curl -G -o {fileName} {url}'; this.cmdDownLoadFilePattern = 'curl -G -o {fileName} {url}';
this.cmdPostPattern2 = 'curl -k -H \'Content-type: application/x-www-form-urlencoded\' -d \'{data}\' {url}'; this.cmdPostPattern2 = 'curl -k -H \'Content-type: application/x-www-form-urlencoded\' -d \'{data}\' {url}';
this.cmdPostPatternWithAK = 'curl -k -H \'Content-type: application/json\' -H \'AccessKey:{ak}\' -d \'{data}\' {url}'; this.cmdPostPatternWithAK = 'curl -k -H \'Content-type: application/json\' -H \'AccessKey:{ak}\' -d \'{data}\' {url}';
// 云帐户
// this.cmdPostPattern3="curl -k -H 'Content-type: application/x-www-form-urlencoded' -H 'dealer-id:"+settings.apiconfig.yunzhanghuDealer_id()+"' -H 'request-id:"+parseInt(Date.now() / 1000)+"_gsb"+"' -d '{data}' {url}";
// this.cmdGetPattern3 = "curl {-G} -k {url} --header 'dealer-id:"+settings.apiconfig.yunzhanghuDealer_id()+"'";
// e签宝
// this.cmdPostPattern4="curl -k -H 'Content-type: application/json' -H 'X-Tsign-Open-App-Id:"+settings.apiconfig.eSignBaoAppId()+"' -H 'X-Tsign-Open-App-Secret:"+settings.apiconfig.eSignBaoAppKey()+"' -d '{data}' {url}";
// form-data形式post data参数类型 md5=2&data=1 // form-data形式post data参数类型 md5=2&data=1
this.cmdPostPattern5 = 'curl -k --data \'{data}\' {url}'; this.cmdPostPattern5 = 'curl -k --data \'{data}\' {url}';
} }
FetchGetCmd(subData, url) { FetchGetCmd(subData, url) {
const cmd = this.cmdGetPattern.replace(/\{\-G\}/g, '-G').replace(/\{data\}/g, subData) const cmd = this.cmdGetPattern.replace(/\{-G\}/g, '-G').replace(/\{data\}/g, subData)
.replace(/\{url\}/g, url); .replace(/\{url\}/g, url);
return cmd; return cmd;
} }
FetchPostCmd(subData, url) { FetchPostCmd(subData, url) {
const data = JSON.stringify(subData); const data = JSON.stringify(subData);
const cmd = this.cmdPostPattern.replace( const cmd = this.cmdPostPattern.replace(
/\{data\}/g, /\{data\}/g,
data, data,
).replace(/\{url\}/g, url); ).replace(/\{url\}/g, url);
return cmd; return cmd;
} }
FetchPostCmdWithAK(subData, url, acck) { FetchPostCmdWithAK(subData, url, acck) {
const data = JSON.stringify(subData); const data = JSON.stringify(subData);
const cmd = this.cmdPostPatternWithAK.replace( const cmd = this.cmdPostPatternWithAK.replace(
/\{data\}/g, /\{data\}/g,
data, data,
).replace(/\{url\}/g, url) ).replace(/\{url\}/g, url)
.replace(/\{ak\}/g, acck); .replace(/\{ak\}/g, acck);
return cmd; return cmd;
} }
FetchPostCmd2(subData, url) { FetchPostCmd2(subData, url) {
const data = subData; const data = subData;
const cmd = this.cmdPostPattern2.replace( const cmd = this.cmdPostPattern2.replace(
/\{data\}/g, /\{data\}/g,
data, data,
).replace(/\{url\}/g, url); ).replace(/\{url\}/g, url);
return cmd; return cmd;
} }
FetchPostCmd3(subData, url) { FetchPostCmd3(subData, url) {
const data = subData; const data = subData;
const cmd = this.cmdPostPattern3.replace( const cmd = this.cmdPostPattern3.replace(
/\{data\}/g, /\{data\}/g,
data, data,
).replace(/\{url\}/g, url); ).replace(/\{url\}/g, url);
return cmd; return cmd;
} }
FetchGetCmd3(url) { FetchGetCmd3(url) {
const cmd = this.cmdGetPattern3.replace(/\{\-G\}/g, '-G').replace(/\{url\}/g, url); const cmd = this.cmdGetPattern3.replace(/\{-G\}/g, '-G').replace(/\{url\}/g, url);
return cmd; return cmd;
} }
FetchPostCmd4(subData, url) { FetchPostCmd4(subData, url) {
...@@ -78,10 +73,10 @@ class RestClient { ...@@ -78,10 +73,10 @@ class RestClient {
return cmd; return cmd;
} }
FetchDownLoadCmd(outfname, url) { FetchDownLoadCmd(outfname, url) {
// console.log(this.cmdPattern); // console.log(this.cmdPattern);
const cmd = this.cmdDownLoadFilePattern.replace(/\{fileName\}/g, outfname).replace(/\{url\}/g, url); const cmd = this.cmdDownLoadFilePattern.replace(/\{fileName\}/g, outfname).replace(/\{url\}/g, url);
return cmd; return cmd;
} }
async exec(cmd) { async exec(cmd) {
// await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值 // await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
// 异常需要try/catch自己捕获或外部catch捕获 // 异常需要try/catch自己捕获或外部catch捕获
......
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