Commit 8759a5dc by 王昆

gsb

parent 33683f42
......@@ -253,26 +253,39 @@ class ServiceBase {
}
async callApi(url, data, name) {
let log = await this.synlogDao.create({
apiUrl: url,
apiName: name,
apiReq: JSON.stringify(data),
apiRes: "",
});
let res = await axios({
method: 'post',
url: url,
data: data
});
console.log(res);
console.log(res.data);
log.apiRes = JSON.stringify(res.data);
log.save();
let res;
let log = await this.addSynLog(url, data, name);
try {
res = await axios({
method: 'post',
url: url,
data: data
});
if(log) {
log.apiRes = JSON.stringify(res.data);
log.save();
}
return res.data;
} catch (e) {
console.log(e);
}
return res.data;
}
async addSynLog(url, data, name) {
try {
return await this.synlogDao.create({
apiUrl: url,
apiName: name,
apiReq: JSON.stringify(data),
apiRes: "",
});
} catch (e) {
console.log(e)
}
return null;
}
trim(o) {
if (!o) {
return "";
......
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