Commit 8e0b2768 by wkliang

test curl

parent 66e730cb
......@@ -74,6 +74,14 @@ class RejAPI extends APIBase {
}
}
async testpost() {
try {
console.log('into')
return await this.rejcbSve.testpost()
} catch (error) {
}
}
classDesc () {
return {
groupName: "auth",
......
......@@ -5,6 +5,7 @@ class RejcbService extends ServiceBase {
super()
this.tcDao = system.getObject('db.rejreex.trademarkcaseDao')
this.bcDao = system.getObject('db.common.bcdataDao')
this.restClient = system.getObject("util.restClient")
this.isTest = true
}
......@@ -171,5 +172,17 @@ class RejcbService extends ServiceBase {
async initStatus () {
return await this.tcDao.model.update({ rejStatus: "待提报" }, { where: { caseId: { [this.db.Op.like]: `%TESTCB%` } } })
}
async testpost () {
console.log('into')
let url = 'https://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_word2picb2bcb9fc564ef2a1f4b3cbe9352f39.jpg'
let res = await this.restClient.execGet(null, url)
if(res) {
console.log('1 ')
} else {
console.log(' 2')
}
return res
}
}
module.exports = RejcbService;
......@@ -93,9 +93,27 @@ class RestClient {
return result;
}
async execGet (subData, url) {
console.log(settings.env)
if (settings.env == 'dev') {
try {
console.log('get ??')
const rs = await axios.get(url);
console.log('rs --', rs , ' type --', typeof rs)
const ret = {
stdout: JSON.stringify(rs.data)
}
return ret;
} catch (error) {
console.log(error.response.status)
}
}
try {
let cmd = this.FetchGetCmd(subData, url);
var result = await this.exec(cmd);
return result;
} catch (error) {
}
}
async execGet2 (subData, url) {
var data = querystring.stringify(subData);
......@@ -106,6 +124,7 @@ class RestClient {
async execPost (subData, url) {
if (settings.env == 'dev') {
const rs = await axios.post(url, subData);
console.log(rs)
const ret = {
stdout: JSON.stringify(rs.data)
}
......
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